Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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'
- }
- }
- }
Add Comment
Please, Sign In to add comment