forked from edmundham/eruptMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
41 lines (41 loc) · 1.29 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
pipeline {
agent any
stages {
stage('Set Properties') {
parallel {
stage('Set Properties') {
steps {
sh 'sudo sed -i "s/eruptTEST/$containerName/g" $WORKSPACE/build.yml'
sh 'cat build.yml'
sh 'sudo sed -i "s/5000:80/$port:80/g" $WORKSPACE/build.yml'
sh 'cat $WORKSPACE/COMP4911Timesheets/Properties/launchSettings.json'
sh 'sudo sed -i "s/CONNECTION_STRING/Server=142.232.78.195,1433;Database=$containerName;User ID=SA;Password=$dbpassword;/g" ./COMP4911Timesheets/appsettings.json'
sh 'cat $WORKSPACE/COMP4911Timesheets/appsettings.json'
}
}
stage('Unit Test') {
steps {
sh 'dotnet test'
}
}
}
}
stage('Stop Container') {
steps {
sh 'sudo docker stop $containerName'
sh 'sudo docker rm $containerName'
}
}
stage('Build Container') {
steps {
sh 'sudo docker-compose -f build.yml up --build -d'
}
}
}
environment {
eruptPassword = 'Password!123'
containerName = sh (returnStdout: true, script: 'echo erupt$GIT_BRANCH').trim()
port = sh (returnStdout: true, script: 'cat ./COMP4911Timesheets/Properties/$GIT_BRANCH').trim()
dbpassword = 'Password!123'
}
}