awslabs / ami-builder-packer

An example of an AMI Builder using CI/CD with AWS CodePipeline, AWS CodeBuild, Hashicorp Packer and Ansible.
Apache License 2.0
461 stars 230 forks source link

Error uploading script: SCP failed to start. on the remote system and COMMAND_EXECUTION_ERROR Message: Error while executing command: test -s ami_id.txt || exit 1. #12

Closed pattem86 closed 5 years ago

pattem86 commented 5 years ago

[Container] 2019/02/07 12:54:18 Waiting for agent ping [Container] 2019/02/07 12:54:19 Waiting for DOWNLOAD_SOURCE [Container] 2019/02/07 12:54:19 Phase is DOWNLOAD_SOURCE [Container] 2019/02/07 12:54:19 CODEBUILD_SRC_DIR=/codebuild/output/src940025392/src [Container] 2019/02/07 12:54:19 YAML location is /codebuild/output/src940025392/src/buildspec.yml [Container] 2019/02/07 12:54:19 Processing environment variables [Container] 2019/02/07 12:54:19 Moving to directory /codebuild/output/src940025392/src [Container] 2019/02/07 12:54:19 Registering with agent [Container] 2019/02/07 12:54:19 Phases found in YAML: 3 [Container] 2019/02/07 12:54:19 POST_BUILD: 5 commands [Container] 2019/02/07 12:54:19 PRE_BUILD: 4 commands [Container] 2019/02/07 12:54:19 BUILD: 1 commands [Container] 2019/02/07 12:54:19 Phase complete: DOWNLOAD_SOURCE Success: true [Container] 2019/02/07 12:54:19 Phase context status code: Message: [Container] 2019/02/07 12:54:19 Entering phase INSTALL [Container] 2019/02/07 12:54:19 Phase complete: INSTALL Success: true [Container] 2019/02/07 12:54:19 Phase context status code: Message: [Container] 2019/02/07 12:54:19 Entering phase PRE_BUILD [Container] 2019/02/07 12:54:19 Running command echo "Installing Packer" Installing Packer [Container] 2019/02/07 12:54:19 Running command curl -o packer.zip https://releases.hashicorp.com/packer/1.3.4/packer_1.3.4_linux_amd64.zip && unzip packer.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 27.5M 100 27.5M 0 0 52.3M 0 --:--:-- --:--:-- --:--:-- 52.4M Archive: packer.zip inflating: packer [Container] 2019/02/07 12:54:21 Running command echo "Validating Packer template" Validating Packer template [Container] 2019/02/07 12:54:21 Running command ./packer validate packer_cis.json Template validated successfully. [Container] 2019/02/07 12:54:21 Phase complete: PRE_BUILD Success: true [Container] 2019/02/07 12:54:21 Phase context status code: Message: [Container] 2019/02/07 12:54:22 Entering phase BUILD [Container] 2019/02/07 12:54:22 Running command ./packer build -color=false packer_cis.json | tee build.log ==> AWS AMI Builder - CIS: Prevalidating AMI Name: Prod-CIS-Latest-AMZN-07-Feb-19 12_54_22 AWS AMI Builder - CIS: Found Image ID: ami-02313be5103969e57 ==> AWS AMI Builder - CIS: Creating temporary keypair: packer_5c5c2a7e-55fb-acd1-281f-c5d0af722f5d ==> AWS AMI Builder - CIS: Creating temporary security group for this instance: packer_5c5c2a80-c5fd-ba70-02ed-1ab70220c01e ==> AWS AMI Builder - CIS: Authorizing access to port 22 from 0.0.0.0/0 in the temporary security group... ==> AWS AMI Builder - CIS: Launching a source AWS instance... ==> AWS AMI Builder - CIS: Adding tags to source instance AWS AMI Builder - CIS: Adding tag: "Name": "Prod-CIS-Latest-AMZN-07-Feb-19 12_54_22" AWS AMI Builder - CIS: Adding tag: "Name": "Prod-CIS-Latest-AMZN-07-Feb-19 12_54_22" AWS AMI Builder - CIS: Instance ID: i-0a19eee643538534c ==> AWS AMI Builder - CIS: Waiting for instance (i-0a19eee643538534c) to become ready... ==> AWS AMI Builder - CIS: Using ssh communicator to connect: 63.32.169.211 ==> AWS AMI Builder - CIS: Waiting for SSH to become available... ==> AWS AMI Builder - CIS: Connected to SSH! ==> AWS AMI Builder - CIS: Provisioning with shell script: /tmp/packer-shell387961860 ==> AWS AMI Builder - CIS: Terminating the source AWS instance... ==> AWS AMI Builder - CIS: Cleaning up any extra volumes... ==> AWS AMI Builder - CIS: No volumes to clean up, skipping ==> AWS AMI Builder - CIS: Deleting temporary security group... ==> AWS AMI Builder - CIS: Deleting temporary keypair... Build 'AWS AMI Builder - CIS' errored: Retryable error: Error uploading script: SCP failed to start. This usually means that SCP is not properly installed on the remote system. ==> Some builds didn't complete successfully and had errors: --> AWS AMI Builder - CIS: Retryable error: Error uploading script: SCP failed to start. This usually means that SCP is not properly installed on the remote system. ==> Builds finished but no artifacts were created. [Container] 2019/02/07 13:00:54 Phase complete: BUILD Success: true [Container] 2019/02/07 13:00:54 Phase context status code: Message: [Container] 2019/02/07 13:00:54 Entering phase POST_BUILD [Container] 2019/02/07 13:00:54 Running command egrep "${AWS_REGION}\:\sami-" build.log | cut -d' ' -f2 > ami_id.txt [Container] 2019/02/07 13:00:54 Running command test -s ami_id.txt || exit 1 [Container] 2019/02/07 13:00:54 Command did not exit successfully test -s ami_id.txt || exit 1 exit status 1 [Container] 2019/02/07 13:00:54 Phase complete: POST_BUILD Success: false [Container] 2019/02/07 13:00:54 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: test -s ami_id.txt || exit 1. Reason: exit status 1 [Container] 2019/02/07 13:00:55 Expanding base directory path: . [Container] 2019/02/07 13:00:55 Assembling file list [Container] 2019/02/07 13:00:55 Expanding . [Container] 2019/02/07 13:00:55 Expanding artifact file paths for base directory . [Container] 2019/02/07 13:00:55 Assembling file list [Container] 2019/02/07 13:00:55 Expanding ami_builder_event.json [Container] 2019/02/07 13:00:55 Expanding build.log [Container] 2019/02/07 13:00:55 Found 2 file(s) [Container] 2019/02/07 13:00:55 Phase complete: UPLOAD_ARTIFACTS Success: true [Container] 2019/02/07 13:00:55 Phase context status code: Message:

pattem86 commented 5 years ago

I am getting below errors while running build:

CIS: Retryable error: Error uploading script: SCP failed to start. This usually means that SCP is not properly installed on the remote system.

[Container] 2019/02/07 13:00:54 Command did not exit successfully test -s ami_id.txt || exit 1 exit status 1 [Container] 2019/02/07 13:00:54 Phase complete: POST_BUILD Success: false [Container] 2019/02/07 13:00:54 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: test -s ami_id.txt || exit 1. Reason: exit status 1

pattem86 commented 5 years ago

Issue has been closed. This above issue is related AMI image specific for SCP feature.