The Jenkins job must be prepared to recognize incoming buildParameters
from Pipelines. When our Jenkins job executes, our example build parameters are received from Pipelines and available for use.
Jenkins Job
steps { echo "environment: ${params.environment}" echo "Running tests on image ${params.imageName}:${params.imageTag}" }
At the end of your Jenkins build job, call the plugin's function jfPipelines()
to signal its completion and return control back to Pipelines.
Jenkins Job
jfPipelines()
Your build job may optionally pass information back to Pipelines by updating the properties of Pipelines resources. To do so, declare each resource by name with the new property values in you call to jfPipelines()
.
For example, the following call references a Pipelines PropertyBag resource we have called app_test_results
and provides new values for two of its properties:
Jenkins Job
jfPipelines( outputResources: """[ { "name": "app_test_results", "content": { "passing": 1234, "failing": 0 } } ]""" )
As noted above, these Pipelines resources must be declared as outputResources
of the invoking Jenkins step.