Dynamic Variables

14 views
Skip to first unread message

Alex Sanford

unread,
Dec 12, 2016, 2:44:00 PM12/12/16
to GitLab
Hey all,

I'm trying out Review Apps and I'm having a problem. I'm trying to spin up a new Heroku app for each Review App, but the problem is that my branch name in $CI_BUILD_REF_NAME contains characters that Heroku doesn't support.

I can create the Heroku app just fine by running the name through a regex and stripping out the invalid characters. But I can't seem to figure out how to create the environment URL properly. Is there a way to create dynamic variables in the YAML file, so I can create a variable, say "APP_NAME", and set it to a dynamic value, possibly piping stuff through shell commands?

I can do something like this:

environment:
 url
:  https://$CI_BUILD_REF_NAME.herokuapp.com

But I need something more like this:

environment:
 url
:  https://$(echo $CI_BUILD_REF_NAME | sed 's/_/-').herokuapp.com

But that ^ doesn't seem to work...

Thanks
Alex

Michael Cox

unread,
Dec 26, 2016, 2:30:21 PM12/26/16
to GitLab
environment:
url: https://$(echo $CI_BUILD_REF_NAME | sed 's/_/-').herokuapp.com

Typo? The sed regex should be
's/_/-/g'

Alex Sanford

unread,
Dec 29, 2016, 9:08:22 AM12/29/16
to GitLab
Yes there is a typo. My bad! But that isn't the problem. Even with the correct sed syntax, the command isn't being run 😔
--
You received this message because you are subscribed to the Google Groups "GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gitlabhq+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gitlabhq/421626a6-758b-4435-9bc9-9b3fc6a4f1f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages