Today I came across fantastic idea that was implemented as Proof of Concept in Gitlab some time ago: CI Workflows! I’m pretty excited about it and really hope it will be shipped soon 😁
The concept
Currently, CI jobs can be included in the pipelines, while rules can be applied to define when to do it (e.g. only if certain files were modified). Pipeline can be triggered by several events: commit push, merge request creation, through API or manually using user interface. It is already flexible and awesome, but in terms of automating tasks based on projects’ content (build, test, release, deploy), not necessarily automation in general.
Gitlab CI Workflows’ idea is pretty simple, yet brilliant - let CI jobs to be triggered by system’s events. This way possibilities become almost endless, limited only by supported events and people’s imagination 😉. For example: you want to triage new issues? Run workflow on issue’s creation event. Want to run pipeline in the merge request when it’s marked as ready (Draft flag removed)? No problem, just hook into event and call the API.
Possible usage
Proposed syntax is based on new on
option, at this point it’s not clear if it can be single event or collection of events. Anyway, it could look like:
image: alpine
stages:
- triage
- verify
reviewer_roulette:
stage: triage
# New option introduced, defines which event we want subscribe
on: my-workflow-1/webhooks/issues/created
script:
- echo "Draw and assign reviewers..."
- ...
verify_standards:
stage: verify
needs:
- reviewer_roulette
script:
- echo "Check title, description etc."
- echo "Check if reproducer repository link is provided"
- ...
These 2 jobs are not regular jobs included in pipelines. reviewer_roulette
uses mentioned on
option, so it’s triggered when issue is created, while verify_standards
depends on it through needs
. Both will be included in the workflow’s pipeline, but won’t be included in regular pipelines based on branches, merge requests etc.
PoC DEMO
Video with demo of this Proof of Concept was shared here, initially as private but after my question it was made public 🎉 Asking costs nothing 😉
Summary
I can’t wait for it! Of course, there are many questions and doubts, but these will be addressed in the epic. We, as Gitlab users, also can be part of this - collectively this feature can be engineered even better! So don’t hesitate and provide feedback if you have ideas about CI workflows 🙂