[JIRA] (JENKINS-41623) Variable Expansion in Global Variables Not Occurring

2 views
Skip to first unread message

jdavis@ipswitch.com (JIRA)

unread,
Feb 1, 2017, 8:09:02 AM2/1/17
to jenkinsc...@googlegroups.com
Jason Davis created an issue
 
Jenkins / Bug JENKINS-41623
Variable Expansion in Global Variables Not Occurring
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2017/Feb/01 1:08 PM
Environment: Jenkins 2.32.1
Definition Plugin 0.9.1
Priority: Minor Minor
Reporter: Jason Davis

For a given global variable built via: Jenkins -> Manage Jenkins -> Configure System

Name: MYPATH 
Value: ${WORKSPACE}/../path1/${JOB_BASE_NAME}
...
stage ("stage left") {
    steps {
        echo "MYPATH is: " + MYPATH
...

The output in the script is:

[Pipeline] echo
MYPATH is: ${WORKSPACE}/../path1/${JOB_BASE_NAME}

In Freestyle scripts the WORKSPACE and JOB_BASE_NAME values are expanded at build time. We use these as a nice way to have a few consistent job behaviors across all jobs, but without variable expansion, it seems we have to build and maintain variables in each job script.

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

jdavis@ipswitch.com (JIRA)

unread,
Feb 1, 2017, 8:11:01 AM2/1/17
to jenkinsc...@googlegroups.com
Jason Davis updated an issue
Change By: Jason Davis
For Not sure about standard Pipeline scripts, but in a Declarative Pipeline script, for a given global variable built via:

Jenkins -> Manage Jenkins -> Configure System

{code}

Name: MYPATH
Value: ${WORKSPACE}/../path1/${JOB_BASE_NAME}
{code}

{code}

...
stage ("stage left") {
    steps {
        echo "MYPATH is: " + MYPATH
...
{code}


The output in the script is:

{code}

[Pipeline] echo
MYPATH is: ${WORKSPACE}/../path1/${JOB_BASE_NAME}
{code}


In Freestyle scripts the WORKSPACE and JOB_BASE_NAME values are expanded at build time.  We use these as a nice way to have a few consistent job behaviors across all jobs, but without variable expansion, it seems we have to build and maintain variables in each job script.

andrew.bayer@gmail.com (JIRA)

unread,
Feb 27, 2017, 4:35:04 PM2/27/17
to jenkinsc...@googlegroups.com
Andrew Bayer resolved as Duplicate
Change By: Andrew Bayer
Status: Open Resolved
Resolution: Duplicate

bitwiseman@gmail.com (JIRA)

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

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