I would like to define an assembly trigger in mine Jenkinsfile. I know how to do this for BuildDiscarderProperty:
properties([[$class: 'jenkins.model.BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '50', artifactNumToKeepStr: '20']]])
How can I set up a Build Trigger that runs a task when another project has been created. I cannot find a suitable entry in the Java API docs .
Edit: My solution is to use the following code:
stage('Build Agent'){
if (env.BRANCH_NAME == 'develop') {
try {
build job: '../Agent/develop', wait: false
} catch(Exception ex) {
echo "An error occurred while building the agent."
}
}
if (env.BRANCH_NAME == 'master') {
build '../Agent/master', wait: true
}
}
source
share