forked from gocd/docs.go.cd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gocd.groovy
146 lines (133 loc) · 4.48 KB
/
build.gocd.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import cd.go.contrib.plugins.configrepo.groovy.dsl.*
def olderReleases = ['19.10.0', '19.11.0', '19.12.0', '20.1.0', '20.2.0', '20.3.0', '20.4.0', '20.5.0', '20.6.0', '20.7.0', '20.8.0', '20.9.0', '20.10.0']
def secureEnvironmentVariable = [
S3_BUCKET : 'AES:mL2zKhw4ubTrkW6VpSeyzA==:18KxKvOYTeRz1Q66Ku4wR5OudnR/fg242hnV9U/xluvkgXZfJKilC/fTrAbeEvg1',
AWS_ACCESS_KEY_ID : 'AES:Fg2eF3OOL7HT/9i44QRkcQ==:LYBNfjX8iKms0SY134E9OYmJgnUmtoi1YQF2v02Q7ig=',
AWS_SECRET_ACCESS_KEY: 'AES:xDx9e28nKpnGNBi1FIsVLw==:LBfSbRxTzuA3zeatXKUkI6B1ytDQJ/5X+foL4pZPTKBCg/eXuQIk6jMXZaA5ivhz'
]
def buildStage = {
new Stage("Build", {
cleanWorkingDir = true
jobs {
job("BuildWebsite") {
elasticProfileId = 'ubuntu'
tasks {
bash {
commandString = "bundle"
}
bash {
commandString = "RUN_EXTERNAL_CHECKS=true bundle exec rake complete_build"
}
}
}
}
})
}
def pushToGHPages = {
new Stage("PushToGHPages", {
cleanWorkingDir = true
jobs {
job("PushToGHPages") {
elasticProfileId = 'ubuntu'
tasks {
bash {
commandString = "git remote add upstream 'https://\${BUILD_MAP_USER}:\${BUILD_MAP_PASSWORD}@github.com/gocd/docs.go.cd'"
}
bash {
commandString = "bundle"
}
bash {
commandString = "ALLOW_DIRTY=true REMOTE_NAME=upstream bundle exec rake publish"
}
}
}
}
})
}
def publishToS3 = {
new Stage("S3Sync", {
cleanWorkingDir = true
jobs {
job("upload") {
elasticProfileId = 'ubuntu'
tasks {
bash {
commandString = "bundle"
}
bash {
commandString = "bundle exec rake upload_to_s3"
}
}
}
}
})
}
GoCD.script { GoCD buildScript ->
pipelines {
pipeline("docs.gocd.org-master") {
group = 'gocd-help-docs'
materials {
git {
url = 'https://github.com/gocd/docs.go.cd'
branch = "master"
shallowClone = true
}
}
secureEnvironmentVariables = secureEnvironmentVariable
trackingTool {
link = 'https://github.com/gocd/docs.go.cd/issues/${ID}'
regex = ~/##(\\d+)/
}
stages {
add(buildStage())
add(pushToGHPages())
add(publishToS3())
}
}
pipeline("docs.gocd.org-PR") {
group = 'gocd-help-docs'
materials {
pluggable {
scm = '4b2cfb9e-95ed-4b39-9ac0-cf007f6c7c41'
}
}
trackingTool {
link = 'https://github.com/gocd/docs.go.cd/issues/${ID}'
regex = ~/##(\\d+)/
}
stages {
add(buildStage())
}
}
olderReleases.reverse().each { String releaseVersion ->
pipeline("docs.gocd.org-${releaseVersion}") {
group = "gocd-help-docs"
materials {
git {
url = 'https://github.com/gocd/docs.go.cd'
branch = "release-${releaseVersion}"
shallowClone = true
}
}
environmentVariables = [
'GOCD_VERSION': releaseVersion
]
secureEnvironmentVariables = secureEnvironmentVariable
trackingTool {
link = 'https://github.com/gocd/docs.go.cd/issues/${ID}'
regex = ~/##(\\d+)/
}
stages {
add(buildStage())
add(pushToGHPages())
add(publishToS3())
}
}
}
}
environments {
environment("docs-website") {
pipelines = buildScript.pipelines.getNames().findAll { !it.toUpperCase().contains('PR') }
}
}
}