-
Notifications
You must be signed in to change notification settings - Fork 17
/
archive-checkin
executable file
·70 lines (53 loc) · 1.4 KB
/
archive-checkin
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
#!/bin/bash -x
# Archive build artifacts for checkin build. Creates (up to) three files:
# - jenkins-artifacts/pack.tgz
# - jenkins-artifacts/dist.tgz
# - jenkins-artifacts/maven.tgz
revision=`git rev-parse HEAD`
rm -rf $WORKSPACE/jenkins-artifacts
mkdir $WORKSPACE/jenkins-artifacts
# introduced building of maven artifacts
antWithMavenRev="81985e49cf9f492a4af6be8ed5c3125ca4861fbe"
antWithMaven () {
echo "archiving antWithMaven"
buildPack
distsLatest
distsMavenLatest
}
# introduced SABBUS, the 'new' build.xml
antNoMavenRev="0385e9835d6fac729b6672294fa8e4c6b1ea3c10"
antNoMaven () {
echo "archiving antNoMaven"
buildPack
distsLatest
}
# the pre-SABBUS build script
oldAnt () {
echo "archiving oldAnt"
buildPack
distsLatest
}
buildPack () {
[[ -d build/pack ]] && {
tar czf $WORKSPACE/jenkins-artifacts/pack.tgz -C build pack
}
}
distsLatest () {
[[ -L dists/latest ]] && {
# "tar -h" follows symlinks. This helps here so we don't have
# to find out the distribution's folder name.
tar czhf $WORKSPACE/jenkins-artifacts/dist.tgz -C dists latest
}
}
distsMavenLatest () {
[[ -d dists/maven/latest ]] && {
tar czhf $WORKSPACE/jenkins-artifacts/maven.tgz -C dists/maven latest
}
}
if [[ `git rev-list $revision | grep $antWithMavenRev` ]]; then
antWithMaven
elif [[ `git rev-list $revision | grep $antNoMavenRev` ]]; then
antNoMaven
else
oldAnt
fi