-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJenkinsfile.purge_kv
63 lines (58 loc) · 1.75 KB
/
Jenkinsfile.purge_kv
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
pipeline {
agent {
dockerfile {
filename 'Dockerfile-deploy'
reuseNode true
}
}
options {
quietPeriod(0)
timeout(time: 1, unit: 'HOURS')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '20'))
disableConcurrentBuilds()
}
parameters {
booleanParam(name: 'RUN_ON_DEV', defaultValue: false, description: 'Run the purge on the development environment')
booleanParam(name: 'RUN_ON_PROD', defaultValue: false, description: 'Run the purge on the production environment')
}
environment {
KV_DEV = credentials('cf-kv-dev')
KV_PROD = credentials('cf-kv-prod')
}
stages {
stage('Run purge dev') {
when {
expression { params.RUN_ON_DEV }
}
steps {
withCredentials([
usernamePassword(credentialsId: 'cf-workers-creds', usernameVariable: 'CLOUDFLARE_ACCOUNT_ID', passwordVariable: 'CLOUDFLARE_API_TOKEN'),
]) {
sh """
./scripts/purge_kv.sh $KV_DEV
"""
}
}
}
stage('Run purge prod') {
when {
expression { params.RUN_ON_PROD }
}
steps {
withCredentials([
usernamePassword(credentialsId: 'cf-workers-creds', usernameVariable: 'CLOUDFLARE_ACCOUNT_ID', passwordVariable: 'CLOUDFLARE_API_TOKEN'),
]) {
sh """
./scripts/purge_kv.sh $KV_PROD
"""
}
}
}
}
post {
always {
cleanWs()
}
}
}