Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-57505

Cannot quote $ (dolar sign) in yaml

XMLWordPrintable

      I need to put contect like (exactly): "${MY_TEXT}/foo" into a field in YAML file. Unfortunately, this construct is replaced by the output "/foo" because ${MY_TEXT} is tried to be resolved from environment - usually it is empty.

      I can't find a way, how to quote '$', tried many different ways, including:
      "${MY_TEXT}/foo" -> "/foo"
      "$${MY_TEXT}/foo" -> "$/foo"
      "\${MY_TEXT}/foo" -> unknown escape character error ($)
      "${MY_TEXT}/foo" -> unknown escape character error ({)

      Curiously, export uses the same "${MY_TEXT}/foo" construct which doesn't work obviously.

      For this case I've found two work-arounds:

      • define MY_TEST env variable with the content "${MY_TEST}" - this is needed for all such definitions...
      • define dolar sign as an env. variable e.g. DOLAR="$" and use construct like "${DOLAR} {MY_TEXT}

        /foo"

      There are many cases when we need to take the environment variable content into YAML, but there should be a way how to don't do that if we need it too.

            ewel Ewelina Wilkosz
            pajasoft Pavel JanouĊĦek
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: