KD17
KD17

Reputation: 55

How to set gitlab CI job to true?

I would like to set a job - even when it fails! - to TRUE (job succeeded). When using the following line:

script:
    - sleep 200
    - true && false

I get the following output from the CI:

true : The term 'true' 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.
At C:\WINDOWS\TEMP\build_script360729423\script.ps1:231 char:1
+ true
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (true:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Question: How can I set my job to always TRUE with my script above?

Upvotes: 0

Views: 163

Answers (1)

danielnelz
danielnelz

Reputation: 5136

The Gitlab Shell executor is working with numerical returns to determine if a job failed or succeeded.

So to succeed a job to must manually exit with 0.

script:
    - sleep 200
    - exit 0

Upvotes: 1

Related Questions