I want to fail a job in Gitlab Runner if a certain file exists. How can I do this? Thanks.
Asked
Active
Viewed 4,729 times
1 Answers
5
When a job’s exit code is different from zero, it fails.
So something like if [ -f "$FILE" ]; then exit 1; fi
in the job script:
section should work.

Christophe Muller
- 4,850
- 1
- 23
- 31
-
Thank you for helping. I modified your script to be: if ( -f "$FILE" ){exit 1}; Before that it was expecting statement block after if. Now the error is "The term '-f' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included , verify that the path is correct and try again" – vilppu Nov 25 '20 at 12:34