Skip to content

Commit 2d18e0b

Browse files
Jenkinsfiles: report status to GitLab.
1 parent 6df464c commit 2d18e0b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Jenkinsfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ String buildsToKeep = '500'
77
// https://jenkins.io/doc/book/pipeline/syntax/
88
pipeline {
99
agent any
10+
11+
environment {
12+
GITLAB_URL = credentials('gitlab_url')
13+
}
1014

1115
options {
1216
buildDiscarder(logRotator(numToKeepStr: buildsToKeep, artifactNumToKeepStr: buildsToKeep))
17+
gitLabConnection("${env.GITLAB_URL}")
1318
}
1419

1520
triggers {
@@ -87,6 +92,11 @@ pipeline {
8792
failure {
8893
slackSend color: "danger",
8994
message: "Failed: ${currentBuild.fullDisplayName}\n${env.BUILD_URL}"
95+
updateGitlabCommitStatus name: 'build', state: 'failed'
96+
}
97+
98+
success {
99+
updateGitlabCommitStatus name: 'build', state: 'success'
90100
}
91101
}
92102
}

ci/Jenkinsfile-Windows

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ String buildsToKeep = '500'
55
// https://jenkins.io/doc/book/pipeline/syntax/
66
pipeline {
77
agent { label 'windows' }
8+
9+
environment {
10+
GITLAB_URL = credentials('gitlab_url')
11+
}
812

913
options {
1014
buildDiscarder(logRotator(numToKeepStr: buildsToKeep, artifactNumToKeepStr: buildsToKeep))
15+
gitLabConnection("${env.GITLAB_URL}")
1116
}
1217

1318
triggers {
@@ -46,6 +51,11 @@ pipeline {
4651
failure {
4752
slackSend color: "danger",
4853
message: "Failed: ${currentBuild.fullDisplayName}\n${env.BUILD_URL}"
54+
updateGitlabCommitStatus name: 'build-windows', state: 'failed'
55+
}
56+
57+
success {
58+
updateGitlabCommitStatus name: 'build-windows', state: 'success'
4959
}
5060
}
5161
}

0 commit comments

Comments
 (0)