-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: pipeline-model-definition-plugin
-
None
If you define a SimpleBuildWrapper with a @Symbol, you can use it as a block-scoped step inside steps as expected.
If you define a block-scoped Step, you can use it inside steps, or without a block argument in an options block.
But f you define a SimpleBuildWrapper with a @Symbol, you cannot use it in an options block. The syntax is offered in /directive-generator/ (via the wrap metastep apparently), but it does not work at runtime: the symbol is not recognized.
In the file-parameters plugin, this prevents you from using a sleeker syntax for the FileParameterWrapper:
pipeline {
agent any
parameters {
base64File 'FILE'
}
stages {
stage('x') {
steps {
withFileParameter('FILE') {
sh 'cat $FILE'
}
}
}
}
}
works but
pipeline {
agent any
parameters {
base64File 'FILE'
}
options {
withFileParameter('FILE')
}
stages {
stage('Example') {
steps {
sh 'cat $FILE'
}
}
}
}
does not:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 7: Invalid option type "withFileParameter". Valid option types: [buildDiscarder, catchError, checkoutToSubdirectory, disableConcurrentBuilds, disableResume, durabilityHint, overrideIndexTriggers, parallelsAlwaysFailFast, preserveStashes, quietPeriod, rateLimitBuilds, retry, script, skipDefaultCheckout, skipStagesAfterUnstable, timeout, waitUntil, warnError, withContext, withCredentials, withEnv, wrap, ws] @ line 7, column 5.
withFileParameter('FILE')
^
1 error