Set dynamically registered env var for CI/CD jobs
Problem to solve
The ability to pass variables that are set with another command is not specified in the docs of https://docs.gitlab.com/ce/ci/variables/
Further details
I can't figure out how to set a variable to be used by creating it dynamically, so I went to the docs. They don't have anything about setting a variable by executing a command. I tried:
- MANAGER_SERVER_VERSION=$(wget -O - https://www.manager.io/releases/ 2>/dev/null | head -n 1 | sed -e 's/^.*<table//g;s/\/table>.*$//g' | grep -Eo '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}' | head -n 1)
and
MANAGER_SERVER_VERSION: $(wget -O - https://www.manager.io/releases/ 2>/dev/null | head -n 1 | sed -e 's/^.*<table//g;s/\/table>.*$//g' | grep -Eo '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}' | head -n 1)
[...]
- echo $(${MANAGER_SERVER_VERSION})
Proposal
There should be a documented way to set a variable to be used later in the build in the build itself. Otherwise, it's kinda hacky.
Who can address the issue
This has to deal with Gitlab-Runner docs.