-
Notifications
You must be signed in to change notification settings - Fork 47
/
Jenkinsfile-undeploy-rhel
57 lines (50 loc) · 1.27 KB
/
Jenkinsfile-undeploy-rhel
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
@Library("tada-jenkins-library") _
properties([
parameters([
choice(
name: "PARAM_STAGE",
choices: "development\nstaging",
description: "Where do you want to deploy to?"
),
string(
name: "PARAM_BRANCHES",
description: "Enter a space-deliminted list of branches you wish to undeploy."
),
])
])
pipeline {
agent {
docker {
image "ruby:2.7.2-buster"
}
}
options {
disableConcurrentBuilds()
}
environment {
DEV_URL = credentials("reopt-api-dev-url")
STAGE_URL = credentials("reopt-api-stage-url")
STAGE1_URL = credentials("reopt-api1-stage-url")
STAGE2_URL = credentials("reopt-api2-stage-url")
STAGE_BASEDOMAIN_URL = credentials("reopt-api-stage-base-url")
XPRESSDIR = "/opt/xpressmp"
}
stages {
stage("undeploy") {
steps {
script {
currentBuild.description = "Stage: $PARAM_STAGE Branches: $PARAM_BRANCHES"
sh "bundle install"
sshagent(credentials: ["jenkins-ssh"]) {
sh "for branch_name in ${PARAM_BRANCHES}; do bundle exec cap ${PARAM_STAGE} undeploy --trace BRANCH=\$branch_name CONFIRM_UNDEPLOY=true DEBUG_DEPLOY=true; done"
}
}
}
}
}
post {
always {
tadaSendNotifications()
}
}
}