mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
update commit statuses in Jenkins pipeline
This commit is contained in:
parent
5616a91a9b
commit
99ec132a1f
1 changed files with 39 additions and 0 deletions
39
services/web/Jenkinsfile
vendored
39
services/web/Jenkinsfile
vendored
|
@ -6,6 +6,10 @@ pipeline {
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
HOME = "/tmp"
|
HOME = "/tmp"
|
||||||
|
GIT_PROJECT = "web-sharelatex-internal"
|
||||||
|
JENKINS_WORKFLOW = "web-sharelatex-internal"
|
||||||
|
TARGET_URL = "${env.JENKINS_URL}blue/organizations/jenkins/${JENKINS_WORKFLOW}/detail/$BRANCH_NAME/$BUILD_NUMBER/pipeline"
|
||||||
|
GIT_API_URL = "https://api.github.com/repos/sharelatex/${GIT_PROJECT}/statuses/$GIT_COMMIT"
|
||||||
}
|
}
|
||||||
|
|
||||||
triggers {
|
triggers {
|
||||||
|
@ -14,6 +18,20 @@ pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
stage('Pre') {
|
||||||
|
steps {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
|
||||||
|
sh "curl $GIT_API_URL \
|
||||||
|
--data '{ \
|
||||||
|
\"state\" : \"pending\", \
|
||||||
|
\"target_url\": \"$TARGET_URL\", \
|
||||||
|
\"description\": \"Your build is underway\", \
|
||||||
|
\"context\": \"ci/jenkins\" }' \
|
||||||
|
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Install modules') {
|
stage('Install modules') {
|
||||||
steps {
|
steps {
|
||||||
sshagent (credentials: ['GIT_DEPLOY_KEY']) {
|
sshagent (credentials: ['GIT_DEPLOY_KEY']) {
|
||||||
|
@ -146,11 +164,32 @@ pipeline {
|
||||||
sh 'make clean_ci'
|
sh 'make clean_ci'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
success {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
|
||||||
|
sh "curl $GIT_API_URL \
|
||||||
|
--data '{ \
|
||||||
|
\"state\" : \"success\", \
|
||||||
|
\"target_url\": \"$TARGET_URL\", \
|
||||||
|
\"description\": \"Your build succeeded!\", \
|
||||||
|
\"context\": \"ci/jenkins\" }' \
|
||||||
|
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
failure {
|
failure {
|
||||||
mail(from: "${EMAIL_ALERT_FROM}",
|
mail(from: "${EMAIL_ALERT_FROM}",
|
||||||
to: "${EMAIL_ALERT_TO}",
|
to: "${EMAIL_ALERT_TO}",
|
||||||
subject: "Jenkins build failed: ${JOB_NAME}:${BUILD_NUMBER}",
|
subject: "Jenkins build failed: ${JOB_NAME}:${BUILD_NUMBER}",
|
||||||
body: "Build: ${BUILD_URL}")
|
body: "Build: ${BUILD_URL}")
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
|
||||||
|
sh "curl $GIT_API_URL \
|
||||||
|
--data '{ \
|
||||||
|
\"state\" : \"failure\", \
|
||||||
|
\"target_url\": \"$TARGET_URL\", \
|
||||||
|
\"description\": \"Your build failed\", \
|
||||||
|
\"context\": \"ci/jenkins\" }' \
|
||||||
|
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue