Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52487

p4-plugin + global pipeline shared library - no ${JOB_NAME} expansion in view

XMLWordPrintable

      similar to JENKINS-50393 but as a global declarative shared library

      I have a pipelines-lib/vars/basicDeclarative.groovy file with contents like:

      def call(body) {
          def config = [:]
          body.resolveStrategy = Closure.DELEGATE_FIRST
          body.delegate = config
          body()
          pipeline {
              ...
              stages {
                  stage("Checkout") {
                      steps {
                          checkout perforce(
                              ...
                              workspace: manualSpec(
                                  ...
                                  name: 'jenkins-${JOB_NAME}',
                                  ...
                                  spec: clientSpec(
                                      view: config.p4view
                                      ...
                                  )
                              ...
                              )
                          ...
                          )
                     }
                 }
             }
         }
      }

      that when called with a Jenkinsfile script like:

      #!groovy
      @Library('pipelines-lib') _
      basicDeclarative {
          p4view = """\
          //depot/foo/bar/... //jenkins-${JOB_NAME}/...
          """
      }

      results in errors like:

      ... p4 client -o jenkins-pipelines-lib-test +
      ... p4 client -i +
      P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification.
      Mapping '//jenkins-null/...' is not under '//jenkins-pipelines-lib-test/...'.

      note the workspace name is expanded properly but the view mapping is not

       

      many edits to try and fix formatting - preformatted/monospace does not work well with curly braces

            p4kevin Kevin Williamson
            dchsueh Daniel Hsueh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: