Hi
Is it possible to declare custom when properties (or generating custom events? )
Let’s say I want to execute build step if commit message contains “BUILD_ME”.
I see possible solutions as:
-
pipeline: build: image: plugins/docker:latest when: script: check_if_contains_word.sh #note this line
2.
pipeline: build: image: plugins/docker:latest when: event: custom_build_me # note this line
Being able to use such constraints will increase flexibility of pipelines ( like trigger build if only target directory content changed);
Probably it is possible via custom plugin, is it?
P.S. Sorry for formating, not sure how do I add spaces to yml files without cut
this is not possible, but if you want to manually trigger builds you can use drone deploy. You pick and existing build number, and you promote it. Example command signature:
drone deploy <repo> <build number> <environment>
Example command with dummy data
drone deploy octocat/hello-world 22 prod
Then in your yaml you can specify that certain steps should only execute for deployment events and for certain environments. For example:
pipeline:
...
docker_stage:
image: plugins/docker
when:
event: deployment
environment: staging
docker_prod:
image: plugins/docker
when:
event: deployment
environment: production
Note that you will need to enable deployment events for your repository for this to work. You can enable deployment events by going to your repository settings in Drone.
2 Likes