forked from cakephp/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins.groovy
129 lines (118 loc) · 2.68 KB
/
jenkins.groovy
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
def final REPO_NAME = 'cakephp/docs'
// Each version of the book has basically the same
// job definition use a string 'template' to save duplication
def final BUILD_STEPS = '''\
# Rebuild the index.
make populate-index ES_HOST="$ELASTICSEARCH_URL"
rm -rf /tmp/book-VERSION-$GIT_COMMIT
git clone . /tmp/book-VERSION-$GIT_COMMIT
cd /tmp/book-VERSION-$GIT_COMMIT
sed -i.bak 's#html populate-index#html#' Makefile
git add Makefile && git commit -m "Add deploy requirements"
NEW_COMMIT=$(git rev-parse HEAD)
git remote rm origin
git branch -D master || true
git checkout -b master
git remote | grep dokku || git remote add dokku [email protected]:book-VERSION
git push -fv dokku master
rm -rf /tmp/book-VERSION-$GIT_COMMIT
'''
job('Book - Deploy 3.x') {
description('Deploy the 3.x book when changes are pushed.')
scm {
github(REPO_NAME, '3.0')
}
triggers {
scm('H/5 * * * *')
}
logRotator {
daysToKeep(30)
}
steps {
shell(BUILD_STEPS.replaceAll('VERSION', '3'))
}
}
job('Book - Deploy 2.x') {
description('Deploy the 2.x book when changes are pushed.')
scm {
github(REPO_NAME, 'master')
}
triggers {
scm('H/5 * * * *')
}
logRotator {
daysToKeep(30)
}
steps {
shell(BUILD_STEPS.replaceAll('VERSION', '2'))
}
}
job('Book - Deploy 1.3') {
description('Deploy the 1.3 book when changes are pushed.')
scm {
github(REPO_NAME, '1.3')
}
triggers {
scm('H/5 * * * *')
}
logRotator {
daysToKeep(30)
}
steps {
shell(BUILD_STEPS.replaceAll('VERSION', '13'))
}
}
job('Book - Deploy 1.2') {
description('Deploy the 1.2 book when changes are pushed.')
scm {
github(REPO_NAME, '1.2')
}
triggers {
scm('H/5 * * * *')
}
logRotator {
daysToKeep(30)
}
steps {
shell(BUILD_STEPS.replaceAll('VERSION', '12'))
}
}
job('Book - Deploy 1.1') {
description('Deploy the 1.1 book when changes are pushed.')
scm {
github(REPO_NAME, '1.1')
}
triggers {
scm('H/5 * * * *')
}
logRotator {
daysToKeep(30)
}
steps {
shell(BUILD_STEPS.replaceAll('VERSION', '11'))
}
}
job('Book - Rebuild 2.x search index') {
description('Rebuild the 2.x search index. Will result in temporary unavailability of search as index is rebuilt.')
scm {
github(REPO_NAME, 'master')
}
logRotator {
daysToKeep(30)
}
steps {
shell('make rebuild-index ES_HOST="$ELASTICSEARCH_URL"')
}
}
job('Book - Rebuild 3.x search index') {
description('Rebuild the 3.x search index. Will result in temporary unavailability of search as index is rebuilt.')
scm {
github(REPO_NAME, '3.0')
}
logRotator {
daysToKeep(30)
}
steps {
shell('make rebuild-index ES_HOST="$ELASTICSEARCH_URL"')
}
}