Created
April 30, 2019 10:58
-
-
Save shadow1163/44e6a6000086bb4febf227009d08e9c3 to your computer and use it in GitHub Desktop.
pipeline script with gitlab
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
properties([ | |
parameters ([ | |
//Global | |
choice( | |
name: 'environment', | |
choices: 'qa\nstaging\nproduction', | |
description: 'testing environment' | |
), | |
choice( | |
name: 'region', | |
choices: 'deu\nusa\njpn', | |
description: 'This parameter just ONLY valid for production environment' | |
), | |
]) | |
]) | |
def status = ‘’ | |
node('!master') { | |
try { | |
stage('Test') { | |
sh 'echo "!";exit 0' | |
} | |
echo 'This will run only if successful' | |
status = ‘success’ | |
} catch (e) { | |
echo 'This will run only if failed' | |
status = ‘failed’ | |
// Since we're catching the exception in order to report on it, | |
// we need to re-throw it, to ensure that the build is marked as failed | |
throw e | |
} finally { | |
println(currentBuild.currentResult) | |
updateGitlabCommitStatus name: 'build', state: status | |
//println(currentResult) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment