-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
54 lines (54 loc) · 2.21 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
pipeline {
agent none
stages {
stage('clone') {
agent any
steps {
checkout(
[$class: 'GitSCM', branches: [[name: '*/v1_iris_jenkins']],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[name: 'yasmine', url: 'https://github.com/iris-edu-int/yasmine-stationxml-editor.git']]]
)
stash includes: '**/*', name: 'app_src'
}
}
stage('build') {
environment {
frontEnd = ""
backEnd = ""
}
steps {
node('docker1') {
script {
unstash 'app_src'
sh "sudo docker image prune -f"
try {
sh "sudo docker rmi frontend-test"
} catch (err) {
echo err.getMessage()
echo "Error detected, but we will continue."
}
try {
sh "sudo docker rmi backend-test"
} catch (err) {
echo err.getMessage()
echo "Error detected, but we will continue."
}
sh "sudo docker build -t frontend-test -f frontend/Dockerfile.jenkins ./frontend"
sh "sudo docker build -t backend-test -f backend/Dockerfile.jenkins ./backend"
try {
sh "chmod -fR 777 . frontend backend | sudo docker run -i --rm --user=\"jenkins\" -w=\"/home/jenkins\" --volume /local_builds/workspace/yasmine-stationxml-editor:/opt/yasmine frontend-test bash"
} catch (err) {
echo err.getMessage()
echo "Error detected on frontend chmod, but we will continue."
}
sh "echo 'cd /opt/yasmine/frontend; sencha app build' | sudo docker run -i --rm --user=\"jenkins\" -w=\"/home/jenkins\" --volume /local_builds/workspace/yasmine-stationxml-editor:/opt/yasmine frontend-test bash"
sh "echo 'cd /opt/yasmine/backend; python setup.py sdist' | sudo docker run -i --rm --user=\"jenkins\" -w=\"/home/jenkins\" --volume /local_builds/workspace/yasmine-stationxml-editor:/opt/yasmine backend-test bash"
}
}
}
}
}
}