diff --git a/Jenkinsfile b/Jenkinsfile index eb3c073..29b571d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,28 +1,29 @@ pipeline { agent any + stages { - stage("Initialize") { + stage('cleanWs') { steps { cleanWs() } } - stage('Get SCM') { + stage('pull') { steps { - git "https://github.com/ranazrad/simple-webapp-nodejs.git" - sh "cat Jenkinsfile" + git 'https://github.com/pazifargan/simple-webapp-nodejs.git' } } - stage('Build') { + stage('build') { steps { - sh "docker build -t nodewebapp ." - sh "docker images" + nodejs('nodejs8') { + sh 'npm install' + } } } - stage('Deploy') { + stage('test') { steps { - sh "docker kill nodewebapp" - sh "docker rm nodewebapp" - sh "docker run -itd --name nodewebapp -p 8081:3000 nodewebapp:latest &" + nodejs('nodejs8') { + sh 'npm test' + } } } } diff --git a/views/index.jade b/views/index.jade index 266c4f3..c45ed05 100644 --- a/views/index.jade +++ b/views/index.jade @@ -4,6 +4,6 @@ block content h1= title p Welcome to Your Web Application - //Remove the follwoing comments and tigger the CI\CD pipeline (Make sure to ident correctly) + //Remove the follwoing comments and tigger the CI\CD pipeline (Make sure to ident correctly). h3 This application was deployed using CI\CD (docker pipeline) by Jenkins