0

Is there any way to use an export variable, defined in the generic before_script:

before_script:
- export UPPERHASH=$(echo $CI_COMMIT_REF_SLUG | md5sum | tr [a-z] [A-Z])

into another job as a variable, because I am gonna use trigger but trigger does not allow to have any script, ex:

test variables:
  stage: test-variables
  variables:
    UPPERHASH_TEST1: $UPPERHASH
  trigger:
    project: "...\..."

I have tried multiple options but none of them is working.

1 Answer 1

1

It will not work this way because "test variables".variables is processed before before_script

You only can refer to this variable in a script:

test variables:
  stage: test-variables
  script:
    UPPERHASH_TEST1=$UPPERHASH
    ... trigger other project from command line ...

Read here on how to trigger other project from command line

https://docs.gitlab.com/ee/ci/triggers/README.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.