Skip to content

Commit

Permalink
Switched to Dockerfile in Jenkins pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
yandeu committed May 17, 2019
1 parent 74851d8 commit 4a24c8b
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 73 deletions.
144 changes: 71 additions & 73 deletions Jenkinsfile
@@ -1,95 +1,93 @@
pipeline { pipeline {


agent any agent none


stages { stages {
stage('Run Tests') {
parallel {


stage('Install Packages') { stage('Test on Node.js 8') {
tools { agent {
nodejs 'NodeJS 8' dockerfile {
} filename 'node8.Dockerfile'
steps { dir 'dockerfiles'
timeout(10) { }
retry(3) {
sh 'npm install --unsafe-perm'
} }
} steps {
} timeout(20) {
} retry(2) {

sh 'node --version'
stage('Test node 8') { sh 'npm --version'
tools { sh 'npm install --unsafe-perm'
nodejs 'NodeJS 8' sh 'npm test'
} publishCoverage adapters: [coberturaAdapter('output/coverage/jest/cobertura-coverage.xml')], sourceFileResolver: sourceFiles('STORE_LAST_BUILD')
steps { }
timeout(1) { }
retry(3) {
sh 'node --version'
sh 'npm --version'
sh 'npm test'
} }
} }
}
}


stage('Test node 10') { stage('Test on Node.js 10') {
tools { agent {
nodejs 'NodeJS 10' dockerfile {
} filename 'node10.Dockerfile'
steps { dir 'dockerfiles'
timeout(1) { }
retry(3) { }
sh 'node --version' steps {
sh 'npm --version' timeout(20) {
sh 'npm test' retry(2) {
sh 'node --version'
sh 'npm --version'
sh 'npm install --unsafe-perm'
sh 'npm test'
publishCoverage adapters: [coberturaAdapter('output/coverage/jest/cobertura-coverage.xml')], sourceFileResolver: sourceFiles('STORE_LAST_BUILD')
}
}
} }
} }
}
}


stage('Test node 11') { stage('Test on Node.js 11') {
tools { agent {
nodejs 'NodeJS 11' dockerfile {
} filename 'node11.Dockerfile'
steps { dir 'dockerfiles'
timeout(1) { }
retry(3) { }
sh 'node --version' steps {
sh 'npm --version' timeout(20) {
sh 'npm test' retry(2) {
sh 'node --version'
sh 'npm --version'
sh 'npm install --unsafe-perm'
sh 'npm test'
publishCoverage adapters: [coberturaAdapter('output/coverage/jest/cobertura-coverage.xml')], sourceFileResolver: sourceFiles('STORE_LAST_BUILD')
}
}
} }
} }
}
}


stage('Test node 12'){ stage('Test on Node.js 12') {
tools { agent {
nodejs 'NodeJS 12' dockerfile {
} filename 'node12.Dockerfile'
steps { dir 'dockerfiles'
timeout(1) { }
retry(3) { }
sh 'node --version' steps {
sh 'npm --version' timeout(20) {
sh 'npm test' retry(2) {
sh 'node --version'
sh 'npm --version'
sh 'npm install --unsafe-perm'
sh 'npm test'
publishCoverage adapters: [coberturaAdapter('output/coverage/jest/cobertura-coverage.xml')], sourceFileResolver: sourceFiles('STORE_LAST_BUILD')
}
}
} }
} }
}
}


stage('Code Coverage') {
steps {
//cobertura autoUpdateHealth: false, autoUpdateStability: false, classCoverageTargets: '80, 0, 40', coberturaReportFile: 'output/coverage/jest/cobertura-coverage.xml', conditionalCoverageTargets: '80, 0, 40', enableNewApi: true, failUnhealthy: false, failUnstable: false, fileCoverageTargets: '80, 0, 40', lineCoverageTargets: '80, 0, 40', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 40', onlyStable: false, packageCoverageTargets: '80, 0, 40', sourceEncoding: 'ASCII', zoomCoverageChart: false
publishCoverage adapters: [coberturaAdapter('output/coverage/jest/cobertura-coverage.xml')], sourceFileResolver: sourceFiles('STORE_LAST_BUILD')
} }
} }

}

post {
always {
cleanWs()
}
} }


} }
13 changes: 13 additions & 0 deletions dockerfiles/node10.Dockerfile
@@ -0,0 +1,13 @@
# A minimal Docker image with Node and Puppeteer
#
# Based upon:
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker

FROM node:10-stretch

RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
13 changes: 13 additions & 0 deletions dockerfiles/node11.Dockerfile
@@ -0,0 +1,13 @@
# A minimal Docker image with Node and Puppeteer
#
# Based upon:
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker

FROM node:11-stretch

RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
13 changes: 13 additions & 0 deletions dockerfiles/node12.Dockerfile
@@ -0,0 +1,13 @@
# A minimal Docker image with Node and Puppeteer
#
# Based upon:
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker

FROM node:12-stretch

RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
13 changes: 13 additions & 0 deletions dockerfiles/node8.Dockerfile
@@ -0,0 +1,13 @@
# A minimal Docker image with Node and Puppeteer
#
# Based upon:
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker

FROM node:8-stretch

RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

0 comments on commit 4a24c8b

Please sign in to comment.