Hello,
I have a CI/CD pipeline with a test
stage. The test
stage has two jobs. The first job runs fine while the second one is not working properly. The problematic job executes just parts of the script
commands. The last two Linux grep
commands are not executed, causing the pipeline to succeed although it must fail.
This happens on GitLab CE 12.9.4.
extract of the relevant parts of the simplified .gitlab-ci.yml
file:
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
stages:
- test
second_job:
stage: test
timeout: 10m
script:
- cURL request
- echo
- cURL request
- cURl request
- cURL request which saves the output to a .txt file
- (! grep '<some string>' result.txt)
- (! grep '<some string>' result.txt)
only:
- my_branch
The job does succeed although the both grep statements should find matching strings and thus return a negative exit code to let the pipeline fail. In the job log I can see that the both grep commands are not executed. The other script commands are executed and giving the expected results.
I did execute the pipeline manually (not triggering it by creating a merge request). What could be the issue here? This did work in the past but I’m not sure if I broke it without being aware or if a GitLab update did break it.
Thank you for your help!
Best Regards,