forked from jholhewres/nginx-s3-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
52 lines (50 loc) · 1.93 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
#!/usr/bin/env groovy
def label = "nginx-s3-proxy-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
apiVersion: v1
kind: Pod
metadata:
name: ${label}
annotations:
container.apparmor.security.beta.kubernetes.io/${label}: unconfined
labels:
app: ${label}
spec:
containers:
- name: ${label}
image: moby/buildkit:v0.9.2-rootless
imagePullPolicy: IfNotPresent
command:
- cat
tty: true
nodeSelector:
workload: batch
""",
slaveConnectTimeout: 3600
) {
node(label) {
stage('setup') {
git url: 'https://ds1.capetown.gov.za/ds_gitlab/OPM/nginx-s3-proxy.git', branch: env.BRANCH_NAME
}
stage('build') {
if ((env.BRANCH_NAME == 'master') || (env.BRANCH_NAME.contains('-branch'))) {
retry(10) {
container(label) {
withCredentials([usernamePassword(credentialsId: 'opm-data-proxy-user', passwordVariable: 'OPM_DATA_PASSWORD', usernameVariable: 'OPM_DATA_USER'),
usernamePassword(credentialsId: 'docker-user', passwordVariable: 'DOCKER_PASS', usernameVariable: 'DOCKER_USER')]) {
sh '''
IMAGE_TAG=${BRANCH_NAME%-branch}
./bin/buildkit-docker.sh "${OPM_DATA_USER}" "${OPM_DATA_PASSWORD}" \\
"${DOCKER_USER}" "${DOCKER_PASS}" \\
"${PWD}" \\
"docker.io/cityofcapetown/nginx-s3-proxy:${IMAGE_TAG}"
sleep 60
'''
}
updateGitlabCommitStatus name: 'base', state: 'success'
}
}
}
}
}
}