Help us understand the problem. What is going on with this article?

JenkinsFileのテンプレ

テンプレ

JenkinsのPipelineを書くのにテンプレが欲しかったので備忘録に

pipeline {
    agent any
    environment {
    // Globalな変数宣言
    }
    stages {
        //  template
        stage ('stage name') {
            when {
                expression {
                    // 条件を満たす時のみ実行される
                    return true
                }
            }
            environment {
                //このstageでのみ有効な変数宣言
            }
            steps {
                // Timestamperプラグインの出力がされる
                timestamps {
                    script {
                    }
                }
            }
        }
    }
}

注意点

toBoolean() を使う場合は Use Groovy Sandbox のチェックは外すこと

7ukey
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away