[Feature Request] Extend "only" to evaluate variables
In our project YAML file we have multiple build/deploy stages that need to be run based on some external factors - for example Developer testing of the DB has completed, now build the integration tests and deploy to the SYS environment.
I thought of using "triggers" to do this but as far as I can tell it is not possible to run a stage based on a specific trigger token or variable.
Would it be possible to extend only to allow for variavle checking as well?
deploy:integration:test:
only:
- triggers
- %SOME_VARIABLE% == true
stage: deploy
script:
- call some_script.bat
dependencies:
- build:all:package
allow_failure: false
tags:
- windows
I can work around this by passing a couple variables with the trigger and then building the logic into a script but I think it would be better to build this into the .yml file so we can clearly show the separate jobs.
If only is not the right place then maybe we could add it to the when construct?
deploy:integration:test:
only:
- triggers
when: %SOME_VARIABLE% == true
stage: deploy
There is a similar comment on issue #12956 (closed)
@chrgod said "I think it would be great if only / except could be extended to evaluate variables. Then you could run a build only if a variable has a certain value, which would allow a fine grained control on which jobs are run when a build is triggered by API."