[JIRA] (JENKINS-41748) Environment variables cross references aren't supported

1 view
Skip to first unread message

aheritier@apache.org (JIRA)

unread,
Feb 6, 2017, 4:09:01 AM2/6/17
to jenkinsc...@googlegroups.com
Arnaud Héritier created an issue
 
Jenkins / Bug JENKINS-41748
Environment variables cross references aren't supported
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2017/Feb/06 9:08 AM
Priority: Major Major
Reporter: Arnaud Héritier

Unlike documented here https://github.com/jenkinsci/pipeline-model-definition-plugin/wiki/Syntax-Reference such sample doesn't work

    environment {
        FOO = "bar"
        OTHER = "${FOO}baz"
    }

Firstly ${FOO} cannot work it is a groovy variable and it should be escaped

OTHER = "\${FOO}baz"

or

OTHER = '${FOO}baz'

And even by escaping it it's not working

and we have

[declarative-pipeline] Running shell script
+ printenv
...
OTHER=nullbaz
...
FOO=bar
...

note that FOO is seen as null which makes no sense in shell env (it should be empty if unknown.

cc Andrew BayerJesse Glickrsandell (should it be considered as a bug ? Or an improvement to do ?)

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

aheritier@apache.org (JIRA)

unread,
Feb 6, 2017, 4:22:01 AM2/6/17
to jenkinsc...@googlegroups.com
Arnaud Héritier commented on Bug JENKINS-41748
 
Re: Environment variables cross references aren't supported

Environment :

docker-workflow:1.9.1:not-pinned
pipeline-aggregator-view:1.4.1:not-pinned
pipeline-build-step:2.4:not-pinned
pipeline-github-lib:1.0:not-pinned
pipeline-graph-analysis:1.3:not-pinned
pipeline-input-step:2.5:not-pinned
pipeline-milestone-step:1.3:not-pinned
pipeline-model-api:1.0:not-pinned
pipeline-model-declarative-agent:1.0:not-pinned
pipeline-model-definition:1.0:not-pinned
pipeline-rest-api:2.4:not-pinned
pipeline-stage-step:2.2:not-pinned
pipeline-stage-tags-metadata:1.0:not-pinned
pipeline-stage-view:2.4:not-pinned
pipeline-utility-steps:1.2.2:not-pinned
workflow-aggregator:2.5:not-pinned
workflow-api:2.8:not-pinned
workflow-basic-steps:2.3:not-pinned
workflow-cps:2.25:not-pinned
workflow-cps-global-lib:2.5:not-pinned
workflow-durable-task-step:2.8:not-pinned
workflow-job:2.9:not-pinned
workflow-multibranch:2.12:not-pinned
workflow-scm-step:2.3:not-pinned
workflow-step-api:2.8:not-pinned
workflow-support:2.12:not-pinned

aheritier@apache.org (JIRA)

unread,
Feb 6, 2017, 4:23:01 AM2/6/17
to jenkinsc...@googlegroups.com
Arnaud Héritier edited a comment on Bug JENKINS-41748
Environment :

{code}
{code}

On Jenkins ver. 2.32.1

rsandell@cloudbees.com (JIRA)

unread,
Feb 6, 2017, 8:11:01 AM2/6/17
to jenkinsc...@googlegroups.com
rsandell commented on Bug JENKINS-41748

does

environment

{ FOO = "bar" OTHER = "$FOObaz" }

work? since that should be fixed in the latest pipeline release iirc.

rsandell@cloudbees.com (JIRA)

unread,
Feb 6, 2017, 8:12:01 AM2/6/17
to jenkinsc...@googlegroups.com
rsandell edited a comment on Bug JENKINS-41748

rsandell@cloudbees.com (JIRA)

unread,
Feb 6, 2017, 8:13:01 AM2/6/17
to jenkinsc...@googlegroups.com
rsandell edited a comment on Bug JENKINS-41748
does


{ { code:java}
environment {
        FOO = "bar"
        OTHER = "$FOObaz"
}

{code
} }


work? since that should be fixed in the latest pipeline release iirc.

aheritier@apache.org (JIRA)

unread,
Feb 6, 2017, 8:24:01 AM2/6/17
to jenkinsc...@googlegroups.com

nope.

[Pipeline] End of Pipeline
groovy.lang.MissingPropertyException: No such property: FOObaz for class: groovy.lang.Binding
	at groovy.lang.Binding.getVariable(Binding.java:63)

It tries to find a groovy FOObaz var

I'm attaching the job config file to easily reproduce it

aheritier@apache.org (JIRA)

unread,
Feb 6, 2017, 8:24:01 AM2/6/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Feb 9, 2017, 2:49:01 PM2/9/17
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Bug JENKINS-41748
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Feb 9, 2017, 2:49:02 PM2/9/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Feb 9, 2017, 2:50:02 PM2/9/17
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Bug JENKINS-41748
 
Re: Environment variables cross references aren't supported

PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/110.

This will require either using single-quotes or escaping dollar signs - I don't think I can get around that.

aheritier@apache.org (JIRA)

unread,
Feb 13, 2017, 7:29:01 AM2/13/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Mar 13, 2017, 5:33:03 PM3/13/17
to jenkinsc...@googlegroups.com
Change By: Andrew Bayer
Status: In Review Resolved
Resolution: Fixed
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:49 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages