-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathgenerate-web-pages
109 lines (98 loc) · 3.75 KB
/
generate-web-pages
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!groovy
node ('jekyll') {
stage 'Secrets Setup'
withCredentials([[$class: 'StringBinding',
credentialsId: 'alibuild-ssh-vault-token', variable: 'VAULT_TOKEN']]) {
withEnv(["VAULT_ADDR=${VAULT_ADDR}",
"VAULT_SKIP_VERIFY=1"]) {
retry (3) {
sh """
mkdir -p /root/.ssh
git config --global user.name ${BUILDER_USER}
git config --global user.email ${BUILDER_EMAIL}
[[ ! -f /root/.ssh/id_rsa ]] && vault read -field=ssh-key ${VAULT_SECRET_PATH} > /root/.ssh/id_rsa
[[ ! -f /root/.ssh/known_hosts ]] && vault read -field=ssh-known-hosts ${VAULT_SECRET_PATH} > /root/.ssh/known_hosts
echo >> /root/.ssh/known_hosts
chmod 750 /root/.ssh
chmod 400 /root/.ssh/id_rsa
"""
}
}
}
stage 'Checkout repositories'
def workspace = pwd()
parallel (
checkout_aliroot: {
sh """
rm -rf aliroot
if [ ! -d aliroot ]; then
time git clone --mirror --bare --reference /build/mirror/aliroot http://git.cern.ch/pub/AliRoot aliroot
else
time (export GIT_DIR=aliroot && git fetch && git fetch --tags)
fi
"""},
checkout_o2: {
sh """
rm -fr aliceo2
if [ ! -d aliceo2 ]; then
time git clone --bare https://github.com/ktf/AliceO2 aliceo2
else
time (export GIT_DIR=aliceo2 && git fetch && git fetch --tags)
fi
"""},
checkout_dds: {
sh """
if [ ! -d dds ]; then
time git clone --bare https://github.com/FairRootGroup/dds dds
else
time (export GIT_DIR=dds && git fetch && git fetch --tags)
fi
"""},
checkout_fairroot: {
sh """
if [ ! -d fairroot ]; then
time git clone --bare https://github.com/FairRootGroup/FairRoot fairroot
else
time (export GIT_DIR=fairroot && git fetch && git fetch --tags)
fi
"""},
checkout_alibot: {
sh """
rm -rf ali-bot
if [ ! -d ali-bot ]; then
time git clone [email protected]:${SOURCE_REPO}/ali-bot
else
time (cd ali-bot ; git pull --rebase origin master)
fi
"""},
checkout_alisw: {
sh """
rm -fr alisw.github.io
if [ ! -d alisw.github.io ]; then
time git clone --reference /build/mirror/alisw.github.io [email protected]:${DESTINATION_REPO}/alisw.github.io
fi
"""}
)
stage 'Process and commit results'
withEnv(["WORKSPACE=${workspace}"]) {
sh '''
cd alisw.github.io
git reset --hard HEAD
git pull --rebase origin master
# Update the content of result web pages
mkdir -p _data
GIT_DIR="${WORKSPACE}/aliroot" git log --since="1 week" master --format='-%n commit: "%H"%n message: >-%n %s%n author: !!str %an' master > _data/commits-aliroot-master.yaml
GIT_DIR="${WORKSPACE}/aliceo2" git log -n 50 master --format='-%n commit: "%H"%n message: >-%n %s%n author: !!str %an' master > _data/commits-o2-master.yaml
GIT_DIR="${WORKSPACE}/dds" git log -n 50 master --format='-%n commit: "%H"%n message: >-%n %s%n author: !!str %an' master > _data/commits-dds-master.yaml
GIT_DIR="${WORKSPACE}/fairroot" git log -n 50 master --format='-%n commit: "%H"%n message: >-%n %s%n author: !!str %an' master > _data/commits-fairroot-master.yaml
(cd "${WORKSPACE}/ali-bot/" && script/get_builds.sh)
git add _data/
git commit -m 'Updated results.' || true
git push origin master
# Generate web pages and push them
perl -p -i -e "s/\\"_MODULE_\\"/'_MODULE_'/g" "${WORKSPACE}/alisw.github.io/_data/warnings.json"
jekyll build
ls "${WORKSPACE}/alisw.github.io/_site"
'''
}
}