Thx Megan! I inadvertently had clear in there for no reason. To be frank, i donโt remember even putting it in there :), perhaps having too many terminal envs opened & mysteriously clear ended up in my Visual code session , my eyes were playing tricks on me. removed it and ran the pipeline & its good! ๐๐พ
On Wed, Apr 1, 2020 at 7:28 PM Megan Marsh <[email protected]> wrote: > Hi Dominic, > > This is because of your call to "clear". Clear requires information about > the terminal, which it isn't receiving. Just remove that call (It isn't > really doing anything useful in an automated build anyway), and you should > get unstuck. > > As a side note, you don't need to use the file provisioner to upload the > shell script; Packer takes care of that for you as part of the shell > provisioning. The "script" path provided is the path to the script on the > machine running Packer, not on the remote machine being provisioned. > > Hopefully this helps. Reach out if you have any more issues getting set > up, but this looks more like general scripting issues than a specific > Packer issue. > > > On Wed, Apr 1, 2020 at 1:11 PM Dominic James <[email protected]> > wrote: > >> Packer template BELOW >> >> { >> "variables": { >> "aws_access_key": "{{env `PACKER_VAR_DEV_AWS_ACCESS_KEY_ID`}}", >> "aws_secret_key": "{{env `PACKER_VAR_DEV_AWS_SECRET_ACCESS_KEY`}}" >> }, >> "builders": [{ >> "type": "amazon-ebs", >> "access_key": "{{user `aws_access_key`}}", >> "secret_key": "{{user `aws_secret_key`}}", >> "region": "us-east-1", >> "source_ami_filter": { >> "filters": { >> "virtualization-type": "hvm", >> "name": "Base-AMI-Ubuntu-*", >> "root-device-type": "ebs" >> }, >> "owners": [ >> "622297214873" >> ], >> "most_recent": true >> }, >> "instance_type": "t2.large", >> "ssh_username": "ubuntu", >> "ami_name": "redacted-{{timestamp}}", >> "vpc_id": "redacted", >> "associate_public_ip_address": "true", >> "subnet_id": "redacted" >> }], >> "provisioners": [{ >> "type": "file", >> "source": "/tmp/redacted.sh", >> "destination": "/tmp/redacted.sh" >> }, >> { >> "type": "shell", >> "execute_command": "echo 'packer' | sudo -E sh -c '{{ .Vars }} {{ .Path >> }}'", >> "script": "/tmp/redacted.sh" >> }] >> } >> >> *redacted.sh script below* >> #!/bin/bash -x >> >> ScriptPath="/tmp/" >> ScriptName="runComposer.sh" >> >> set -ex >> clear >> sudo git clone --depth=1 --no-tags https://github.com/XXXXXX.git /tmp >> >> sleep 15 >> sudo chmod a+x $ScriptName >> sleep 5 >> $ScriptPath/$ScriptName >> >> result=$? >> >> >> *ERROR BELOW from PACKER DEBUG OUTPUT LOGGING* >> >> 2020/04/01 15:51:27 packer-builder-amazon-ebs plugin: [DEBUG] starting >> remote command: echo 'packer' | sudo -E sh -c >> 'PACKER_BUILDER_TYPE='amazon-ebs' PACKER_BUILD_NAME='amazon-ebs' >> /tmp/script_883.sh' ==> amazon-ebs: + ScriptPath=/tmp/ ==> amazon-ebs: + >> ScriptName=runComposer.sh ==> amazon-ebs: + set -ex ==> amazon-ebs: + clear >> 2020/04/01 15:51:27 packer-builder-amazon-ebs plugin: [ERROR] Remote >> command exited with '1': echo 'packer' | sudo -E sh -c >> 'PACKER_BUILDER_TYPE='amazon-ebs' PACKER_BUILD_NAME='amazon-ebs' >> /tmp/script_883.sh' 2020/04/01 15:51:27 packer-builder-amazon-ebs plugin: >> [INFO] RPC endpoint: Communicator ended with: 1 2020/04/01 15:51:27 [INFO] >> 0 bytes written for 'stdout' 2020/04/01 15:51:27 [INFO] 108 bytes written >> for 'stderr' 2020/04/01 15:51:27 [INFO] RPC client: Communicator ended >> with: 1 2020/04/01 15:51:27 [INFO] RPC endpoint: Communicator ended with: 1 >> 2020/04/01 15:51:27 packer-provisioner-shell plugin: [INFO] 0 bytes written >> for 'stdout' 2020/04/01 15:51:27 packer-provisioner-shell plugin: [INFO] >> 108 bytes written for 'stderr' 2020/04/01 15:51:27 packer-provisioner-shell >> plugin: [INFO] RPC client: Communicator ended with: 1 ==> amazon-ebs: >> 'unknown': I need something more specific. >> >> -- >> This mailing list is governed under the HashiCorp Community Guidelines - >> https://www.hashicorp.com/community-guidelines.html. Behavior in >> violation of those guidelines may result in your removal from this mailing >> list. >> >> GitHub Issues: https://github.com/mitchellh/packer/issues >> IRC: #packer-tool on Freenode >> --- >> You received this message because you are subscribed to the Google Groups >> "Packer" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/packer-tool/251c6e60-4ba9-4674-bc87-94a39ae042e4%40googlegroups.com >> <https://groups.google.com/d/msgid/packer-tool/251c6e60-4ba9-4674-bc87-94a39ae042e4%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/packer/issues > IRC: #packer-tool on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Packer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/packer-tool/CAGPV1urpLKC5R_gxbkHvweonU8qZ2ZqFBSR31ekY3qB5LY6ViA%40mail.gmail.com > <https://groups.google.com/d/msgid/packer-tool/CAGPV1urpLKC5R_gxbkHvweonU8qZ2ZqFBSR31ekY3qB5LY6ViA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAEnfFWJ5oXi0i0Ojsmw1kusomZ-bOjuOUBO3jjJPbTFMhSWy0Q%40mail.gmail.com.
