1
votes

I have integrated CodeDeploy with one of my projects on GitHub for automatic deployment. Until recently, it has been working, but is now failing at the DownloadBundle stage with the following error: "Error extracting tar archive: 2"

The repository is quite large (~8.3GB) and was wondering if anyone knew if there was an upper limit on the size the tarball which the CodeDeploy-agent fetches.

Everything has been updated (including the CodeDeploy-agent) on my EC2 instance.

The relevant parts of the aws_log_wire appear below in the event this is helpful:

2016-03-23 03:18:10 INFO [codedeploy-agent(23967)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandExecutor: Requesting URL: 'https://[MY_PROJECT]/tarball/[REMOVED_COMMIT_ID]' 2016-03-23 03:25:37 ERROR [codedeploy-agent(23967)]: InstanceAgent::LinuxUtil: Error extracting tar archive: 2 2016-03-23 03:25:37 INFO [codedeploy-agent(23967)]: Version file found in /opt/codedeploy-agent/.version. 2016-03-23 03:25:38 INFO [codedeploy-agent(23967)]: [Aws::CodeDeployCommand::Client 200 0.092371 0 retries] put_host_command_complete(command_status:"Failed",diagnostics:{format:"JSON",payload:"{\"error_code\":5,\"script_name\":\"\",\"$

2016-03-23 03:25:38 ERROR [codedeploy-agent(23967)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Error during perform: RuntimeError - Error extracting tar archive: 2 - /opt/codedeploy-agent/lib/instance_agent/platform/linux$ /opt/codedeploy-agent/lib/instance_agent/platform/linux_util.rb:30:in extract_tar' /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:292:inunpack_bundle' /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:99:in block in <class:CommandExecutor>' /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:63:inexecute_command' /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:132:in process_command' /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:65:inperform' /opt/codedeploy-agent/lib/instance_agent/agent/base.rb:28:in run' /opt/codedeploy-agent/lib/instance_agent/runner/child.rb:38:inblock in run' /opt/codedeploy-agent/lib/instance_agent/runner/child.rb:55:in with_error_handling' /opt/codedeploy-agent/lib/instance_agent/runner/child.rb:37:inrun' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:70:in block in run_with_error_handling' /opt/codedeploy-agent/lib/instance_agent/runner/child.rb:55:inwith_error_handling' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:69:in run_with_error_handling' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:33:inblock in start' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:22:in loop' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/child.rb:22:instart' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:202:in block in spawn_child' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:200:infork' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:200:in spawn_child' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:192:inblock in spawn_children' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:191:in times' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:191:inspawn_children' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:134:in start' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:37:inblock in start' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:36:in fork' /opt/codedeploy-agent/vendor/gems/process_manager-0.0.13/lib/process_manager/master.rb:36:instart' /opt/codedeploy-agent/bin/codedeploy-agent:37:in block (2 levels) in <main>' /opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/command_support.rb:130:incall' /opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/command_support.rb:130:in execute' /opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:262:inblock in call_command' /opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:275:in call' /opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:275:incall_command' /opt/codedeploy-agent/vendor/gems/gli-2.5.6/lib/gli/app_support.rb:69:in run' /opt/codedeploy-agent/bin/codedeploy-agent:84:in'

2

2 Answers

1
votes

I'm facing the same issue with a < 2 kB archive, so I don't think this is due to the size of the archive. After some research, I found out that for some reason, CodeDeploy downloads my .tar.gz bundle as bundle.tar and treats it as a ZIP file.

I'm not sure why (I'm specifying bundleType=tgz in my deployment script), but using bundleType=zip solves the problem.

0
votes

Just wanted to add to what @christophetd posted. We recently upgraded some of our hosts to the latest codedeployment-agent (1.0.1.934) and started receiving the same error (RuntimeError - Error extracting tar archive: 2). Our solution was to add bundleType=zip to our deploy script as well.

--github-location commitId=12367127689127893123789,repository=org/repo,bundleType=zip