The build stage and deploy stage work ok in terms of using the same agent, because we are using runOnSameNodeAs for the deploy stage to share the same agent as the build stage.
wrappers {
runOnSameNodeAs("${app_job}-build", true)
}
stage('build') {
steps {
build job: "${app_job}-build", parameters: [string(name: 'param1', value: "${param1_value}"), string(name: 'param2', value: "${param2_value}")]
}
}
I guess that leaves the scan stage in question which unfortunately had to be written inline (not through job-dsl) as the job-dsl nexusPolicyEvaluation method was not working (or not found - JOB-DSL configuration for nexusPolicyEvaluation). The pipeline behavior for this however is working ok when we define both the pipeline agent label as linux and build stage as linux, so I think we will just use this for now. We’d have to refactor quite a large code base of pipelines that are designed to call separate freestyle jobs. Will certainly keep the suggestions in mind. Thanks for the insight and feedback.