Skip to content

Commit

Permalink
Change default shell options for snapcraft publish
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ianconsolata committed Aug 4, 2022
1 parent 2498d58 commit 5a8bc20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 >>
Expand Down
2 changes: 2 additions & 0 deletions .circleci/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 >>
Expand Down

0 comments on commit 5a8bc20

Please sign in to comment.