This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
deployJenkinsfile
55 lines (53 loc) · 2.22 KB
/
deployJenkinsfile
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
@Library(value='[email protected]', changelog=false) _
pipeline {
agent {
node {
label 'team:iow'
}
}
stages {
stage('Set Build Description') {
steps {
script {
currentBuild.description = "Deploy to ${ENVIRONMENT}"
}
}
}
stage('run migration') {
agent {
dockerfile {
filename 'migrationDockerfile'
label 'team:iow'
}
}
steps {
script {
def deployStage = "$ENVIRONMENT".toUpperCase()
def scriptCmd = "/usr/local/bin/aws ssm get-parameter --name \"/aws/reference/secretsmanager/MON-LOC-$deployStage\" --query \"Parameter.Value\" --with-decryption --output text --region \"us-west-2\""
def secretsString = sh(script: scriptCmd, returnStdout: true).trim()
def secretsJson = readJSON text: secretsString
env.DATABASE_HOST = secretsJson.DATABASE_ADDRESS
env.DATABASE_PORT = secretsJson.DATABASE_PORT
env.APP_DATABASE_NAME = secretsJson.DATABASE_NAME
env.APP_DB_OWNER_PASSWORD = secretsJson.DB_OWNER_PASSWORD
env.APP_DB_OWNER_USERNAME = secretsJson.DB_OWNER_USERNAME
env.APP_SCHEMA_NAME = secretsJson.SCHEMA_NAME
sh '''
/usr/local/bin/python wellregistry/manage.py migrate admin
/usr/local/bin/python wellregistry/manage.py migrate auth
/usr/local/bin/python wellregistry/manage.py migrate contenttypes
/usr/local/bin/python wellregistry/manage.py migrate sessions
/usr/local/bin/python wellregistry/manage.py migrate social_django
/usr/local/bin/python wellregistry/manage.py migrate registry
/usr/local/bin/python wellregistry/manage.py update_lookups
'''
}
}
}
stage('build artifact') {
steps {
serviceDeployPipeline()
}
}
}
}