Change default shell options for snapcraft publish

The builds were erroring only in CircleCI, when run manually the same
command worked fine. I reached out to CircleCI support, and got the
following message:

>>>
The reason you are seeing this error when running in CircleCI and not while debugging with SSH is due to the -e set in #!/bin/bash -eo pipefail at the beginning of the shell while the debugging shell would just be #!/bin/bash. The -e sets to exit to the shell when any non zero [0] exit code status.

Since you say the command works when debugging with SSH you can set the shell to use /bin/bash -o pipefail using a default shell options. Here is an example:

      - run:
          name: <<command name>>
          shell: /bin/bash -o pipefail
          command: |
            << some commands>>

Notice that I still added -o pipefail as that prevents errors in a pipeline from being masked.
This commit is contained in:
Ian Davis 2022-08-03 21:29:35 -07:00
parent 2498d58ba1
commit 5a8bc204b7
2 changed files with 4 additions and 0 deletions

View File

@ -591,6 +591,7 @@ jobs:
command: snapcraft --use-lxd --debug
- run:
name: publish `lotus-filecoin` snap
shell: /bin/bash -o pipefail
command: |
snapcraft upload lotus-filecoin_latest_amd64.snap --release << parameters.channel >>
- run:
@ -603,6 +604,7 @@ jobs:
command: snapcraft --use-lxd --debug
- run:
name: publish `lotus` snap
shell: /bin/bash -o pipefail
command: |
snapcraft upload lotus_latest_amd64.snap --release << parameters.channel >>

View File

@ -591,6 +591,7 @@ jobs:
command: snapcraft --use-lxd --debug
- run:
name: publish `lotus-filecoin` snap
shell: /bin/bash -o pipefail
command: |
snapcraft upload lotus-filecoin_latest_amd64.snap --release << parameters.channel >>
- run:
@ -603,6 +604,7 @@ jobs:
command: snapcraft --use-lxd --debug
- run:
name: publish `lotus` snap
shell: /bin/bash -o pipefail
command: |
snapcraft upload lotus_latest_amd64.snap --release << parameters.channel >>