[JIRA] (JENKINS-60367) Allow env vars to be used in options block

2 views
Skip to first unread message

marius.meyer@draeger.com (JIRA)

unread,
Dec 4, 2019, 10:36:03 AM12/4/19
to jenkinsc...@googlegroups.com
Marius Meyer created an issue
 
Jenkins / Improvement JENKINS-60367
Allow env vars to be used in options block
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: pipeline
Created: 2019-12-04 15:35
Priority: Minor Minor
Reporter: Marius Meyer

I'm trying to use the lock() option in an options block of a stage. I want the lock resource to be dynamic (depending on an environment variable).

For example:

    environment  {
        BRANCH_TO_USE = get_branch_to_use()
    }
stages {
    stage('Lock build'){
        options {
          lock(resource: "lock-${env.BRANCH_TO_USE}", quantity: 1)
        }
        stages {
...

But the resulting string is always "lock-null". I tried it without "env." but to no avail.

I would expect this to work especially since the environment variable is available in the coming stages with no problem.

Is there a way to support this or a possible workaround?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages