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

Cannot quote $ (dolar sign) in yaml

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          Hide
          casz Joseph Petersen added a comment -

          You ought to read our readme on how to handle secrets: https://github.com/jenkinsci/configuration-as-code-plugin#handling-secrets

          You have to escape secrets with ^${MY_TEXT}

          Show
          casz Joseph Petersen added a comment - You ought to read our readme on how to handle secrets:  https://github.com/jenkinsci/configuration-as-code-plugin#handling-secrets You have to escape secrets with ^${MY_TEXT}
          Hide
          pajasoft Pavel Janoušek added a comment -

          That's exactly what I'm looking for... thank you so much!

          From my PoV this a quite important info is hidden too much (deep in Handling Secrets section) and should be exactracted to a separate topic in readme, WDYT?

          Show
          pajasoft Pavel Janoušek added a comment - That's exactly what I'm looking for... thank you so much! From my PoV this a quite important info is hidden too much (deep in Handling Secrets section) and should be exactracted to a separate topic in readme, WDYT?
          Hide
          timja Tim Jacomb added a comment -

          Please use gitter in the first place for questions, failing that, github issues.

          This question was answered

          Show
          timja Tim Jacomb added a comment - Please use gitter in the first place for questions, failing that, github issues. This question was answered

            People

            • Assignee:
              ewel Ewelina Wilkosz
              Reporter:
              pajasoft Pavel Janoušek
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: