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"

          SCCM Admin created issue -
          Ronny Perinke made changes -
          Priority Original: Major [ 3 ] New: Minor [ 4 ]

          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?
          Ronny Perinke made changes -
          Assignee Original: Ronny Perinke [ sephirothj ] New: SCCM Admin [ sccm_admin ]
          Ronny Perinke made changes -
          Summary Original: Variables are not resolved in "description" and "tags" New: Support variables in "description" and "tags"
          Ronny Perinke made changes -
          Issue Type Original: Bug [ 1 ] New: New Feature [ 2 ]

          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.
          SCCM Admin made changes -
          Assignee Original: SCCM Admin [ sccm_admin ] New: Ronny Perinke [ sephirothj ]

          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 .

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

              Created:
              Updated:
              Resolved: