Je voudrais définir un déclencheur de construction dans mon Jenkinsfile
. Je sais comment faire pour l'BuildDiscarderProperty:Comment définir jenkins build trigger dans jenkinsfile pour démarrer la construction après un autre travail
properties([[$class: 'jenkins.model.BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '50', artifactNumToKeepStr: '20']]])
Comment puis-je régler le déclenchement de construction qui commence le travail, quand un autre projet a été construit. Je ne peux pas trouver une entrée appropriée dans le Java API docs.
Edit: Ma solution est d'utiliser le code suivant:
stage('Build Agent'){
if (env.BRANCH_NAME == 'develop') {
try {
// try to start subsequent job, but don't wait for it to finish
build job: '../Agent/develop', wait: false
} catch(Exception ex) {
echo "An error occurred while building the agent."
}
}
if (env.BRANCH_NAME == 'master') {
// start subsequent job and wait for it to finish
build '../Agent/master', wait: true
}
}