@@ -31,48 +31,55 @@ node('node') {
3131
3232 try {
3333
34- stage ' Checkout'
34+ stage( ' Checkout' ){
3535
36- checkout scm
36+ checkout scm
37+ }
3738
38- stage ' Test'
39+ stage( ' Test' ){
3940
40- env. NODE_ENV = " test"
41+ env. NODE_ENV = " test"
4142
42- print " Environment will be : ${ env.NODE_ENV} "
43+ print " Environment will be : ${ env.NODE_ENV} "
4344
44- sh ' node -v'
45- sh ' npm prune'
46- sh ' npm install'
47- sh ' npm test'
45+ sh ' node -v'
46+ sh ' npm prune'
47+ sh ' npm install'
48+ sh ' npm test'
4849
49- stage ' Build Docker'
50+ }
51+
52+ stage(' Build Docker' ){
5053
5154 sh ' ./dockerBuild.sh'
55+ }
56+
57+ stage(' Deploy' ){
5258
53- stage ' Deploy'
59+ echo ' Push to Repo'
60+ sh ' ./dockerPushToRepo.sh'
5461
55- echo ' Push to Repo '
56- sh ' ./dockerPushToRepo .sh'
62+ echo ' ssh to web server and tell it to pull new image '
63+ sh
' ssh [email protected] running/xxxxxxx/dockerRun .sh' 5764
58- echo ' ssh to web server and tell it to pull new image'
59- sh
' ssh [email protected] running/xxxxxxx/dockerRun.sh' 65+ }
6066
61- stage ' Cleanup'
67+ stage( ' Cleanup' ){
6268
63- echo ' prune and cleanup'
64- sh ' npm prune'
65- sh ' rm node_modules -rf'
69+ echo ' prune and cleanup'
70+ sh ' npm prune'
71+ sh ' rm node_modules -rf'
6672
67- mail body : ' project build successful' ,
68- 69- 70- subject : ' project build successful' ,
71- 73+ mail body : ' project build successful' ,
74+ 75+ 76+ subject : ' project build successful' ,
77+ 78+ }
7279
73- }
7480
7581
82+ }
7683 catch (err) {
7784
7885 currentBuild. result = " FAILURE"
0 commit comments