From 9cc08998c57ca6b9a8614e2e82477a9419034386 Mon Sep 17 00:00:00 2001 From: wen gong Date: Wed, 19 Dec 2018 22:14:09 -0500 Subject: [PATCH 1/4] add Jenkinsfile --- Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000..14f0b741ab --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,15 @@ +pipeline { + agent { + docker { + image 'node:6-alpine' + args '-p 3000:3000' + } + } + stages { + stage('Build') { + steps { + sh 'npm install' + } + } + } +} From 7a71dfb844945028a7cdd625d84696bf04bb3e8f Mon Sep 17 00:00:00 2001 From: wen gong Date: Wed, 19 Dec 2018 22:44:05 -0500 Subject: [PATCH 2/4] Add stage:Test --- Jenkinsfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 14f0b741ab..97f55392bb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,11 +5,19 @@ pipeline { args '-p 3000:3000' } } + environment { + CI = 'true' + } stages { stage('Build') { steps { sh 'npm install' } } + stage('Test') { + steps { + sh './jenkins/scripts/test.sh' + } + } } } From 7846e24a31cb439824096ee74793a20d96d0cd22 Mon Sep 17 00:00:00 2001 From: wen gong Date: Wed, 19 Dec 2018 22:50:34 -0500 Subject: [PATCH 3/4] Add stage:Deliver --- Jenkinsfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 97f55392bb..4af8e70ef9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,5 +19,13 @@ pipeline { sh './jenkins/scripts/test.sh' } } + stage('Deliver') { + steps { + sh './jenkins/scripts/deliver.sh' + input message: 'Finished using the web site? (Click "Proceed" to continue)' + sh './jenkins/scripts/kill.sh' + } + } + } } From b356f6fe0ac96b76c4a175034b9994b7fa6c95d2 Mon Sep 17 00:00:00 2001 From: wen gong Date: Wed, 19 Dec 2018 23:17:07 -0500 Subject: [PATCH 4/4] add Jenkins tutorial link --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 8a36e36b2c..055dfa8a4d 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,6 @@ The `jenkins` directory contains an example of the `Jenkinsfile` (i.e. Pipeline) you'll be creating yourself during the tutorial and the `scripts` subdirectory contains shell scripts with commands that are executed when Jenkins processes the "Test" and "Deliver" stages of your Pipeline. + +This node app is used in Jenkins tutorial: +- https://jenkins.io/doc/tutorials/build-a-node-js-and-react-app-with-npm/#run-jenkins-in-docker