post image :date_long | 1 min Read

How to transfer gitlab calculated variable into trigger section

One has to used artifacts section combined with reports child keyword and save a variable with its value to build.env file. https://techhelpnotes.com/gitlab-ci-pass-variable-to-a-trigger-stage/

create_profile:
  stage: build
  script:
  # calculate APPLICATION_VERSION
    - echo APPLICATION_VERSION=0.1.0 >> build.env
    - echo Create profile ${APPLICATION_NAME} with version ${APPLICATION_VERSION}
  artifacts:
    paths:
      - profile
    reports:
      dotenv: build.env

trigger_upload:
  stage: release
  variables:
    PROFILE_NAME: ${APPLICATION_NAME}
    PROFILE_VERSION: ${APPLICATION_VERSION}
  trigger:
    project: git-project/profile-uploader
    strategy: depend
  needs:
    - job: create_profile
      artifacts: true
author image

Jan Toth

I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …

comments powered by Disqus