I want to evaluate in my gitlab_ci
pipeline if the current java
project is to build with a SNAPSHOT
dependency inside the maven
pom.xml
:
Like so: grep -q "SNAPSHOt" pom.xml && echo 1
Question: how could I integrate this into a ci pipeline so that the pipeline does not even execute if this condition is true?
gitlab_ci.yml
:
image: docker:20
build:
stage: build
script:
- mvn package...
Where would I add that sort of condition check, and how could I then let the full job fail?
CodePudding user response:
If you want the pipeline to run only based on some condition you can use rules or if you want the pipeline to run and then fail when some condition is not satisfied. You can just check the condition and then use exit some_non_zero number
.
CodePudding user response:
before_script:
- grep -q "SNAPSHOT" pom.xml && exit 1