Created
February 10, 2018 22:20
-
-
Save klinki/b73b4e76be460eed381a535f4e03ca14 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env groovy | |
updateGitlabCommitStatus state: 'pending' | |
pipeline { | |
agent any | |
options { | |
// Here add name of your saved gitlab configuration with API key | |
gitLabConnection('Configured gitlab') | |
} | |
stages { | |
stage('Build') { | |
steps { | |
echo 'Building....' | |
updateGitlabCommitStatus state: 'running' | |
} | |
post { | |
success { | |
updateGitlabCommitStatus name: 'build', state: 'success' | |
} | |
failure { | |
updateGitlabCommitStatus name: 'build', state: 'failed' | |
} | |
} | |
} | |
stage('Test') { | |
steps { | |
echo 'Testing....' | |
} | |
post { | |
success { | |
updateGitlabCommitStatus name: 'tests', state: 'success' | |
} | |
failure { | |
updateGitlabCommitStatus name: 'tests', state: 'failed' | |
} | |
} | |
} | |
} | |
post { | |
always { | |
echo 'Always' | |
deleteDir() /* clean up our workspace */ | |
} | |
success { | |
// Gitlab notification could go also here (if you don't need to distinguish between build and test phase) | |
// updateGitlabCommitStatus name: 'tests', state: 'success' | |
} | |
failure { | |
// Gitlab notification could go also here (if you don't need to distinguish between build and test phase) | |
// updateGitlabCommitStatus name: 'tests', state: 'success' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment