3
0
mirror of https://github.com/triqs/dft_tools synced 2024-08-06 20:40:00 +02:00

[jenkins] Put a mutex around packaging repo updates

"correct" fix for race failures, though could use separate labeled
resources for each repo
This commit is contained in:
Dylan Simon 2019-08-27 17:37:02 -04:00
parent 5148de2c29
commit 058e39a6c2

8
Jenkinsfile vendored
View File

@ -92,10 +92,11 @@ try {
parallel platforms
if (keepInstall) { node("docker") {
/* Publish results */
stage("publish") { timeout(time: 1, unit: 'HOURS') {
stage("publish") { timeout(time: 5, unit: 'MINUTES') {
def commit = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
def release = env.BRANCH_NAME == "master" || env.BRANCH_NAME == "unstable" || sh(returnStdout: true, script: "git describe --exact-match HEAD || true").trim()
def workDir = pwd()
lock('triqs_publish') {
/* Update documention on gh-pages branch */
dir("$workDir/gh-pages") {
def subdir = "${projectName}/${env.BRANCH_NAME}"
@ -109,7 +110,7 @@ try {
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' --allow-empty -m 'Generated documentation for ${subdir}' -m '${env.BUILD_TAG} ${commit}'
"""
// note: credentials used above don't work (need JENKINS-28335)
sh "git push origin master || { git pull --rebase origin master && git push origin master ; }"
sh "git push origin master"
}
/* Update packaging repo submodule */
if (release) { dir("$workDir/packaging") { try {
@ -120,12 +121,13 @@ try {
[[ -d triqs_\$dir ]] && dir=triqs_\$dir || [[ -d \$dir ]]
echo "160000 commit ${commit}\t\$dir" | git update-index --index-info
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' -m 'Autoupdate ${projectName}' -m '${env.BUILD_TAG}'
git push origin ${env.BRANCH_NAME} || { git pull --rebase origin ${env.BRANCH_NAME} && git push origin ${env.BRANCH_NAME} ; }
git push origin ${env.BRANCH_NAME}
"""
} catch (err) {
/* Ignore, non-critical -- might not exist on this branch */
echo "Failed to update packaging repo"
} } }
}
} }
} }
} catch (err) {