Last active
September 3, 2016 13:01
-
-
Save hagihala/965d7d2b02297e0d64c2466c8f67edba to your computer and use it in GitHub Desktop.
Jenkinsfile 雛形
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node { | |
try { | |
stage('Prepare') { | |
echo '準備' | |
} | |
stage('Test') { | |
try { | |
echo 'テストを実行' | |
sh 'false' | |
} catch(Exception e) { | |
echo e.toString() | |
// テストが失敗しても Post-Test タスクを実行したいので | |
// 結果を FAILURE にしつつも処理は続行する | |
currentBuild.result = 'FAILURE' | |
} | |
} | |
stage('Post-Test') { | |
echo 'テスト後の処理' | |
sh 'false' | |
} | |
} catch(Exception e) { | |
// Exception がスクリプトの外で catch された時点で FAILURE になるが、 | |
// finally ブロックの処理で result を使いたいので明示的に指定する | |
currentBuild.result = 'FAILURE' | |
throw e | |
} finally { | |
echo "通知: ${currentBuild.result}" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TBD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment