| Hi, I just updated to the latest version (2.10) and I found out about this new improvement the hard way, via a few of our pipeline jobs, calling some downstream jobs. Until now, I was just doing something like this:
pipeline {
parameters {
choice(name: 'VAR_X', choices: ['1', '2', '3'], description: 'Pick something')
string(name: 'VAR_Y', defaultValue: '', description: 'Specify Y')
booleanParam(name: 'VAR_Z', defaultValue: false, description: 'True or False')
choice(name: 'BUILD_PC', choices: ['bench1', 'bench2'], description: 'Specify a bench')
}
stages {
stage('Compile') {
when {
expression { params.ONLY_PACKAGES == false && params.NO_COVERITY == true }
}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
script {
result = build job: 'downstream_job', parameters: [
string(name: 'VAR_X', value: "${params.VAR_X}"),
string(name: 'VAR_Y', value: "${params.VAR_Y}",
string(name: 'VAR_Z', value: "${params.VAR_Z}",
// this is a Node variable in the downstream job
string(name: 'BUILD_PC', value: "${params.BUILD_PC}")
]
}
}
}
}
}
}
}
I stumbled upon the new feature that told me that it's converting my string downstream input from string to boolean parameter. So I basically switched all the relevant string input variables to booleanParam(...), which resolved only that particular problem. However, I also have a Node input variable, which so far I was not able to resolve:
The parameter 'BUILD_PC' did not have the type expected by downstream_job. Converting to Node.
So it is obvious that I'm getting this error, because the Downstream job is using the "Node" variable via the "Node and Label parameter plugin". Thanks to the type conversion logic in the pipeline-build-step-plugin, I don't have an actual downside from this and it just gives me the quoted warning above. Then again, I should somehow improve the expected type to be according to the downstream expectation. Giving it node() is simply not working, as it gives me a stacktrace. What is the correct way to fix this? |