-
Notifications
You must be signed in to change notification settings - Fork 47
/
Jenkinsfile-undeploy-develop
76 lines (69 loc) · 2.21 KB
/
Jenkinsfile-undeploy-develop
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
@Library("tada-jenkins-library") _
pipeline {
agent none
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(daysToKeepStr: "30"))
}
triggers {
cron(env.BRANCH_NAME == "master" ? "H * * * *" : "")
}
environment {
DEPLOY_IMAGE_REPO_DOMAIN = credentials("reopt-api-image-repo-domain")
}
parameters {
booleanParam(
name: "UNDEPLOY_DELETED_BRANCHES",
defaultValue: true,
description: "Undeploy branches that have been deleted from develop.",
)
booleanParam(
name: "UNDEPLOY_MERGED_BRANCHES",
defaultValue: true,
description: "Undeploy branches that have been merged into the master branch (but not deleted) from develop.",
)
string(
name: "UNDEPLOY_BRANCH_NAMES",
defaultValue: "",
description: "Undeploy the listed branch names (space separated for multiple branches) from develop.",
)
}
stages {
stage("deploy-agent") {
agent {
docker {
image "${DEPLOY_IMAGE_REPO_DOMAIN}/tada-public/tada-jenkins-kube-deploy:werf-1.2"
args tadaDockerInDockerArgs()
}
}
environment {
TMPDIR = tadaDockerInDockerTmp()
WERF_LOG_VERBOSE = "true"
WERF_SYNCHRONIZATION = ":local"
DEPLOY_ENV = "development"
RANCHER_PROJECT = "reopt-api-dev"
DB_BASE_NAME = "reopt_api_develop"
XPRESS_LICENSE_HOST = credentials("reopt-api-xpress-license-host")
NREL_ROOT_CERT_URL_ROOT = credentials("reopt-api-nrel-root-cert-url-root")
}
stages {
stage("undeploy-branches") {
steps {
withKubeConfig([credentialsId: "kubeconfig-nrel-reopt-test"]) {
tadaUndeployEachBranch(rancherProject: env.RANCHER_PROJECT, undeployDeletedBranches: params.UNDEPLOY_DELETED_BRANCHES, undeployMergedBranches: params.UNDEPLOY_MERGED_BRANCHES, undeployBranchNames: params.UNDEPLOY_BRANCH_NAMES, primaryBranch: "master") {
tadaWithWerfEnv(rancherProject: env.RANCHER_PROJECT, dbBaseName: env.DB_BASE_NAME) {
tadaUndeployBranch()
}
}
}
}
}
}
}
}
post {
always {
tadaSendNotifications()
}
}
}