[JIRA] (JENKINS-57505) Cannot quote $ (dolar sign) in yaml

7 views
Skip to first unread message

pjanouse@redhat.com (JIRA)

unread,
May 16, 2019, 8:39:02 AM5/16/19
to jenkinsc...@googlegroups.com
Pavel Janoušek created an issue
 
Jenkins / Bug JENKINS-57505
Cannot quote $ (dolar sign) in yaml
Issue Type: Bug Bug
Assignee: Ewelina Wilkosz
Components: configuration-as-code-plugin
Created: 2019-05-16 12:38
Priority: Major Major
Reporter: Pavel Janoušek

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.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

josephp90@gmail.com (JIRA)

unread,
May 28, 2019, 5:58:02 AM5/28/19
to jenkinsc...@googlegroups.com
Joseph Petersen commented on Bug JENKINS-57505
 
Re: Cannot quote $ (dolar sign) in yaml

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}

pjanouse@redhat.com (JIRA)

unread,
May 29, 2019, 9:20:02 AM5/29/19
to jenkinsc...@googlegroups.com

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?

timjacomb1@gmail.com (JIRA)

unread,
Jul 17, 2019, 3:52:03 AM7/17/19
to jenkinsc...@googlegroups.com
Tim Jacomb closed an issue as Fixed
 

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

This question was answered

Change By: Tim Jacomb
Status: Open Closed
Resolution: Fixed
Reply all
Reply to author
Forward
0 new messages