[JIRA] (JENKINS-42858) Credentials environment variable isn't evaluated/available in the environment directive

2 views
Skip to first unread message

stephen.donner@gmail.com (JIRA)

unread,
Mar 16, 2017, 4:05:05 PM3/16/17
to jenkinsc...@googlegroups.com
Stephen Donner created an issue
 
Jenkins / Bug JENKINS-42858
Credentials environment variable isn't evaluated/available in the environment directive
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2017/Mar/16 8:04 PM
Environment: Jenkins 2.32.3
Pipeline Model Definition Plugin 1.1.1 (and associated/dependent plugins)
Priority: Major Major
Reporter: Stephen Donner

We'd like to do:

pipeline {
// snip //
environment {
VARIABLES = credentials('MOZILLIANS_VARIABLES')
SAUCELABS_API_KEY = credentials('SAUCELABS_API_KEY')
PYTEST_ADDOPTS = "--color=yes --driver=SauceLabs --variables=capabilities.json --variables=$

{VARIABLES}"
}
// snip //
}

But we get:

WorkflowScript: 25: ""--variables" is not a valid identifier and cannot be used for an environment variable. Identifiers must start with a letter or underscore and can contain only letters, numbers or underscores. @ line 25, column 7.
"--variables=${VARIABLES}

"

The workaround is to currently do:

pipeline {
// snip //
environment

{ VARIABLES = credentials('MOZILLIANS_VARIABLES') SAUCELABS_API_KEY = credentials('SAUCELABS_API_KEY') }

stages {
stage('Test') {
environment {
PYTEST_ADDOPTS = "--color=yes --driver=SauceLabs --variables=capabilities.json --variables=$

{VARIABLES}

"
}
// snip //
}

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

dave.hunt@gmail.com (JIRA)

unread,
Mar 17, 2017, 7:36:02 AM3/17/17
to jenkinsc...@googlegroups.com
Dave Hunt updated an issue
Change By: Dave Hunt
We'd like to do:

 
{code:java}
pipeline {
  // snip //
  environment {
    VARIABLES = credentials('MOZILLIANS_VARIABLES')
    SAUCELABS_API_KEY = credentials('SAUCELABS_API_KEY')
    PYTEST_ADDOPTS = "--color=yes --driver=SauceLabs --variables=capabilities.json --variables=${VARIABLES}"
  }
  // snip //
}
{code}

But we get:

{code:java}

WorkflowScript: 25: ""--variables" is not a valid identifier and cannot be used for an environment variable. Identifiers must start with a letter or underscore and can contain only letters, numbers or underscores. @ line 25, column 7.
         "--variables=${VARIABLES}"
{code}
 

The workaround is to currently do:

 
{code:java}
pipeline {
  // snip //
  environment {
    VARIABLES = credentials('MOZILLIANS_VARIABLES')
    SAUCELABS_API_KEY = credentials('SAUCELABS_API_KEY')
  }
  stages {
    stage('Test') {
      environment {
        PYTEST_ADDOPTS = "--color=yes --driver=SauceLabs --variables=capabilities.json --variables=${VARIABLES}"
      }
  // snip //
} {code}
 

 

dave.hunt@gmail.com (JIRA)

unread,
Mar 17, 2017, 7:37:01 AM3/17/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Mar 17, 2017, 6:58:01 PM3/17/17
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Bug JENKINS-42858
 
Re: Credentials environment variable isn't evaluated/available in the environment directive

So...while I can implement this, there's a good question of whether we should implement it. Credentials are supposed to be secrets, after all - adding them to other environment variables kinda breaks that expectation. rsandell, what are your thoughts?

andrew.bayer@gmail.com (JIRA)

unread,
Mar 17, 2017, 7:06:04 PM3/17/17
to jenkinsc...@googlegroups.com

I take that back - the logic for hiding credentials in the console log is good enough to deal with this, and that's really the only potential problem. Woot.

andrew.bayer@gmail.com (JIRA)

unread,
Mar 17, 2017, 7:08:04 PM3/17/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Mar 17, 2017, 7:08:04 PM3/17/17
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Bug JENKINS-42858
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Mar 17, 2017, 7:08:05 PM3/17/17
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:41 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