This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
57 lines (57 loc) · 2.28 KB
/
Jenkinsfile
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
pipeline {
agent any
parameters {
string(name: 'DOCKER_TAG', defaultValue: 'latest', description: 'Version of docker image')
string(name: 'TIER', defaultValue: 'frontend', description: 'Target portion of application: frontend,admin,database')
string(name: 'TARGET', defaultValue: 'dev', description: 'Target environment of application: dev,staging,etc')
}
environment {
JENKINS_SPN = credentials('JENKINS_SPN_ID')
JENKINS_SPN_PASS = credentials('JENKINS_SPN_PASS')
AZURE_TENANT_ID = credentials('AZURE_TENANT_ID')
}
stages {
stage('Deploy') {
steps {
sh 'az login --service-principal -u $JENKINS_SPN -p $JENKINS_SPN_PASS --tenant $AZURE_TENANT_ID'
sh '''
cd ./helmfile
if [ "$TARGET" = "prod-blue" ] || [ "$TARGET"= "prod-green" ]
then
echo "Prod"
set +x
echo "Setting Environment Secrets. This is obfuscated"
. ./context-prod.sh > /dev/null
set -x
else
echo "Dev"
set +x
echo "Setting Environment Secrets. This is obfuscated"
. ./context-dev.sh > /dev/null
set -x
fi
'''
sh './helmfile/scripts/deleteDatabase.sh'
sh '''
cd ./helmfile
if [ "$TARGET" = "prod-blue" ] || [ "$TARGET"= "prod-green" ]
then
echo "Prod"
set +x
echo "Setting Environment Secrets. This is obfuscated"
. ./context-prod.sh > /dev/null
set -x
else
echo "Dev"
set +x
echo "Setting Environment Secrets. This is obfuscated"
. ./context-dev.sh > /dev/null
set -x
fi
helmfile --environment $TARGET --selector tier=$TIER apply
'''
sh './helmfile/scripts/dataseed.sh'
}
}
}
}