Skip to content
Permalink
Browse files

Switched to Dockerfile in Jenkins pipeline

  • Loading branch information...
yandeu committed May 17, 2019
1 parent 74851d8 commit 4a24c8b2b77f2c412e69bfcffc64524662f345c1
Showing with 123 additions and 73 deletions.
  1. +71 −73 Jenkinsfile
  2. +13 −0 dockerfiles/node10.Dockerfile
  3. +13 −0 dockerfiles/node11.Dockerfile
  4. +13 −0 dockerfiles/node12.Dockerfile
  5. +13 −0 dockerfiles/node8.Dockerfile
@@ -1,95 +1,93 @@
pipeline {

agent any
agent none

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

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

stage('Test node 8') {
tools {
nodejs 'NodeJS 8'
}
steps {
timeout(1) {
retry(3) {
sh 'node --version'
sh 'npm --version'
sh 'npm test'
steps {
timeout(20) {
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 10') {
tools {
nodejs 'NodeJS 10'
}
steps {
timeout(1) {
retry(3) {
sh 'node --version'
sh 'npm --version'
sh 'npm test'
stage('Test on Node.js 10') {
agent {
dockerfile {
filename 'node10.Dockerfile'
dir 'dockerfiles'
}
}
steps {
timeout(20) {
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') {
tools {
nodejs 'NodeJS 11'
}
steps {
timeout(1) {
retry(3) {
sh 'node --version'
sh 'npm --version'
sh 'npm test'
stage('Test on Node.js 11') {
agent {
dockerfile {
filename 'node11.Dockerfile'
dir 'dockerfiles'
}
}
steps {
timeout(20) {
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'){
tools {
nodejs 'NodeJS 12'
}
steps {
timeout(1) {
retry(3) {
sh 'node --version'
sh 'npm --version'
sh 'npm test'
stage('Test on Node.js 12') {
agent {
dockerfile {
filename 'node12.Dockerfile'
dir 'dockerfiles'
}
}
steps {
timeout(20) {
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()
}
}

}
@@ -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/*
@@ -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/*
@@ -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/*
@@ -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.
You can’t perform that action at this time.