is there a way to know pants commands failed in a ...
# general
q
is there a way to know pants commands failed in a docker container running on CI/CD? I am running pants on a docker container in a jenkins pipeline and if some command fails such as
pants test
then the
docker logs
show it fails but the pipeline stage still passes since there was no issue in running the container. What have other people done to solve this issue?
b
I think this probably won’t be a pants specific issue: on failure, pants follows the shell convention and sets exit code != 0. If your CI config isn’t propagating this, you’ll need to fix that. You can eliminate the pants distraction by using
false
instead of
pants test ::
for iterating.
c
The step that runs pants could leave marker files in the container, that you check at the end, is one idea. OR, have any failing command in the container fail the docker run, rather than continuing. As Huon said, this isn't pants specific, as pants exits with a non-zero code on errors, and that is how you know it failed.
q
Thank you! the exit code method worked.
👍 1