I've a Jenkins pipeline that should evaluate a boolean parameter called saveEar
:
stage ('Publish to CIFS'){
echo String.valueOf(saveEar)
if ( saveEar ) {
cifsPublisher alwaysPublishFromMaster: false, continueOnError: false, failOnError: false, publishers: [[
configName: 'MY-CONFIG', transfers: [[
cleanRemote: false,
excludes: '',
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: "jenkins-job_" + '$JOB_NAME' + '$BUILD_NUMBER',
remoteDirectorySDF: false,
removePrefix: 'build/libs',
sourceFiles: 'build/libs/my.ear']],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: true
]]
}
}
This is the parameter configuration:
<hudson.model.BooleanParameterDefinition>
<name>saveEar</name>
<description>valore per scegliere se salvare l'EAR generato su XXXX (true => salva, default false)</description>
<defaultValue>false</defaultValue>
</hudson.model.BooleanParameterDefinition>
I'm expecting that when saveEar
is false
Jenkins will not publish over CIFS but it isn't.
This is the pipeline log:
[Pipeline] stage
[Pipeline] { (Publish to CIFS)
[Pipeline] echo
false
[Pipeline] cifsPublisher
CIFS: Connecting from host [jenkins.mydomain]
CIFS: Connecting with configuration [MY-CONFIG] ...
CIFS: Removing WINS from name resolution
CIFS: Setting response timeout [30.000]
CIFS: Setting socket timeout [35.000]
<...>
CIFS: Transferred 1 file(s)
[Pipeline] }
Can anyone help clarify this issue please?
To access a parameter within pipeline stages, use params.variableName
. In your case, you should use params.saveEar
to access the value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With