forked from prometheus-operator/prometheus-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
161 lines (143 loc) · 5.15 KB
/
Jenkinsfile
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
job('prometheus-operator-unit-tests') {
concurrentBuild()
parameters {
stringParam('sha1')
}
scm {
git {
remote {
github('coreos/prometheus-operator')
refspec('+refs/pull/*:refs/remotes/origin/pr/*')
}
branch('${sha1}')
}
}
triggers {
githubPullRequest {
useGitHubHooks()
orgWhitelist(['coreos-inc'])
allowMembersOfWhitelistedOrgsAsAdmin()
triggerPhrase('Test this please.')
extensions {
commitStatus {
context('prometheus-operator-unit-tests')
triggeredStatus('Tests triggered')
startedStatus('Tests started')
completedStatus('SUCCESS', 'Success')
completedStatus('FAILURE', 'Failure')
completedStatus('PENDING', 'Pending')
completedStatus('ERROR', 'Error')
}
}
}
}
steps {
shell('docker run --rm -v $PWD:/go/src/github.com/coreos/prometheus-operator -w /go/src/github.com/coreos/prometheus-operator golang make test')
}
}
job('prometheus-operator-generate-content') {
concurrentBuild()
parameters {
stringParam('sha1')
}
scm {
git {
remote {
github('coreos/prometheus-operator')
refspec('+refs/pull/*:refs/remotes/origin/pr/*')
}
branch('${sha1}')
}
}
triggers {
githubPullRequest {
useGitHubHooks()
orgWhitelist(['coreos-inc'])
allowMembersOfWhitelistedOrgsAsAdmin()
triggerPhrase('Test this please.')
extensions {
commitStatus {
context('prometheus-operator-docs')
triggeredStatus('Tests triggered')
startedStatus('Tests started')
completedStatus('SUCCESS', 'Success')
completedStatus('FAILURE', 'Failure')
completedStatus('PENDING', 'Pending')
completedStatus('ERROR', 'Error')
}
}
}
}
steps {
shell('docker run -v $PWD:/go/src/github.com/coreos/prometheus-operator -w /go/src/github.com/coreos/prometheus-operator/ golang make generate')
shell('git diff --exit-code')
}
}
job('prometheus-operator-e2e-tests') {
concurrentBuild()
parameters {
stringParam('sha1')
}
scm {
git {
remote {
github('coreos/prometheus-operator')
refspec('+refs/pull/*:refs/remotes/origin/pr/*')
}
branch('${sha1}')
}
}
wrappers {
credentialsBinding {
amazonWebServicesCredentialsBinding{
accessKeyVariable('AWS_ACCESS_KEY_ID')
secretKeyVariable('AWS_SECRET_ACCESS_KEY')
credentialsId('Jenkins-Monitoring-AWS-User')
}
usernamePassword('QUAY_ROBOT_USERNAME', 'QUAY_ROBOT_SECRET', 'quay_robot')
}
}
triggers {
githubPullRequest {
useGitHubHooks()
orgWhitelist(['coreos-inc'])
allowMembersOfWhitelistedOrgsAsAdmin()
triggerPhrase('Test this please.')
extensions {
commitStatus {
context('prometheus-operator-e2e-tests')
triggeredStatus('Tests triggered')
startedStatus('Tests started')
completedStatus('SUCCESS', 'Success')
completedStatus('FAILURE', 'Failure')
completedStatus('PENDING', 'Pending')
completedStatus('ERROR', 'Error')
}
}
}
}
steps {
shell('docker build -t cluster-setup-env scripts/jenkins/.')
}
steps {
shell('docker run --rm -v $PWD:$PWD -v /var/run/docker.sock:/var/run/docker.sock cluster-setup-env /bin/bash -c "cd $PWD && make crossbuild"')
}
steps {
shell('docker build -t quay.io/coreos/prometheus-operator-dev:$BUILD_ID .')
shell('docker login -u="$QUAY_ROBOT_USERNAME" -p="$QUAY_ROBOT_SECRET" quay.io')
shell('docker push quay.io/coreos/prometheus-operator-dev:$BUILD_ID')
}
steps {
shell('docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -v $PWD:/go/src/github.com/coreos/prometheus-operator cluster-setup-env /bin/bash -c "cd /go/src/github.com/coreos/prometheus-operator/scripts/jenkins && REPO=quay.io/coreos/prometheus-operator-dev TAG=$BUILD_ID make"')
}
publishers {
postBuildScripts {
steps {
shell('docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -v $PWD:/go/src/github.com/coreos/prometheus-operator cluster-setup-env /bin/bash -c "cd /go/src/github.com/coreos/prometheus-operator/scripts/jenkins && make clean"')
shell('docker rmi quay.io/coreos/prometheus-operator-dev:$BUILD_ID')
}
onlyIfBuildSucceeds(false)
onlyIfBuildFails(false)
}
}
}