2

For example, I want to store some results from API call:

variables:
  DYNAMIC_VAR: $(curl http://ifconfig.me)

2 Answers 2

4

Unfortunately no, you cannot do this.

If you only need to use this var in a single job, then it's simple:

job:
  script:
    - DYNAMIC_VAR=$(curl http://ifconfig.me)
    - echo "Using $DYNAMIC_VAR here ..."

However if you need to pass this var between jobs, at the moment it's not directly possible, but you can do it via artifacts.
See example here: https://stackoverflow.com/a/56818718/902415

0

You will have to use Artifact or Cache if you have to use this information in other jobs otherwise above answer is the perfect solution.

Not the answer you're looking for? Browse other questions tagged or ask your own question.