forked from NREL/REopt_API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile-undeploy-staging
63 lines (58 loc) · 1.84 KB
/
Jenkinsfile-undeploy-staging
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
@Library("tada-jenkins-library") _
pipeline {
agent none
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(daysToKeepStr: "30"))
}
triggers {
cron(env.BRANCH_NAME == "master" ? "H * * * *" : "")
}
parameters {
booleanParam(
name: "UNDEPLOY_DELETED_BRANCHES",
defaultValue: true,
description: "Undeploy branches that have been deleted from staging.",
)
booleanParam(
name: "UNDEPLOY_MERGED_BRANCHES",
defaultValue: true,
description: "Undeploy branches that have been merged into the master branch (but not deleted) from staging.",
)
string(
name: "UNDEPLOY_BRANCH_NAMES",
defaultValue: "",
description: "Undeploy the listed branch names (space separated for multiple branches) from staging.",
)
}
stages {
stage("deploy-agent") {
agent {
docker {
image "harbor.nrel.gov/tada-public/tada-jenkins-kube-deploy:latest"
args tadaDockerInDockerArgs()
}
}
environment {
TMPDIR = tadaDockerInDockerTmp()
WERF_LOG_VERBOSE = "true"
DEPLOY_ENV = "staging"
RANCHER_PROJECT = "reopt-api-stage"
DB_BASE_NAME = "reopt_api_staging"
}
stages {
stage("undeploy-branches") {
steps {
withKubeConfig([credentialsId: "kubeconfig-nrel-reopt-prod"]) {
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()
}
}
}
}
}
}
}
}
}