First commit delivers no test result files
MODIFY
Dockerfile
Dockerfile
-FROM devportal-base:latest as base
+FROM node:12.18.0 as base
+
+# Start with npm tasks
+WORKDIR /usr/src/app
+
+COPY package*.json ./
+
+RUN npm install
+#copy the rest of the project into the image
+COPY . .
RUN npm run build-production

MODIFY
Jenkinsfile
Jenkinsfile
@@ -46,10 +46,9 @@ pipeline {
}
}
- stage('Prepare base docker image') {
+ stage('Prepare docker test image') {
steps {
sh """
- docker build -t devportal-base:latest -f ./docker/images/base/Dockerfile .
docker build -t devportal-tests:latest -f ./docker/images/test/Dockerfile .
"""
}
@@ -60,13 +59,11 @@ pipeline {
docker {
image 'devportal-tests:latest'
label 'docker'
- args '-u root:root'
+ customWorkspace "workspace/Api-Mgmt-Dev-Portal-Pipeline"
}
}
steps {
- sh "cd '/usr/src/app/' && npm run test"
- /* copy test result into workspace destination */
- sh "cp -r /usr/src/app/junit/* ./junit"
+ sh "npm run test"
}
post {
always {
@@ -132,7 +129,6 @@ pipeline {
sh """
docker image rm -f api-mgmt/devportal:${PACKAGE_VERSION} || true
docker image rm devportal-tests:latest || true
- docker image rm devportal-base:latest || true
"""
}
}

DELETE
docker/images/base/Dockerfile
-FROM node:12.18.0
-
-# Start with npm tasks
-WORKDIR /usr/src/app
-
-COPY package*.json ./
-
-RUN npm install
-#copy the rest of the project into the image
-COPY . .

MODIFY
docker/images/test/Dockerfile
docker/images/test/Dockerfile
-FROM devportal-base:latest
+FROM node:12.18.0
RUN apt-get -qqy update \
&& apt-get -qqy install chromium

GW-406: First commit delivers no test result files