Reputation: 2027
I want to run a single stage in gitlab from a yml file that contains a lot of stages. I don't want to have to add this to every single stage to avoid running all the stages.
except:
refs:
- schedules
Upvotes: 5
Views: 4602
Reputation: 605
You can use the following to run the stage only on a scheduled job
build-app:
stage: build-app
only:
- schedules
Upvotes: 1
Reputation: 1435
If you don't want to add except
in each job, use only
instead of except
https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-advanced
below there is an example with variables
only_with_variable:
script: ls -la
only:
variables:
- $VAR == "1234"
after that if you schedule a pipeline, you have the option to add variables to them.
in the example, you just need to add the VAR variable with value = 1234
Upvotes: 1