LoginSignup
2
0

More than 3 years have passed since last update.

jenkins pipelineのwaitUntilを使う際に気をつけること

Posted at

waitUntilとは

Pipeline: Basic Steps - waitUntil

trueを返すまで処理を再試行してくれる。

steps {
    waitUntil { // 気をつけポイント1
        script {
            if ("条件") {
                try {
                    sh "ping IP ADDRESS" // 気をつけポイント3
                    true
                } catch(error) {
                    false
                }
            } else {
                true // 気をつけポイント2
            }
        }
    }
}

気をつけポイント

  1. waitUntilは"step"なのでstepsの内(scriptの外)
  2. waitUntilの終わりにはtrueが必要、条件分岐したりする場合はtrue忘れに注意
  3. pingでの疎通確認は(あまり)適さない
    1. pingは実行され続けるから、そこで止まる
    2. c1しても返り値確認など必要
    3. 用途によってはnslookupやdigなどを
2
0
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
2
0