Jenkins 触发的代码部署在 ApplicationStop 步骤失败,即使通过直接代码部署的同一部署组运行成功 [英] Jenkins triggered code deploy is failing at ApplicationStop step even though same deployment group via code deploy directly is running successfully

查看:16
本文介绍了Jenkins 触发的代码部署在 ApplicationStop 步骤失败,即使通过直接代码部署的同一部署组运行成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过 Jenkins(代码部署插件)触发时,出现以下错误 -

When I trigger via Jenkins (code deploy plugin), I get the following error -

 No such file or directory - /opt/codedeploy-agent/deployment-root/edbe4bd2-3999-4820-b782-42d8aceb18e6/d-8C01LCBMG/deployment-archive/appspec.yml

但是,如果我直接通过code deploy触发部署到同一个部署组,并且在S3中指定相同的zip(通过Jenkins trigger获取),这一步就通过了.

However, if I trigger deployment into the same deployment group via code deploy directly, and specify the same zip in S3 (obtained via Jenkins trigger), this step passes.

这是什么意思,我如何找到解决方法?我目前正在整合一些东西,因此需要同时通过代码部署和 Jenkins 进行部署.当我需要确保较小的单元运行良好时,我将运行代码部署触发的部署.

What does this mean, and how do I find a workaround to this? I am currently working on integrating a few things and so, will need to deploy via code deploy and via Jenkins simultaneously. I will run the code deploy triggered deployment when I will need to ensure that the smaller unit is functioning well.

更新

再提一点,以防万一.我以前在同一个 ec2 实例上使用不同的 codedeploy应用程序"和部署组",并直接使用 jenkins 和代码部署进行部署.为了解决一些问题(据称,由于部署失败而不允许覆盖现有文件),我删除了 /opt/codedeploy-agent/deployment-root/<包含部署的目录> 目录,尝试遵循 这个答案 中提到的内容.但是,请注意,我只删除了该目录中的项目.此后,我开始收到此错误 appspec.yml not found in deployment archive.所以,然后我创建了一个新的应用程序和部署组,从那时起,我就致力于它.

Just mentioning another point, in case it applies. I was previously using a different codedeploy "application" and "deployment group" on the same ec2 instances, and deplying using jenkins and code deploy directly as well. In order to fix some issue (not allowing to overwrite existing files due to failed deployments, allegedly), I had deleted everything inside the /opt/codedeploy-agent/deployment-root/<directory containing deployments> directory, trying to follow what was mentioned in this answer. However, note that I deleted only items inside that directory. Thereafter, I started getting this error appspec.yml not found in deployment archive. So, then I created a new application and deployment group and since then, I am working on it.

因此,另一点要考虑的是,如果 jenkins 触发的部署仍然受到这些删除的影响(即使它指的是新的应用程序和部署组),我是否应该做一些进一步的清理.

So, another point to consider is whether I should do some further cleanup, if the jenkins triggered deployment is somehow still affected by those deletions (even though it is referring to the new application and deployment group).

推荐答案

作为其流程的一部分,CodeDeploy 需要为 重新部署和部署回滚 操作.这些引用在部署存档文件夹之外维护.如果您按照指示手动删除这些存档,则 CodeDeploy 安装可能会遭到严重破坏:留下的对先前部署的引用不再正确或一致,部署将失败.

As part of its process, CodeDeploy needs to reference previous deployments for Redeployments and Deployment Rollbacks operations. These references are maintained outside of the deployment archive folders. If you delete these archives manually as you indicate, then a CodeDeploy install can get fatally corrupted: the references left to previous deployments are no longer correct or consistent, and deploys will fail.

此时最好的办法是完全删除旧安装,然后重新安装.这将允许代码部署代理再次正常工作.

The best thing at this point is to remove the old installation completely, and re-install. This will allow the code deploy agent to work correctly again.

我已经学会了不手动删除/修改任何 CodeDeploy 安装文件夹或文件的艰难方法.即使您更改应用程序或部署组,CodeDeploy 也会自行解决,无需任何手动清理.

I have learned the hard way not to remove/modify any of the CodeDeploy install folders or files manually. Even if you change apps or deployment groups, CodeDeploy will figure it out itself, without the need for any manual cleanup.

这篇关于Jenkins 触发的代码部署在 ApplicationStop 步骤失败,即使通过直接代码部署的同一部署组运行成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆