LoginSignup
7
7

More than 5 years have passed since last update.

【Jenkins】Pipelineのパラレルとパラレルでない書き方

Last updated at Posted at 2018-03-31

JenkinsのPipeline

  • すでにJenkinsで作成済みのジョブを直列・並列処理するジョブを作ることができます

直列・並列処理を混ぜたスクリプト

node {
    stage('app-deploy-stage'){
        echo '直列処理1'
        parallel(
            "stream1":{
                echo '並列処理1'
                build( job:'JOB1', parameters:[ [$class: 'StringParameterValue', name:'version' ,value:'1.1.8' ]])
            },
            "stream2":{
                echo '並列処理2'
                build( job:'JOB2', parameters:[ [$class: 'StringParameterValue', name:'release' ,value:'3.5' ]])
            }
        )
        echo "App deploy finished!!"
    }
    stage('data-update-stage'){
        echo '直列処理2'
        build('JOB3')
    }
    stage('data-delete-stage'){
        echo '直列処理3'
        build('JOB4')
    }
    echo 'All finished'
}

処理の順番

  • 直列処理1(並列処理1、並列処理2(同じタイミングで実行される))→直列処理2→直列処理3

ログの出る順番

  • 直列処理1→並列処理1→並列処理2→App deploy finished!!→直列処理2→直列処理3→All finished

ジョブにパラメーターがある場合

  • 並列処理1のようにパラメーター名と実際の値をビルドファンクションに渡すことで設定できる
7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7