38

I have a gitlab CI build process with 4 steps, in which artifacts produced in first step are packaged into docker image in 2nd step, then the output image is given as the artifact to 3rd step, and there is a 4th step afterwards, that notifies external service.

The 2nd step needs artifacts from step 1, the 3rd step need artifacts from step 2. This is done with 'dependencies'parameter and it works fine.

What is not working is the step 4, that need no artifacts. I've skipped the 'dependencies' block, then I've declared dependencies: [], but in both cases the both artifacts are downloaded!

How do I correct inform gitlab CI that the step has no dependencies? Or is it some bug in Gitlab CI?

9ilsdx 9rvj 0lo
  • 7,955
  • 10
  • 38
  • 77

2 Answers2

48

As per the gitlab-ci documentation:

To disable artifact passing, define the job with empty dependencies:

job:
  stage: build
  script: make build
  dependencies: []

I've found the same issue here: https://gitlab.com/gitlab-org/gitlab-runner/issues/228

This seems to be fixed in: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10359

Please update your CI Runner to a newer version as that should fix it.

dbrekelmans
  • 951
  • 8
  • 11
2

In relation to this comment from Ankur Bhatia about how to only download selected artifacts in a particular job, you can do so by specifying a previously run Job name in the dependencies array like so:

Build Assets:
  stage: Build
  script: make build
  artifacts:
    paths:
      - deployment-assets/


...Other jobs that may have run in the Build stage OR other stages BEFORE the Deploy stage...


Deploy:
  stage: Deploy
  script: make deploy
  dependencies:
    - Build Assets

In the above, the Deploy job will ONLY download artifacts from the Build Assets job.

For more information on how to use the dependencies Job keyword, see the official GitLab documentation.

Mr-DC
  • 799
  • 5
  • 14
  • 25