1
votes

I've been running deployments through CodeDeploy for a while, but a couple weeks ago, CodeDeploy started failing every deploy (all of which previously worked without issue) to one of my on-premise instances with the following error at BeforeInstall:

No such file or directory - C:\ProgramData/Amazon/CodeDeploy/02b29d0e-63b6-46b4-a7e4-ff7388bd510a/d-AJW81DA4U/deployment-archive/appspec.yml

If I check that directory afterwards, the file is clearly there and accessible. I have tried running the CodeDeploy Agent service both as an administrator account (which does have access to that file) and Local System (which, to my understanding, should have access to everything anyways).

The last mention of that deployment in CodeDeploy's log file (which includes debug-level logs) is the agent reporting the success of the DownloadBundle step.

I'm using Atlassian's Bamboo to call CodeDeploy and the same deployment succeeds to another on-premise instance (also a Windows machine), with identical configuration in Bamboo except for the deployment group.

Some of the time, instead of getting the above error CodeDeploy gives this error (also at BeforeInstall) and the deployment directory is empty (it doesn't even contain the downloaded bundle):

The CodeDeploy agent did not find an AppSpec file within the unpacked revision directory at revision-relative path "appspec.yml". The revision was unpacked to directory "C:\ProgramData/Amazon/CodeDeploy/02b29d0e-63b6-46b4-a7e4-ff7388bd510a/d-VEP5Z464U/deployment-archive", and the AppSpec file was expected but not found at path "C:\ProgramData/Amazon/CodeDeploy/02b29d0e-63b6-46b4-a7e4-ff7388bd510a/d-VEP5Z464U/deployment-archive/appspec.yml". Consult the AWS CodeDeploy Appspec documentation for more information at http://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file.html

In this case the log file shows the following error:

2018-07-06T10:13:37 ERROR [codedeploy-agent(8156)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Error during perform: RuntimeError - The CodeDeploy agent did not find an AppSpec file within the unpacked revision directory at revision-relative path "appspec.yml". The revision was unpacked to directory "C:\ProgramData/Amazon/CodeDeploy/02b29d0e-63b6-46b4-a7e4-ff7388bd510a/d-VEP5Z464U/deployment-archive", and the AppSpec file was expected but not found at path "C:\ProgramData/Amazon/CodeDeploy/02b29d0e-63b6-46b4-a7e4-ff7388bd510a/d-VEP5Z464U/deployment-archive/appspec.yml". Consult the AWS CodeDeploy Appspec documentation for more information at http://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file.html - C:/Windows/TEMP/ocr5F30.tmp/src/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/hook_executor.rb:213:in parse_app_spec' C:/Windows/TEMP/ocr5F30.tmp/src/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/hook_executor.rb:100:ininitialize' C:/Windows/TEMP/ocr5F30.tmp/src/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:147:in new' C:/Windows/TEMP/ocr5F30.tmp/src/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:147:inblock (3 levels) in map' C:/Windows/TEMP/ocr5F30.tmp/src/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:146:in each' C:/Windows/TEMP/ocr5F30.tmp/src/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:146:inblock (2 levels) in map' C:/Windows/TEMP/ocr5F30.tmp/src/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:68:in execute_command' C:/Windows/TEMP/ocr5F30.tmp/src/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:114:inprocess_command' C:/Windows/TEMP/ocr5F30.tmp/src/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:96:in acknowledge_and_process_command' C:/Windows/TEMP/ocr5F30.tmp/src/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:75:inblock in perform' C:/Windows/Temp/ocr5F30.tmp/gemhome/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:348:in run_task' C:/Windows/Temp/ocr5F30.tmp/gemhome/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:337:inblock (3 levels) in create_worker' C:/Windows/Temp/ocr5F30.tmp/gemhome/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in loop' C:/Windows/Temp/ocr5F30.tmp/gemhome/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:inblock (2 levels) in create_worker' C:/Windows/Temp/ocr5F30.tmp/gemhome/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in catch' C:/Windows/Temp/ocr5F30.tmp/gemhome/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:inblock in create_worker' C:/Windows/Temp/ocr5F30.tmp/lib/ruby/gems/2.3.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'

I am running the latest version of CodeDeploy at the time of writing (1.0.1.1518) and I've tried restarting the agent, restarting the box, and reinstalling the agent service. None of that made any difference.

1
I don't see why it would make any difference, but are you running a different OS version among the different instances?EmptyArsenal

1 Answers

0
votes

I just ran into this same exact thing myself and it turned out to be my the way my files were getting zipped/archived before I uploaded them to s3 to have them get used by code deploy. In my case, it turns out there was an extra directory in my folder path.

If you have a previous deployment that worked, try to deploy that. If it works then compare the directory structure of that to a deployment that doesn't work.