Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting :max-revisions to 0 prevents new deployments #57

Closed
dskrvk opened this issue Mar 29, 2016 · 9 comments
Closed

Setting :max-revisions to 0 prevents new deployments #57

dskrvk opened this issue Mar 29, 2016 · 9 comments

Comments

@dskrvk
Copy link

dskrvk commented Mar 29, 2016

Please refer to this post for the issue description: https://forums.aws.amazon.com/thread.jspa?messageID=711273

Based on my reading of the code, this is what happens:

  1. During a deployment, command_executor#execute_command is called with command = DownloadBundle.
  2. It creates a new deployment directory: https://github.com/aws/aws-codedeploy-agent/blob/master/lib/instance_agent/plugins/codedeploy/command_executor.rb#L59
  3. It invokes method download_bundle which performs a cleanup: https://github.com/aws/aws-codedeploy-agent/blob/master/lib/instance_agent/plugins/codedeploy/command_executor.rb#L71.
  4. With :max-revisions = 0, cleanup_old_archives removes all the deployment directories except for the last successful one, including the newly-created one.
  5. This causes the new file creation to fail in download_from_s3: https://github.com/aws/aws-codedeploy-agent/blob/master/lib/instance_agent/plugins/codedeploy/command_executor.rb#L207.

You either need to keep track of and exclude the newly-created directory from the cleanup, or perform the cleanup before creating new directories.

After I set :max-revisions to 2, the deployments were able to proceed.

@dskrvk
Copy link
Author

dskrvk commented Mar 29, 2016

An excerpt from the log with debug level enabled (for some reason every line in my log is doubled, but I removed the duplicates here):

2016-03-28 22:52:48 DEBUG [codedeploy-agent(22961)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandExecutor: Successfully parsed the deployment spec
2016-03-28 22:52:48 DEBUG [codedeploy-agent(22961)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandExecutor: Creating deployment root directory /opt/codedeploy-agent/deployment-root/e445d2a1-8733-4850-aab0-1ac6d1f587c7/d-ZN9F64XVE
2016-03-28 22:52:48 DEBUG [codedeploy-agent(22961)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandExecutor: Executing DownloadBundle command for execution CodeDeploy/us-east-1/Prod/arn:aws:sds:us-east-1:663148821630:deployment/d-ZN9F64XVE
2016-03-28 22:52:48 DEBUG [codedeploy-agent(22961)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandExecutor: Downloading artifact bundle from bucket 'codepipeline-us-east-1-423929197064' and key '[redacted]/AAdCJYb.zip', version '', etag '7cb7551a4003c7b9234c386e79ab0848'
2016-03-28 22:52:48 DEBUG [codedeploy-agent(22961)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Calling PutHostCommandComplete: "Code Error"
...
2016-03-28 22:52:48 ERROR [codedeploy-agent(22961)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Error during perform: Errno::ENOENT - No such file or directory - /opt/codedeploy-agent/deployment-root/e445d2a1-8733-4850-aab0-1ac6d1f587c7/d-ZN9F64XVE/bundle.tar - /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:208:in initialize' /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:208:inopen'
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:208:in `download_from_s3'

@gaohan137
Copy link
Contributor

You are correct. We have created task to fix this issue and roll out updated version soon. Thanks for letting us know!

@gaohan137
Copy link
Contributor

This fix is written up and will be released in next release of host agent.

@mxro
Copy link

mxro commented Apr 9, 2017

So, has this been released yet?

Btw, if changing this value to 1 or 0 will superfluous copies be automatically deleted?

@vvavepacket
Copy link

was this released?

@annamataws annamataws added the bug label May 14, 2018
@Constantin07
Copy link

any updates ?

@annamataws
Copy link

annamataws commented Aug 14, 2018

Hi,

We are currently working on the fix. The deployments will fail because the agent will not start with the max_revisions set to 0. Right now only integers 1 or greater work.

Thank you

@annamataws
Copy link

@mxro Superfluous copies will not be automatically deleted immediately. They will be deleted at the beginning of the next deployment.

@annamataws
Copy link

Hi,

Through many talks with managers, we have concluded we do not plan on supporting setting max_revision to 0 because of rollbacks and other functionality that relies on this. There are ways to work around this if you'd like. you can turn on the setting to ignore ApplicationStop failures and use a script to remove all old deployments.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants