For example, I want to store some results from API call:
variables:
DYNAMIC_VAR: $(curl http://ifconfig.me)
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
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.