[JIRA] (JENKINS-61346) environmentVariables doesn't escape multiline content

16 views
Skip to first unread message

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:26:03 AM3/5/20
to jenkinsc...@googlegroups.com
Jakub Bochenski created an issue
 
Jenkins / Bug JENKINS-61346
environmentVariables doesn't escape multiline content
Issue Type: Bug Bug
Assignee: Daniel Spilker
Components: job-dsl-plugin
Created: 2020-03-05 14:25
Priority: Major Major
Reporter: Jakub Bochenski

This keeps tripping me.

This will result in invalid properties file format:

        environmentVariables {
            env 'config', '''multiline
content
'''

You have to add sth like string.replaceAll('\n','\\\\n' ) to escape it manually

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:27:03 AM3/5/20
to jenkinsc...@googlegroups.com
Jakub Bochenski updated an issue
Change By: Jakub Bochenski
This keeps tripping me.

This will result in invalid properties file format:
{code}        environmentVariables {

            env 'config', '''multiline
content
}
'''
{code}


You have to add sth like {{string.replaceAll('\n','\\\\n' )}} to escape it manually

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:27:03 AM3/5/20
to jenkinsc...@googlegroups.com

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:28:02 AM3/5/20
to jenkinsc...@googlegroups.com

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:48:03 AM3/5/20
to jenkinsc...@googlegroups.com
Jakub Bochenski updated an issue
This keeps tripping me.

This will result in invalid properties file format:
{code}        environmentVariables {
            env 'config', '''multiline
content
'''
}
{code}

You have to add sth like {{string.replaceAll('\n','\n\\' )}} to escape it manually

EDIT: above should work but doesn't because of some bug in the envijector, but {{string.replace('\n','\\ \\ n')}} works

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:48:03 AM3/5/20
to jenkinsc...@googlegroups.com

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:48:05 AM3/5/20
to jenkinsc...@googlegroups.com
Jakub Bochenski updated an issue
This keeps tripping me.

This will result in invalid properties file format:
{code}        environmentVariables {
            env 'config', '''multiline
content
'''
}
{code}

You have to add sth like {{string.replaceAll('\n','\ n \\ n ' )}} to escape it manually

EDIT: above should work but doesn't because of some bug in the envijector, but {{string.replace('\n','\\n')}} works

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:49:02 AM3/5/20
to jenkinsc...@googlegroups.com
Jakub Bochenski updated an issue
This keeps tripping me.

This will result in invalid properties file format:
{code}        environmentVariables {
            env 'config', '''multiline
content
'''
}
{code}

You have to add sth like {{string.replaceAll('\n','\n\\' )}} to escape it manually


EDIT: above should work but doesn't because of some bug in the envijector, but {{string.replace('\n','\\
\ n')}} works

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:49:02 AM3/5/20
to jenkinsc...@googlegroups.com

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:49:02 AM3/5/20
to jenkinsc...@googlegroups.com

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:50:03 AM3/5/20
to jenkinsc...@googlegroups.com
Jakub Bochenski updated an issue
This keeps tripping me.

This will result in invalid properties file format:
{code}        environmentVariables {
            env 'config', '''multiline
content
'''
}
{code}

You have to add sth like { { code} string.replaceAll('\n','\n\\' ) {code } } to escape it manually

EDIT: above should work but doesn't because of some bug in the envijector, but {code}string.replace('\n','\\n'){code} works

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
Mar 5, 2020, 9:50:04 AM3/5/20
to jenkinsc...@googlegroups.com
Jakub Bochenski updated an issue
This keeps tripping me.

This will result in invalid properties file format:
{code}        environmentVariables {
            env 'config', '''multiline
content
'''
}
{code}

You have to add sth like {{string.replaceAll('\n','\n\\' )}} to escape it manually


EDIT: above should work but doesn't because of some bug in the envijector, but {
{ code} string.replace('\n','\\n') {code } } works
Reply all
Reply to author
Forward
0 new messages