Limit CI duplication when doing a push and a tag
When a tag is pushed, GitLab should check the CI definitions and figure out if there are jobs with the following constraints:
Restricted to only: tags or
Making use of variables that indicate tag name (e.g.
If there are no such constrained jobs, there is no need to launch a new build for the pushed tag. Artifacts from the associated commit's build can be reused as is.
If there are constrained jobs, any prerequisite job that is not constrained directly or indirectly (i.e. through dependency) could be skipped; artifacts from the associated commit's job could be reused (provided its artifacts have not expired). All remaining jobs would be relaunched.
Of course, the CI might call a script that uses
CI_COMMIT_TAG, without GitLab knowing about it. Perhaps there should also be a way of manually indicating in .gitlab-ci.yml which jobs have an implicit dependency on the current tag name?