Variable manipulation at top level

envars

#1

(Crappy title, but not sure how best to describe this)

I have the following job definition:

jobs:
  test:
    docker:
      - image: myhub/myrepo:${CIRCLE_BRANCH}

It works fine mostly, but falls over when CIRCLE_BRANCH contains a forward-slash. Docker tags can’t have forward-slashes.

Is there a way I can take CIRCLE_BRANCH and perform substitution on it and have the result available to use in the snippet above?

It’s easy at a shell but I can’t get to the result at job-level:

$  CIRCLECI_BRANCH="my/test"
$  MY_BRANCH=${CIRCLECI_BRANCH/\//-} ; echo $MY_BRANCH
my-test

#2

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.