I want to be able to set dynamic environment url in gitlab yml.
...
environment:
url: $ENVIRONMENT_URL/?env=${echo $CI_COMMIT_TAG | grep -o '[^@]*$'}
...
I know that I can't use bash command in url, it should be string or variable. Is there a way to somehow set echo $CI_COMMIT_TAG | grep -o '[^@]*$'
as variable, ie in script and use it here? Variables declared in script are local but maybe there is a way to export it to outer scope and use it in environment.url.
I've tried
script:
- VERSION_SHORT=`echo $CI_COMMIT_TAG | grep -o '[^@]*$'`
environment:
url: $ENVIRONMENT_URL/?env=${echo $CI_COMMIT_TAG | grep -o '[^@]*$'}
variables:
VERSION_SHORT: $VERSION_SHORT