Jenkins 2.462.2, Plugin version: 5.1.0

      Not all Inputfields in the Plugin UI are able to resolve variables with ${var}.

      In Projectname and -version I can use variables in tags and description the variables are not resolved and get transferred literally and I end up with a description "${dt_desc}" and with a tag "${dt_tag}".

       

          [JENKINS-74822] Support variables in "description" and "tags"

          Ronny Perinke added a comment - - edited

          Please give some more details. What type of Jenkins Job do you use - pipeline or classic?

          What's your use case? Why do you need a dynamic project description? Why do you need dynamic tags?

          Ronny Perinke added a comment - - edited Please give some more details. What type of Jenkins Job do you use - pipeline or classic? What's your use case? Why do you need a dynamic project description? Why do you need dynamic tags?

          SCCM Admin added a comment -

          It's a classic Job which is generated via a DSL Groovy Script. 

          We use the tag to mark with branch was used for the SBOM and we want to have a Backlink from the entry in DTrack to the build that generated the SBOM and uploaded it to DTrack - that's what we are using the description for.

          Within the Groovy-Script I can write the correct branch into the tag and "heal" the problem. But the URL to the build is something that's only available dynamical during the build. Jenkins has the environment variable "BUILD_URL" with exact the information we want.

          SCCM Admin added a comment - It's a classic Job which is generated via a DSL Groovy Script.  We use the tag to mark with branch was used for the SBOM and we want to have a Backlink from the entry in DTrack to the build that generated the SBOM and uploaded it to DTrack - that's what we are using the description for. Within the Groovy-Script I can write the correct branch into the tag and "heal" the problem. But the URL to the build is something that's only available dynamical during the build. Jenkins has the environment variable "BUILD_URL" with exact the information we want.

          Ronen Bar added a comment -

          Just to add, the same described functionality works fine with a pipeline job, but with a classic job it is not.

          A sample of code from our jenkinsfile:

          withCredentials([string(credentialsId: 'OWASP-API', variable: 'OWASPDT')]) {
                                      dependencyTrackPublisher artifact: 'target/bom.json', projectName: '${POM_GROUPID}-${POM_ARTIFACTID}', projectVersion: '${POM_MAJOR_VERSION}.${POM_MINOR_VERSION}', projectProperties: [tags: ["${env.BRANCH_NAME}"], description: "Build-Url: ${env.BUILD_URL}"], synchronous: true, dependencyTrackApiKey: OWASPDT
                                  } 

          Ronen Bar added a comment - Just to add, the same described functionality works fine with a pipeline job, but with a classic job it is not. A sample of code from our jenkinsfile: withCredentials([string(credentialsId: 'OWASP-API' , variable: 'OWASPDT' )]) {                             dependencyTrackPublisher artifact: 'target/bom.json' , projectName: '${POM_GROUPID}-${POM_ARTIFACTID}' , projectVersion: '${POM_MAJOR_VERSION}.${POM_MINOR_VERSION}' , projectProperties: [tags: [ "${env.BRANCH_NAME}" ], description: "Build-Url: ${env.BUILD_URL}" ], synchronous: true , dependencyTrackApiKey: OWASPDT                         }

          Ronny Perinke added a comment -

          It "works" in a pipeline job because you can use Groovy's string interpolation feature - this is also the recommended way. In generally, pipeline jobs are recommended and have some benefits over classic (freestyle) jobs.

          Ronny Perinke added a comment - It "works" in a pipeline job because you can use Groovy's string interpolation feature - this is also the recommended way. In generally, pipeline jobs are recommended and have some benefits over classic (freestyle) jobs .

          Ronen Bar added a comment -

          Understood, but in any case it would be appreciated if the same could also be supported for Classic Jobs.

          Ronen Bar added a comment - Understood, but in any case it would be appreciated if the same could also be supported for Classic Jobs.

          Ronny Perinke added a comment -

          The use of environment variables in the form ${VARIABLE} will be supported everywhere in project properties with the next version.

          Ronny Perinke added a comment - The use of environment variables in the form ${VARIABLE} will be supported everywhere in project properties with the next version.

          SCCM Admin added a comment -

          Good news! Thank you for implementing it!

          SCCM Admin added a comment - Good news! Thank you for implementing it!

            sephirothj Ronny Perinke
            sccm_admin SCCM Admin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: