-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile.prod-deploy
More file actions
54 lines (49 loc) · 1.72 KB
/
Jenkinsfile.prod-deploy
File metadata and controls
54 lines (49 loc) · 1.72 KB
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
#!groovy
timestamps {
def pennsieveNexusCreds = usernamePassword(
credentialsId: 'pennsieve-nexus-ci-login',
usernameVariable: 'PENNSIEVE_NEXUS_USER',
passwordVariable: 'PENNSIEVE_NEXUS_PW'
)
node('prod-executor') {
try {
stage('Run migrations') {
if (params.RUN_MIGRATIONS) {
echo "Running PROD Postgres Schema Migrations"
build job: "Migrations/prod-migrations/prod-postgres-migrations",
parameters: [
string(name: 'IMAGE_TAG', value: params.IMAGE_TAG)
]
}
}
def services = [
'admin',
'api',
'authorization-service',
'etl-data-cli',
'jobs'
]
stage('Deploy') {
def deploySteps = services.collectEntries {
["${it}" : generateDeployStep(it, params.IMAGE_TAG)]
}
deploySteps.failFast = true
parallel deploySteps
}
} catch (e) {
slackSend(color: '#FF0000', message: "FAILED: Production API Deploy - ${params.IMAGE_TAG}")
throw e
}
slackSend(color: '#00FF00', message: "SUCCESS: Production API Deploy - ${params.IMAGE_TAG}")
}
}
// Generate parallel deploy steps
def generateDeployStep(String service, String imageTag) {
return {
build job: "service-deploy/pennsieve-prod/us-east-1/prod-vpc-use1/prod/${service}",
parameters: [
string(name: 'IMAGE_TAG', value: params.IMAGE_TAG),
string(name: "TERRAFORM_ACTION", value: "apply")
]
}
}