Skip to content

regex as artifact dependency in .gitlab-ci.yml

Description

Ability to use regex as dependency in .gitlab-ci.yml

Proposal

This YAML file shows a trivial usage of a regex depedency (last line).

stages:
- build
- release

build:linux:
  stage: build
  script: build.sh
  artifacts:
    paths:
    - bin/
    
build:windows:
  stage: build
  script: build.bat
  artifacts:
    paths:
    - bin/
    
release:
  stage: release
  script: release.sh
  dependencies:
    - /^build:.*$/

The above yaml was created to show the feature in a brief manner. With much larger job matrices that possibly also have multiple different release jobs this feature becomes very helpful. In my situation I have many test jobs that each generate a report. Those reports are all saved as artifacts and then the release job archives the binaries and reports to permanent storage. In my case the dependencies list is unwieldy and when people are creating new jobs it is difficult for them to remember to add them to the dependencies list. Regular expressions are already part of the .gitlab-ci.yml capabilities in the "only" and "except" fields.

Feature checklist

Make sure these are completed before closing the issue, with a link to the relevant commit.