Skip to content

Incorrect documentation about passing artifacts to next stages

It looks like our documentation says that this is valid:

build:osx:
  stage: build
  script: make build:osx
  artifacts:
    paths:
    - binaries/

build:linux:
  stage: build
  script: make build:linux
  artifacts:
    paths:
    - binaries/

test:osx:
  stage: test
  script: make test:osx
  dependencies:
  - build:osx

test:linux:
  stage: test
  script: make test:linux
  dependencies:
  - build:linux

deploy:
  stage: deploy
  script: make deploy

But this is not valid, since this does not pass validation:

Status: syntax is incorrect
Error: test:osx job: undefined dependency: build:osx 

CI YAML validator is looking for symbol:

raise ValidationError, "#{name} job: undefined dependency: #{dependency}" unless @jobs[dependency]

So we need to use symbols as a dependency argument:

build:osx:
  stage: build
  script: make build:osx
  artifacts:
    paths:
    - binaries/

build:linux:
  stage: build
  script: make build:linux
  artifacts:
    paths:
    - binaries/

test:osx:
  stage: test
  script: make test:osx
  dependencies:
  - :build:osx

test:linux:
  stage: test
  script: make test:linux
  dependencies:
  - :build:linux

deploy:
  stage: deploy
  script: make deploy

We probably should look for a strings instead of symbols here, so this is more a CI error than documentation error probably.

/cc @axil @ayufan @JobV

Thanks @tmaczukin for finding why my test .gitlab-ci.yml didn't work.