-
Notifications
You must be signed in to change notification settings - Fork 47
/
Jenkinsfile-deploy
77 lines (69 loc) · 1.93 KB
/
Jenkinsfile-deploy
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
77
@Library("tada-jenkins-library") _
properties([
parameters([
choice(
name: "PARAM_STAGE",
choices: "development\nstaging\nproduction",
description: "Where do you want to deploy to?"
),
[
$class: "GitParameterDefinition",
name: "PARAM_BRANCH",
type: "PT_BRANCH",
defaultValue: "origin/master",
sortMode: "ASCENDING_SMART",
selectedValue: "DEFAULT",
quickFilterEnabled: true,
],
])
])
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")
PROD_URL = credentials("reopt-api-prod-url")
PROD1_URL = credentials("reopt-api1-prod-url")
PROD2_URL = credentials("reopt-api2-prod-url")
XPRESSDIR = "/opt/xpressmp"
}
stages {
stage("checkout-deploy-branch") {
steps {
tadaCheckoutDeployBranch("https://github.com/NREL/REopt_API.git")
}
}
stage("deploy") {
steps {
script {
currentBuild.description = "Stage: $PARAM_STAGE Branch: $PARAM_BRANCH"
sh "bundle install"
sshagent(credentials: ["jenkins-ssh"]) {
if(env.PARAM_STAGE == "development") {
// TODO: Remove this if we setup branched deployments for
// development (with real DNS subdomain support).
sh "bundle exec cap ${PARAM_STAGE} deploy --trace DEV_BRANCH=${PARAM_BRANCH} DEBUG_DEPLOY=true"
} else {
sh "bundle exec cap ${PARAM_STAGE} deploy --trace BRANCH=${PARAM_BRANCH} DEBUG_DEPLOY=true"
}
}
}
}
}
}
post {
always {
tadaSendNotifications()
}
}
}