In the below configuration, we simply test running “exit 0” under 2 shells. The default linux shell and one with the login option added “-l”.
version: 2.1
workflows:
test_exit:
jobs:
- test_non_login
- test_login
jobs:
test_non_login:
docker:
- image: cimg/base:2020.03
steps:
- run:
name: Test exiting in non login shell
shell: /bin/bash -eo pipefail
command: |
exit 0
test_login:
docker:
- image: cimg/base:2020.03
steps:
- run:
name: Test exiting in login shell
shell: /bin/bash -eo pipefail -l
command: |
exit 0
The non login shell job succeeds, as expected, whereas the login shell fails with this:
It seems like it’s related to the CircleCI container.
docker run --rm -it ubuntu:latest /bin/bash -elc "exit 0" #returns 0
docker run --rm -it cimg/base:2020.03 /bin/bash -elc "exit 0" #returns 1
The situation only happens when both login and errexit are used.
Thanks,
Phil