PHA
PHA

Reputation: 1668

gitlabci: add a job id on artifacts files

I'd like to add a build signature by the end of a file name in artifacts. I could be job id or a combination of job id and commit reference. At the moment I get image.slp but I prefer to get something like image.1.slp or image.1.e8f8c4ed.slp . Here is my gitlab-ci.yml:

build-runner:
  stage: build
  script:
    - ./build.sh
    - cp ../output/image.slp .
  artifacts:
    paths:
       - image.slp

Upvotes: 0

Views: 529

Answers (1)

Carlo Bellettini
Carlo Bellettini

Reputation: 1180

You should be be able to accomplish that by means of CI_JOB_ID Environment variable.

Refer to docs for a comprehensive list of available variables that you can use.

Probably something like this could solve your problem:

build-runner:
  stage: build
  script:
    - ./build.sh
    - cp ../output/image.slp image.$CI_JOB_ID.slp
  artifacts:
    paths:
       - image.$CI_JOB_ID.slp

Upvotes: 1

Related Questions