-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Major
-
Component/s: p4-plugin, workflow-cps-global-lib-plugin
-
Environment:jenkins-2.98
p4-plugin-1.8.8
workflow-cps-2.42
workflow-cps-global-lib-2.9
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