でビルドトリガーを定義したいと思いJenkinsfile
ます。BuildDiscarderProperty でそれを行う方法を知っています。
properties([[$class: 'jenkins.model.BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '50', artifactNumToKeepStr: '20']]])
別のプロジェクトがビルドされたときに、ジョブを開始するビルド トリガーを設定するにはどうすればよいですか。Java API docsに適切なエントリが見つかりません。
編集:私の解決策は、次のコードを使用することです:
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
}
}