2016-10-09 8 views
4

私はJenkinsfileにビルドトリガーを定義したいと思います。私はBuildDiscarderPropertyのためにそれを行う方法を知っている:jenkinsを定義する方法jenkinsfileでトリガーをビルドして他のジョブの後にビルドを開始する

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 
    } 
} 

答えて

3

を私はちょうど同じことのために見て、要するにこのJenkinsfilein jenkins-infra/jenkins.io

が見つかりました:

properties([ 
    pipelineTriggers([cron('H/30 * * * *')]) 
]) 
関連する問題