Commit b63b368d authored by Emanuele Aina's avatar Emanuele Aina

jenkins: Upload non-master branches

At the moment only the master branch is uploaded to latest/ using the
`branch` conditional (which is only supported on multibranch pipelines).

What we really want is to:
* upload every branch to the appropriate release folder (e.g. 18.06/)
* ensure that latest/ is a symlink pointing to the release coming from
  the master branch
Signed-off-by: Emanuele Aina's avatarEmanuele Aina <emanuele.aina@collabora.com>
parent ecb69f9b
......@@ -4,6 +4,9 @@ pipeline {
options {
timeout(time: 20, unit: 'MINUTES')
}
environment {
RELEASE = "${release}"
}
agent {
docker {
label 'docker-slave'
......@@ -20,7 +23,6 @@ pipeline {
}
stage ("Upload site") {
when { branch 'master' }
environment {
NSS_WRAPPER_PASSWD = '/tmp/passwd'
NSS_WRAPPER_GROUP = '/dev/null'
......@@ -29,7 +31,7 @@ pipeline {
script {
sshagent (credentials: [ "collabora-rodoric-docsync", ] ) {
sh 'echo docker:x:$(id -u):$(id -g):docker gecos:/tmp:/bin/false > ${NSS_WRAPPER_PASSWD}'
sh 'LD_PRELOAD=libnss_wrapper.so rsync -e "ssh -oStrictHostKeyChecking=no" -va --no-group --no-owner --no-perms --delete-after out/usr/share/doc/apertis-designs/apertis-designs/ docsync@designs.apertis.org:/srv/designs.apertis.org/www/$(echo $BRANCH_NAME | sed -e s/master/latest/)'
sh 'LD_PRELOAD=libnss_wrapper.so rsync -e "ssh -oStrictHostKeyChecking=no" -va --no-group --no-owner --no-perms --delete-after out/usr/share/doc/apertis-designs/apertis-designs/ docsync@designs.apertis.org:/srv/designs.apertis.org/www/${RELEASE}'
}
}
}
......@@ -42,7 +44,6 @@ pipeline {
}
stage ("Upload pdfs") {
when { branch 'master' }
environment {
NSS_WRAPPER_PASSWD = '/tmp/passwd'
NSS_WRAPPER_GROUP = '/dev/null'
......@@ -51,7 +52,27 @@ pipeline {
script {
sshagent (credentials: [ "collabora-rodoric-docsync", ] ) {
sh 'echo docker:x:$(id -u):$(id -g):docker gecos:/tmp:/bin/false > ${NSS_WRAPPER_PASSWD}'
sh 'LD_PRELOAD=libnss_wrapper.so rsync -e "ssh -oStrictHostKeyChecking=no" -va --no-group --no-owner --no-perms --delete-after build/pdf/*.pdf docsync@designs.apertis.org:/srv/designs.apertis.org/www/$(echo $BRANCH_NAME | sed -e s/master/latest/)'
sh 'LD_PRELOAD=libnss_wrapper.so rsync -e "ssh -oStrictHostKeyChecking=no" -va --no-group --no-owner --no-perms --delete-after build/pdf/*.pdf docsync@designs.apertis.org:/srv/designs.apertis.org/www/${RELEASE}'
}
}
}
}
stage ("Link latest") {
when {
expression {
env.GIT_BRANCH == 'origin/master'
}
}
environment {
NSS_WRAPPER_PASSWD = '/tmp/passwd'
NSS_WRAPPER_GROUP = '/dev/null'
}
steps {
script {
sshagent (credentials: [ "collabora-rodoric-docsync", ] ) {
sh 'echo docker:x:$(id -u):$(id -g):docker gecos:/tmp:/bin/false > ${NSS_WRAPPER_PASSWD}'
sh 'LD_PRELOAD=libnss_wrapper.so ssh -oStrictHostKeyChecking=no docsync@designs.apertis.org ln -sf --no-dereference ${RELEASE} /srv/designs.apertis.org/www/latest'
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment