我正在尝试使用在单独的EC2实例中托管的Jenkins从Bitbucket到aws EC2实例进行自动化CI工作流。
我创建并配置了所需的一切(IAM角色,aws客户端和代码部署代理),如下文所述: https://pranavpshah.wordpress.com/configure-aws-codedeploy/
顺便说一句,所有实例都基于ubuntu并在私有VPC中运行,我正在部署node.js应用程序。
例如,每次推送到Bitbucket repo时,我都可以在S3存储桶中成功创建.zip构建。但在Code Deploy仪表板中,我得到“部署失败没有主机成功”。错误信息。
当部署过程以状态失败结束时,我检查了/var/log/aws/codedeploy-agent/codedeploy-agent.log文件,这是我得到的:
2015-12-04 17:17:36 INFO [codedeploy-agent(28199)]: Stopping master 27971
2015-12-04 17:17:36 INFO [codedeploy-agent(27971)]: master 27971: Received TERM - stopping children and shutting down
2015-12-04 17:17:36 INFO [codedeploy-agent(27975)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller of master 27971: Received TERM - setting internal shutting down flag and possibly finishing last run
2015-12-04 17:17:55 INFO [codedeploy-agent(27975)]: [Aws::CodeDeployCommand::Client 200 60.113784 0 retries] poll_host_command(host_identifier:"arn:aws:ec2:us-west-2:219450671821:instance/i-348913ed")
2015-12-04 17:17:56 INFO [codedeploy-agent(27975)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller of master 27971: shutting down
2015-12-04 17:17:57 INFO [codedeploy-agent(28219)]: master 28219: Spawned child 1/1
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: Registering Plugins: ["codedeploy"].
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: Loading plugin codedeploy from /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/register_plugin
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: Registered Plugins: #<Set: {InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller}>.
2015-12-04 17:17:57 INFO [codedeploy-agent(28223)]: On Premises config file does not exist or not readable
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Configuring deploy control client: Region = "us-west-2"
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Deploy control endpoint override = nil
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Initializing Host Agent: Host Identifier = arn:aws:ec2:us-west-2:219450671821:instance/i-348913ed
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Validating CodeDeploy Plugin Configuration
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: InstanceAgent::Plugins::CodeDeployPlugin::CodeDeployControlCertVerifier: Actual certificate subject is '/C=US/ST=Washington/L=Seattle/O=Amazon.com, Inc./CN=codedeploy-commands.us-west-2.amazonaws.com'
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: InstanceAgent::Plugins::CodeDeployPlugin::CodeDeployControlCertVerifier: Actual certificate subject is '/C=US/ST=Washington/L=Seattle/O=Amazon.com, Inc./CN=codedeploy-commands.us-west-2.amazonaws.com'
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: InstanceAgent::Plugins::CodeDeployPlugin::CodeDeployControlCertVerifier: Actual certificate subject is '/C=US/ST=Washington/L=Seattle/O=Amazon.com, Inc./CN=codedeploy-commands.us-west-2.amazonaws.com'
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: CodeDeploy Plugin Configuration is valid
2015-12-04 17:17:57 DEBUG [codedeploy-agent(28223)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Calling PollHostCommand:
2015-12-04 17:17:58 INFO [codedeploy-agent(28219)]: Started master 28219 with 1 children
2015-12-04 17:18:58 INFO [codedeploy-agent(28223)]: [Aws::CodeDeployCommand::Client 200 60.534255 0 retries] poll_host_command(host_identifier:"arn:aws:ec2:us-west-2:219450671821:instance/i-348913ed")
我在配置中遗漏了什么?
有什么帮助吗?
答案 0 :(得分:0)
我刚检查了部署ID“d-FEPBDKJMC”的详细信息,似乎实例ID是“arn:aws:ec2:us-west-2:219450671821:instance / i-d796060e”而不是您粘贴的主机代理日志中的“arn:aws:ec2:us-west-2:219450671821:instance / i-348913ed”。所以可能应该检查正确实例上的日志。
部署时会跳过所有生命周期事件,我怀疑主机代理根本没有拉动命令。由于您提到该实例位于VPC下,请确保将Codedeploy和S3端点列入白名单(我们需要连接到这些端点以进行部署)。此处还有一个关于Codedeploy与VPC合作的文档,请点击安全性:https://aws.amazon.com/codedeploy/faqs/。
答案 1 :(得分:0)
您确定该实例有一个ROLE来访问S3吗?我错过了,没有附加到我的实例的角色来访问S3。