In the Configuration stage of your new pipeline, add a trigger .
Select Jenkins from the Type menu, which brings up the following screen:
Select a Jenkins master from the Master drop-down menu, then select a job from the Job drop-down.
Add a property file, if desired. See the property files section of the Pipeline Expression Guide for more information about how to specify and use property files.
Jenkins has the ability to save files from a build as a build artifacts. These objects could be compiled binaries or kubernetes manifests or any other artifact created as part of the build process.
Best practice dictates that these artifacts should be uploaded to a dedicated artifact repository such as GCR, DockerHub, Artifactory, Maven etc, however sometimes it’s easier to store the artifact as part of the build output.
Here is an example of a Jenkins pipeline that stores artifacts
stages {
stage('Generate Kubernetes Manifests') {
steps {
sh '''
npm install
npm run import
npm run build
echo "BUILD=${BUILD_NUMBER}" > build.properties
'''
}
}
}
post {
always {
archiveArtifacts artifacts: 'dist/*.yaml', fingerprint: true
archiveArtifacts artifacts: 'build.properties', fingerprint: true
}
}
This job will generate the following artifacts
The line echo "BUILD=${BUILD_NUMBER}" > build.properties
adds a build number field to the build.properties which can be used later to generate the URL used to download the artifact using HTTP.
The build.properties artifact should be added to the Jenkins trigger like this
Finally to add the Jenkins build artifact as a Spinnaker artifact, do the following
https://{jenkins-url}/job/DevToolStack/90/artifact/cdk8s/dist/terraform-operator.k8s.yaml
${trigger.properties['BUILD']}
like this