-
Bug
-
Resolution: Won't Fix
-
Major
-
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
[JENKINS-52487] p4-plugin + global pipeline shared library - no ${JOB_NAME} expansion in view
Description |
Original:
similar to 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-{color:#00875a}${JOB_NAME}{color}',}} {{ ...}} {{ spec: clientSpec(}} {{ view: config.p4view}} {{ ...}} {{ )}} {{ ...}} {{ )}} {{ ...}} {{ )}} {{ }}} {{ }}} {{ }}} {{ }}} {{ {{}}}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{ @Library('pipelines-lib') _}} {{basicDeclarative {}} {{ p4view = """\}} {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{ }}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not |
New:
similar to 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-{color:#00875a}${JOB_NAME}{color}',}} {{ ...}} {{ spec: clientSpec(}} {{ view: config.p4view}} {{ ...}} {{ )}} {{ ...}} {{ )}} {{ ...}} {{ )}} {{ }}} {{ }}} {{ }}} {{ }}} {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} {{ basicDeclarative {}} {{ p4view = """\}} {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not |
Description |
Original:
similar to 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-{color:#00875a}${JOB_NAME}{color}',}} {{ ...}} {{ spec: clientSpec(}} {{ view: config.p4view}} {{ ...}} {{ )}} {{ ...}} {{ )}} {{ ...}} {{ )}} {{ }}} {{ }}} {{ }}} {{ }}} {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} {{ basicDeclarative {}} {{ p4view = """\}} {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not |
New:
similar to 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-{color:#00875a}${JOB_NAME}{color}', ... spec: clientSpec( view: config.p4view ... ) ... ) ... ) } } } } {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} basicDeclarative { {{ p4view = """}} {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not |
Description |
Original:
similar to 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-{color:#00875a}${JOB_NAME}{color}', ... spec: clientSpec( view: config.p4view ... ) ... ) ... ) } } } } {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} basicDeclarative { {{ p4view = """}} {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not |
New:
similar to 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-{color:#00875a}${JOB_NAME}{color}', ... spec: clientSpec( view: config.p4view ... ) ... ) ... ) } } } } {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} basicDeclarative { {{ p4view = """\}} {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not -- many edits to try and fix formatting - preformatted/monospace does not work well with curly braces |
Description |
Original:
similar to 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-{color:#00875a}${JOB_NAME}{color}', ... spec: clientSpec( view: config.p4view ... ) ... ) ... ) } } } } {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} basicDeclarative { {{ p4view = """\}} {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not -- many edits to try and fix formatting - preformatted/monospace does not work well with curly braces |
New:
similar to 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-{color:#00875a}${JOB_NAME}{color}', ... spec: clientSpec( view: config.p4view ... ) ... ) ... ) } } } } {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} basicDeclarative { {{ p4view = """\\}} {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not – many edits to try and fix formatting - preformatted/monospace does not work well with curly braces |
Description |
Original:
similar to 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-{color:#00875a}${JOB_NAME}{color}', ... spec: clientSpec( view: config.p4view ... ) ... ) ... ) } } } } {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} basicDeclarative { {{ p4view = """\\}} {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not – many edits to try and fix formatting - preformatted/monospace does not work well with curly braces |
New:
similar to 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-{color:#00875a}${JOB_NAME}{color}', ... spec: clientSpec( view: config.p4view ... ) ... ) ... ) } } } } {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} basicDeclarative { p4view = """\ {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not – many edits to try and fix formatting - preformatted/monospace does not work well with curly braces |
Description |
Original:
similar to 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-{color:#00875a}${JOB_NAME}{color}', ... spec: clientSpec( view: config.p4view ... ) ... ) ... ) } } } } {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} basicDeclarative { p4view = """\ {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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 {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not – many edits to try and fix formatting - preformatted/monospace does not work well with curly braces |
New:
similar to 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-{color:#00875a}${JOB_NAME}{color}', ... spec: clientSpec( view: config.p4view ... ) ... ) ... ) } } } } {{}}} that when called with a Jenkinsfile script like: {{#!groovy}} {{@Library('pipelines-lib') _}} basicDeclarative { p4view = """\ {{ //depot/foo/bar/... //jenkins-{color:#de350b}${JOB_NAME}{color}/...}} {{ """}} {{}}} 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-{color:#de350b}null{color}/...' is not under '//jenkins-{color:#00875a}pipelines-lib-test{color}/...'.}} note the {color:#00875a}workspace name{color} is expanded properly but the {color:#de350b}view mapping{color} is not – many edits to try and fix formatting - preformatted/monospace does not work well with curly braces |
Labels | Original: environment-variables pipeline | New: P4_VERIFY environment-variables pipeline |
Labels | Original: P4_VERIFY environment-variables pipeline | New: P4_SUPPORT environment-variables pipeline |
Have you tried using single quotes for the workspace view as double quotes are expanded by Groovy and not the plugin.
e.g.
p4view = '''\ //depot/foo/bar/... //jenkins-${JOB_NAME}/... '''