-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
49 lines (47 loc) · 1.33 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
pipeline{
agent none
stages{
stage ("Get app code"){
agent {label 'master'}
steps{
git 'https://github.com/Nibeth/FinalDevops.git'
echo "Repository cloned"
}
}
stage ("Build"){
agent {docker 'trion/ng-cli:8.2.0'}
steps{
sh "npm install"
sh "ng build --prod --base-href=/coches/"
}
}
/* stage ("Run unit test "){
agent {docker 'trion/ng-cli:8.2.0'}
steps{
sh "ng test"
}
}*/
stage ("Archive artifact"){
agent {label 'master'}
steps{
archiveArtifacts 'dist/'
sh "docker build -t nibeth/coches ."
sh "docker save -o coches.tar nibeth/coches"
stash name: "stash-artifact", includes: "coches.tar"
}
}
stage ("Deploy QA server"){
agent {label 'master'}
steps{
sh "docker rm coches -f || true"
sh "docker run -d -p 8085:8080 --name coches nibeth/coches"
}
}
stage ("Deployment PROD"){
agent {label 'master'}
steps{
sh "ansible-playbook playbook.yml"
}
}
}
}