[JIRA] (JENKINS-60190) Parameter references clash with variables, regardless of case.

8 views
Skip to first unread message

mtdeguzis@geisigner.edu (JIRA)

unread,
Nov 15, 2019, 2:50:02 PM11/15/19
to jenkinsc...@googlegroups.com
Michael DeGuzis created an issue
 
Jenkins / Bug JENKINS-60190
Parameter references clash with variables, regardless of case.
Issue Type: Bug Bug
Assignee: Unassigned
Attachments: image-2019-11-15-14-48-18-933.png
Components: pipeline
Created: 2019-11-15 19:49
Priority: Major Major
Reporter: Michael DeGuzis

Consider this example:

Jenkinsfile via WebUI:

node('host.domain.com') {
    env.ARTIFACTORY_SERVER = 'https://host.domain.com/artifactory'
    env.ABC_VAR = 'abc'
    env.PYPI_REPO = 'something'

    try {
        // clean first so we have the RPMs at the end to look at / test with
        stage('Cleanup') {
            cleanWs()
        }
    	stage('test vars') {
            echo env.PYPI_REPO
            echo params.pypi_repo1
            sh 'echo PYPI_REPO without curly braces is $PYPI_REPO'
	        sh 'echo PYPI_REPO with curly braces is ${PYPI_REPO}'
	        sh "echo PYPI_REPO with double quotes is $PYPI_REPO"
	        sh 'echo ABC_VAR without curly braces is $ABC_VAR'
            sh 'echo sleeping 5 && sleep 5s'
    	}
    }
    catch (err) {
        currentBuild.result = "FAILURE"
        throw err
    }
}

Results in:

[Pipeline] { (test vars) (hide)
[Pipeline] echo
something
[Pipeline] echo
uda-pypi-dev
[Pipeline] sh
+ echo PYPI_REPO without curly braces is something
PYPI_REPO without curly braces is something
[Pipeline] sh
+ echo PYPI_REPO with curly braces is something
PYPI_REPO with curly braces is something
[Pipeline] sh
+ echo PYPI_REPO with double quotes is something
PYPI_REPO with double quotes is something
[Pipeline] sh
+ echo ABC_VAR without curly braces is abc
ABC_VAR without curly braces is abc
[Pipeline] sh
+ echo sleeping 5
sleeping 5
+ sleep 5s

Changing the named parameter pypi_repo1 to pypi_repo yields:

[Pipeline] { (test vars)
[Pipeline] echo
something
[Pipeline] echo
uda-pypi-dev
[Pipeline] sh
+ echo PYPI_REPO without curly braces is
PYPI_REPO without curly braces is
[Pipeline] sh
+ echo PYPI_REPO with curly braces is
PYPI_REPO with curly braces is
[Pipeline] sh
+ echo PYPI_REPO with double quotes is something
PYPI_REPO with double quotes is something
[Pipeline] sh
+ echo ABC_VAR without curly braces is abc
ABC_VAR without curly braces is abc
[Pipeline] sh
+ echo sleeping 5
sleeping 5
+ sleep 5s
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

mtdeguzis@geisigner.edu (JIRA)

unread,
Nov 15, 2019, 2:51:02 PM11/15/19
to jenkinsc...@googlegroups.com
Michael DeGuzis updated an issue
Change By: Michael DeGuzis
Consider this example:

!
image screenshot - 2019-11-15-14-48-18-933 1 .png |thumbnail !


Jenkinsfile via WebUI:

{code}

node('host.domain.com') {
    env.ARTIFACTORY_SERVER = 'https://host.domain.com/artifactory'
    env.ABC_VAR = 'abc'
    env.PYPI_REPO = 'something'

    try {
        // clean first so we have the RPMs at the end to look at / test with
        stage('Cleanup') {
            cleanWs()
        }
     stage('test vars') {
            echo env.PYPI_REPO
            echo params.pypi_repo1
            sh 'echo PYPI_REPO without curly braces is $PYPI_REPO'
         sh 'echo PYPI_REPO with curly braces is ${PYPI_REPO}'
         sh "echo PYPI_REPO with double quotes is $PYPI_REPO"
         sh 'echo ABC_VAR without curly braces is $ABC_VAR'
            sh 'echo sleeping 5 && sleep 5s'
     }
    }
    catch (err) {
        currentBuild.result = "FAILURE"
        throw err
    }
}
{code}

Results in:
{code}

[Pipeline] { (test vars) (hide)
[Pipeline] echo
something
[Pipeline] echo
uda-pypi-dev
[Pipeline] sh
+ echo PYPI_REPO without curly braces is something
PYPI_REPO without curly braces is something
[Pipeline] sh
+ echo PYPI_REPO with curly braces is something
PYPI_REPO with curly braces is something
[Pipeline] sh
+ echo PYPI_REPO with double quotes is something
PYPI_REPO with double quotes is something
[Pipeline] sh
+ echo ABC_VAR without curly braces is abc
ABC_VAR without curly braces is abc
[Pipeline] sh
+ echo sleeping 5
sleeping 5
+ sleep 5s
{code}


Changing the named parameter pypi_repo1 to pypi_repo yields:
{code}

[Pipeline] { (test vars)
[Pipeline] echo
something
[Pipeline] echo
uda-pypi-dev
[Pipeline] sh
+ echo PYPI_REPO without curly braces is
PYPI_REPO without curly braces is
[Pipeline] sh
+ echo PYPI_REPO with curly braces is
PYPI_REPO with curly braces is
[Pipeline] sh
+ echo PYPI_REPO with double quotes is something
PYPI_REPO with double quotes is something
[Pipeline] sh
+ echo ABC_VAR without curly braces is abc
ABC_VAR without curly braces is abc
[Pipeline] sh
+ echo sleeping 5
sleeping 5
+ sleep 5s
{code}

mtdeguzis@geisigner.edu (JIRA)

unread,
Nov 15, 2019, 2:51:02 PM11/15/19
to jenkinsc...@googlegroups.com

mtdeguzis@geisigner.edu (JIRA)

unread,
Nov 15, 2019, 2:51:03 PM11/15/19
to jenkinsc...@googlegroups.com
Michael DeGuzis updated an issue
Change By: Michael DeGuzis
Attachment: image-2019-11-15-14-48-18-933.png

mtdeguzis@geisigner.edu (JIRA)

unread,
Nov 15, 2019, 2:52:02 PM11/15/19
to jenkinsc...@googlegroups.com
Michael DeGuzis updated an issue
Consider this example:

!screenshot-1.png|thumbnail!

Jenkinsfile
pipeline script via WebUI text input :
Reply all
Reply to author
Forward
0 new messages