2018-05-03 01:43:04 -04:00
pipeline {
options {
2018-07-29 05:09:40 -04:00
buildDiscarder(logRotator(numToKeepStr: '10'))
2018-05-03 01:43:04 -04:00
disableConcurrentBuilds()
}
agent any
environment {
2019-02-18 06:14:26 -05:00
IMAGE = "nginx-proxy-manager"
2019-03-14 17:49:08 -04:00
BASE_IMAGE = "jc21/${IMAGE}-base"
TEMP_IMAGE = "${IMAGE}-build_${BUILD_NUMBER}"
2019-02-18 06:14:26 -05:00
TAG_VERSION = getPackageVersion()
MAJOR_VERSION = "2"
2019-02-19 23:35:10 -05:00
BRANCH_LOWER = "${BRANCH_NAME.toLowerCase()}"
2019-03-06 18:45:01 -05:00
// Architectures:
AMD64_TAG = "amd64"
ARMV6_TAG = "armv6l"
ARMV7_TAG = "armv7l"
2019-03-14 17:49:08 -04:00
ARM64_TAG = "arm64"
2018-05-03 02:07:34 -04:00
}
2018-05-03 01:43:04 -04:00
stages {
2019-02-19 17:25:12 -05:00
stage('Build PR') {
when {
changeRequest()
}
2018-06-19 20:31:10 -04:00
steps {
2019-02-19 17:25:12 -05:00
ansiColor('xterm') {
// Codebase
2019-02-19 23:35:10 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install'
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} npm run-script build'
2019-10-09 19:50:46 -04:00
sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules'
2019-02-19 23:35:10 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install --prod'
sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} node-prune'
2019-02-19 17:25:12 -05:00
// Docker Build
2019-03-06 18:45:01 -05:00
sh 'docker build --pull --no-cache --squash --compress -t ${TEMP_IMAGE}-${AMD64_TAG} .'
2019-02-19 17:25:12 -05:00
2019-02-19 17:25:12 -05:00
// Dockerhub
2019-03-06 18:45:01 -05:00
sh 'docker tag ${TEMP_IMAGE}-${AMD64_TAG} docker.io/jc21/${IMAGE}:github-${BRANCH_LOWER}-${AMD64_TAG}'
2019-02-19 17:25:12 -05:00
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
sh "docker login -u '${duser}' -p '${dpass}'"
2019-03-06 18:45:01 -05:00
sh 'docker push docker.io/jc21/${IMAGE}:github-${BRANCH_LOWER}-${AMD64_TAG}'
2019-02-19 17:25:12 -05:00
}
2019-03-06 18:45:01 -05:00
sh 'docker rmi ${TEMP_IMAGE}-${AMD64_TAG}'
2019-02-19 23:35:10 -05:00
script {
2019-03-06 18:45:01 -05:00
def comment = pullRequest.comment("Docker Image for build ${BUILD_NUMBER} is available on [DockerHub](https://cloud.docker.com/repository/docker/jc21/${IMAGE}) as `jc21/${IMAGE}:github-${BRANCH_LOWER}-${AMD64_TAG}`")
2019-02-19 23:35:10 -05:00
}
2019-02-19 17:25:12 -05:00
}
2018-05-03 01:43:04 -04:00
}
}
2018-11-12 06:48:12 -05:00
stage('Build Develop') {
when {
branch 'develop'
}
steps {
ansiColor('xterm') {
// Codebase
2019-02-19 23:35:10 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install'
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} npm run-script build'
2019-10-09 19:50:46 -04:00
sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules'
2019-02-19 23:35:10 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install --prod'
sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} node-prune'
2018-11-12 06:48:12 -05:00
// Docker Build
2019-03-06 18:45:01 -05:00
sh 'docker build --pull --no-cache --squash --compress -t ${TEMP_IMAGE}-${AMD64_TAG} .'
2018-11-12 06:48:12 -05:00
// Dockerhub
2019-03-06 18:45:01 -05:00
sh 'docker tag ${TEMP_IMAGE}-${AMD64_TAG} docker.io/jc21/${IMAGE}:develop-${AMD64_TAG}'
2018-11-12 06:48:12 -05:00
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
2019-02-19 23:35:10 -05:00
sh "docker login -u '${duser}' -p '${dpass}'"
2019-03-06 18:45:01 -05:00
sh 'docker push docker.io/jc21/${IMAGE}:develop-${AMD64_TAG}'
2018-11-12 06:48:12 -05:00
}
2019-03-06 18:45:01 -05:00
sh 'docker rmi ${TEMP_IMAGE}-${AMD64_TAG}'
2018-11-12 06:48:12 -05:00
}
}
}
stage('Build Master') {
2019-03-01 05:12:49 -05:00
when {
branch 'master'
}
2018-07-29 05:09:40 -04:00
parallel {
2019-03-06 18:45:01 -05:00
// ========================
// amd64
// ========================
stage('amd64') {
agent {
label 'amd64'
}
2018-07-29 05:09:40 -04:00
steps {
2018-07-30 19:09:20 -04:00
ansiColor('xterm') {
// Codebase
2019-02-19 23:35:10 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install'
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} npm run-script build'
2019-10-09 19:50:46 -04:00
sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules'
2019-02-19 23:35:10 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install --prod'
sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} node-prune'
2018-07-29 05:09:40 -04:00
2018-07-30 19:09:20 -04:00
// Docker Build
2019-03-06 18:45:01 -05:00
sh 'docker build --pull --no-cache --squash --compress -t ${TEMP_IMAGE}-${AMD64_TAG} .'
2018-07-29 05:09:40 -04:00
2018-07-30 19:09:20 -04:00
// Dockerhub
2019-03-06 18:45:01 -05:00
sh 'docker tag ${TEMP_IMAGE}-${AMD64_TAG} docker.io/jc21/${IMAGE}:${TAG_VERSION}-${AMD64_TAG}'
sh 'docker tag ${TEMP_IMAGE}-${AMD64_TAG} docker.io/jc21/${IMAGE}:${MAJOR_VERSION}-${AMD64_TAG}'
sh 'docker tag ${TEMP_IMAGE}-${AMD64_TAG} docker.io/jc21/${IMAGE}:latest-${AMD64_TAG}'
2018-07-29 05:09:40 -04:00
2018-07-30 19:09:20 -04:00
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
2019-02-19 23:35:10 -05:00
sh "docker login -u '${duser}' -p '${dpass}'"
2019-03-06 18:45:01 -05:00
sh 'docker push docker.io/jc21/${IMAGE}:${TAG_VERSION}-${AMD64_TAG}'
sh 'docker push docker.io/jc21/${IMAGE}:${MAJOR_VERSION}-${AMD64_TAG}'
sh 'docker push docker.io/jc21/${IMAGE}:latest-${AMD64_TAG}'
2018-07-30 19:09:20 -04:00
}
2018-05-03 01:43:04 -04:00
2019-03-06 18:45:01 -05:00
sh 'docker rmi ${TEMP_IMAGE}-${AMD64_TAG}'
}
}
}
// ========================
2019-03-14 17:49:08 -04:00
// arm64
2019-03-06 18:45:01 -05:00
// ========================
2019-03-14 17:49:08 -04:00
stage('arm64') {
2019-03-06 18:45:01 -05:00
agent {
2019-03-14 17:49:08 -04:00
label 'arm64'
2019-03-06 18:45:01 -05:00
}
steps {
ansiColor('xterm') {
// Codebase
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install'
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} npm run-script build'
2019-10-09 19:50:46 -04:00
sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules'
2019-03-06 18:45:01 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install --prod'
// Docker Build
sh 'docker build --pull --no-cache --squash --compress -t ${TEMP_IMAGE}-${ARM64_TAG} -f Dockerfile.${ARM64_TAG} .'
2018-12-12 21:20:41 -05:00
2019-03-06 18:45:01 -05:00
// Dockerhub
sh 'docker tag ${TEMP_IMAGE}-${ARM64_TAG} docker.io/jc21/${IMAGE}:${TAG_VERSION}-${ARM64_TAG}'
sh 'docker tag ${TEMP_IMAGE}-${ARM64_TAG} docker.io/jc21/${IMAGE}:${MAJOR_VERSION}-${ARM64_TAG}'
sh 'docker tag ${TEMP_IMAGE}-${ARM64_TAG} docker.io/jc21/${IMAGE}:latest-${ARM64_TAG}'
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
sh "docker login -u '${duser}' -p '${dpass}'"
sh 'docker push docker.io/jc21/${IMAGE}:${TAG_VERSION}-${ARM64_TAG}'
sh 'docker push docker.io/jc21/${IMAGE}:${MAJOR_VERSION}-${ARM64_TAG}'
sh 'docker push docker.io/jc21/${IMAGE}:latest-${ARM64_TAG}'
2018-12-12 21:20:41 -05:00
}
2019-03-06 18:45:01 -05:00
sh 'docker rmi ${TEMP_IMAGE}-${ARM64_TAG}'
2018-07-30 19:09:20 -04:00
}
2018-07-29 05:09:40 -04:00
}
}
2019-03-06 18:45:01 -05:00
// ========================
// armv7l
// ========================
stage('armv7l') {
2018-07-29 05:09:40 -04:00
agent {
2019-03-06 18:45:01 -05:00
label 'armv7l'
2018-07-29 05:09:40 -04:00
}
steps {
2018-07-30 19:09:20 -04:00
ansiColor('xterm') {
// Codebase
2019-03-06 18:45:01 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install'
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} npm run-script build'
2019-10-09 19:50:46 -04:00
sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules'
2019-03-06 18:45:01 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install --prod'
2018-07-29 05:09:40 -04:00
2018-07-30 19:09:20 -04:00
// Docker Build
2019-03-06 18:45:01 -05:00
sh 'docker build --pull --no-cache --squash --compress -t ${TEMP_IMAGE}-${ARMV7_TAG} -f Dockerfile.${ARMV7_TAG} .'
2018-07-29 05:09:40 -04:00
2018-07-30 19:09:20 -04:00
// Dockerhub
2019-03-06 18:45:01 -05:00
sh 'docker tag ${TEMP_IMAGE}-${ARMV7_TAG} docker.io/jc21/${IMAGE}:${TAG_VERSION}-${ARMV7_TAG}'
sh 'docker tag ${TEMP_IMAGE}-${ARMV7_TAG} docker.io/jc21/${IMAGE}:${MAJOR_VERSION}-${ARMV7_TAG}'
sh 'docker tag ${TEMP_IMAGE}-${ARMV7_TAG} docker.io/jc21/${IMAGE}:latest-${ARMV7_TAG}'
2018-07-29 05:09:40 -04:00
2018-07-30 19:09:20 -04:00
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
2019-02-19 23:35:10 -05:00
sh "docker login -u '${duser}' -p '${dpass}'"
2019-03-06 18:45:01 -05:00
sh 'docker push docker.io/jc21/${IMAGE}:${TAG_VERSION}-${ARMV7_TAG}'
sh 'docker push docker.io/jc21/${IMAGE}:${MAJOR_VERSION}-${ARMV7_TAG}'
sh 'docker push docker.io/jc21/${IMAGE}:latest-${ARMV7_TAG}'
2018-12-12 21:20:41 -05:00
}
2019-03-06 18:45:01 -05:00
sh 'docker rmi ${TEMP_IMAGE}-${ARMV7_TAG}'
2018-07-30 19:09:20 -04:00
}
2018-07-29 05:09:40 -04:00
}
2018-05-03 09:46:03 -04:00
}
2019-03-06 18:45:01 -05:00
// ========================
// armv6l - Disabled for the time being
// ========================
/*
stage('armv6l') {
2019-02-18 06:12:41 -05:00
agent {
2019-03-06 18:45:01 -05:00
label 'armv6l'
2019-02-18 06:12:41 -05:00
}
steps {
ansiColor('xterm') {
// Codebase
2019-03-06 18:45:01 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install'
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} npm run-script build'
2019-10-09 19:50:46 -04:00
sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules'
2019-03-06 18:45:01 -05:00
sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install --prod'
2019-02-18 06:12:41 -05:00
// Docker Build
2019-03-06 18:45:01 -05:00
sh 'docker build --pull --no-cache --squash --compress -t ${TEMP_IMAGE}-${ARMV6_TAG} -f Dockerfile.${ARMV6_TAG} .'
2019-02-18 06:12:41 -05:00
// Dockerhub
2019-03-06 18:45:01 -05:00
sh 'docker tag ${TEMP_IMAGE}-${ARMV6_TAG} docker.io/jc21/${IMAGE}:${TAG_VERSION}-${ARMV6_TAG}'
sh 'docker tag ${TEMP_IMAGE}-${ARMV6_TAG} docker.io/jc21/${IMAGE}:${MAJOR_VERSION}-${ARMV6_TAG}'
sh 'docker tag ${TEMP_IMAGE}-${ARMV6_TAG} docker.io/jc21/${IMAGE}:latest-${ARMV6_TAG}'
2019-02-18 06:12:41 -05:00
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
2019-02-19 23:35:10 -05:00
sh "docker login -u '${duser}' -p '${dpass}'"
2019-03-06 18:45:01 -05:00
sh 'docker push docker.io/jc21/${IMAGE}:${TAG_VERSION}-${ARMV6_TAG}'
sh 'docker push docker.io/jc21/${IMAGE}:${MAJOR_VERSION}-${ARMV6_TAG}'
sh 'docker push docker.io/jc21/${IMAGE}:latest-${ARMV6_TAG}'
2019-02-18 06:12:41 -05:00
}
2019-03-06 18:45:01 -05:00
sh 'docker rmi ${TEMP_IMAGE}-${ARMV6_TAG}'
}
}
}
*/
}
}
// ========================
// latest manifest
// ========================
2019-03-06 18:45:01 -05:00
stage('Latest Manifest') {
2019-03-06 18:45:01 -05:00
when {
branch 'master'
}
steps {
ansiColor('xterm') {
2019-03-06 18:45:01 -05:00
// =======================
// latest
// =======================
2019-03-06 18:45:01 -05:00
sh 'docker pull jc21/${IMAGE}:latest-${AMD64_TAG}'
sh 'docker pull jc21/${IMAGE}:latest-${ARM64_TAG}'
sh 'docker pull jc21/${IMAGE}:latest-${ARMV7_TAG}'
//sh 'docker pull jc21/${IMAGE}:latest-${ARMV6_TAG}'
2019-03-14 17:49:08 -04:00
sh 'docker manifest push --purge jc21/${IMAGE}:latest || echo ""'
2019-03-06 18:45:01 -05:00
sh 'docker manifest create jc21/${IMAGE}:latest jc21/${IMAGE}:latest-${AMD64_TAG} jc21/${IMAGE}:latest-${ARM64_TAG} jc21/${IMAGE}:latest-${ARMV7_TAG}'
2019-02-18 06:12:41 -05:00
2019-03-06 18:45:01 -05:00
sh 'docker manifest annotate jc21/${IMAGE}:latest jc21/${IMAGE}:latest-${AMD64_TAG} --arch ${AMD64_TAG}'
2019-03-14 17:49:08 -04:00
sh 'docker manifest annotate jc21/${IMAGE}:latest jc21/${IMAGE}:latest-${ARM64_TAG} --os linux --arch ${ARM64_TAG}'
sh 'docker manifest annotate jc21/${IMAGE}:latest jc21/${IMAGE}:latest-${ARMV7_TAG} --os linux --arch arm --variant ${ARMV7_TAG}'
//sh 'docker manifest annotate jc21/${IMAGE}:latest jc21/${IMAGE}:latest-${ARMV6_TAG} --os linux --arch arm --variant ${ARMV6_TAG}'
2019-03-06 18:45:01 -05:00
sh 'docker manifest push --purge jc21/${IMAGE}:latest'
2019-03-06 18:45:01 -05:00
// =======================
// major version
// =======================
2019-03-06 18:45:01 -05:00
sh 'docker pull jc21/${IMAGE}:${MAJOR_VERSION}-${AMD64_TAG}'
sh 'docker pull jc21/${IMAGE}:${MAJOR_VERSION}-${ARM64_TAG}'
sh 'docker pull jc21/${IMAGE}:${MAJOR_VERSION}-${ARMV7_TAG}'
//sh 'docker pull jc21/${IMAGE}:${MAJOR_VERSION}-${ARMV6_TAG}'
2019-02-18 06:12:41 -05:00
2019-03-14 17:49:08 -04:00
sh 'docker manifest push --purge jc21/${IMAGE}:${MAJOR_VERSION} || echo ""'
2019-03-06 18:45:01 -05:00
sh 'docker manifest create jc21/${IMAGE}:${MAJOR_VERSION} jc21/${IMAGE}:${MAJOR_VERSION}-${AMD64_TAG} jc21/${IMAGE}:${MAJOR_VERSION}-${ARM64_TAG} jc21/${IMAGE}:${MAJOR_VERSION}-${ARMV7_TAG}'
2019-02-18 06:14:26 -05:00
2019-03-06 18:45:01 -05:00
sh 'docker manifest annotate jc21/${IMAGE}:${MAJOR_VERSION} jc21/${IMAGE}:${MAJOR_VERSION}-${AMD64_TAG} --arch ${AMD64_TAG}'
2019-03-14 17:49:08 -04:00
sh 'docker manifest annotate jc21/${IMAGE}:${MAJOR_VERSION} jc21/${IMAGE}:${MAJOR_VERSION}-${ARM64_TAG} --os linux --arch ${ARM64_TAG}'
sh 'docker manifest annotate jc21/${IMAGE}:${MAJOR_VERSION} jc21/${IMAGE}:${MAJOR_VERSION}-${ARMV7_TAG} --os linux --arch arm --variant ${ARMV7_TAG}'
//sh 'docker manifest annotate jc21/${IMAGE}:${MAJOR_VERSION} jc21/${IMAGE}:${MAJOR_VERSION}-${ARMV6_TAG} --os linux --arch arm --variant ${ARMV6_TAG}'
2019-03-06 18:45:01 -05:00
// =======================
// version
// =======================
2019-03-06 18:45:01 -05:00
sh 'docker pull jc21/${IMAGE}:${TAG_VERSION}-${AMD64_TAG}'
sh 'docker pull jc21/${IMAGE}:${TAG_VERSION}-${ARM64_TAG}'
sh 'docker pull jc21/${IMAGE}:${TAG_VERSION}-${ARMV7_TAG}'
//sh 'docker pull jc21/${IMAGE}:${TAG_VERSION}-${ARMV6_TAG}'
2019-03-14 17:49:08 -04:00
sh 'docker manifest push --purge jc21/${IMAGE}:${TAG_VERSION} || echo ""'
2019-03-06 18:45:01 -05:00
sh 'docker manifest create jc21/${IMAGE}:${TAG_VERSION} jc21/${IMAGE}:${TAG_VERSION}-${AMD64_TAG} jc21/${IMAGE}:${TAG_VERSION}-${ARM64_TAG} jc21/${IMAGE}:${TAG_VERSION}-${ARMV7_TAG}'
sh 'docker manifest annotate jc21/${IMAGE}:${TAG_VERSION} jc21/${IMAGE}:${TAG_VERSION}-${AMD64_TAG} --arch ${AMD64_TAG}'
2019-03-14 17:49:08 -04:00
sh 'docker manifest annotate jc21/${IMAGE}:${TAG_VERSION} jc21/${IMAGE}:${TAG_VERSION}-${ARM64_TAG} --os linux --arch ${ARM64_TAG}'
sh 'docker manifest annotate jc21/${IMAGE}:${TAG_VERSION} jc21/${IMAGE}:${TAG_VERSION}-${ARMV7_TAG} --os linux --arch arm --variant ${ARMV7_TAG}'
//sh 'docker manifest annotate jc21/${IMAGE}:${TAG_VERSION} jc21/${IMAGE}:${TAG_VERSION}-${ARMV6_TAG} --os linux --arch arm --variant ${ARMV6_TAG}'
2019-03-06 18:45:01 -05:00
}
}
}
// ========================
2019-03-06 18:45:01 -05:00
// develop
2019-03-06 18:45:01 -05:00
// ========================
2019-03-06 18:45:01 -05:00
stage('Develop Manifest') {
2019-03-06 18:45:01 -05:00
when {
branch 'develop'
}
steps {
ansiColor('xterm') {
sh 'docker pull jc21/${IMAGE}:develop-${AMD64_TAG}'
//sh 'docker pull jc21/${IMAGE}:develop-${ARM64_TAG}'
//sh 'docker pull jc21/${IMAGE}:develop-${ARMV7_TAG}'
//sh 'docker pull jc21/${IMAGE}:${TAG_VERSION}-${ARMV6_TAG}'
sh 'docker manifest push --purge jc21/${IMAGE}:develop || :'
sh 'docker manifest create jc21/${IMAGE}:develop jc21/${IMAGE}:develop-${AMD64_TAG}'
sh 'docker manifest annotate jc21/${IMAGE}:develop jc21/${IMAGE}:develop-${AMD64_TAG} --arch ${AMD64_TAG}'
2019-03-14 17:49:08 -04:00
//sh 'docker manifest annotate jc21/${IMAGE}:develop jc21/${IMAGE}:develop-${ARM64_TAG} --os linux --arch ${ARM64_TAG}'
//sh 'docker manifest annotate jc21/${IMAGE}:develop jc21/${IMAGE}:develop-${ARMV7_TAG} --os linux --arch arm --variant ${ARMV7_TAG}'
//sh 'docker manifest annotate jc21/${IMAGE}:develop jc21/${IMAGE}:develop-${ARMV6_TAG} --os linux --arch arm --variant ${ARMV6_TAG}'
2019-03-06 18:45:01 -05:00
}
}
}
// ========================
2019-03-06 18:45:01 -05:00
// cleanup
2019-03-06 18:45:01 -05:00
// ========================
2019-03-06 18:45:01 -05:00
stage('Latest Cleanup') {
2019-03-06 18:45:01 -05:00
when {
branch 'master'
}
steps {
ansiColor('xterm') {
2019-03-14 17:49:08 -04:00
sh 'docker rmi jc21/${IMAGE}:latest jc21/${IMAGE}:latest-${AMD64_TAG} jc21/${IMAGE}:latest-${ARM64_TAG} jc21/${IMAGE}:latest-${ARMV7_TAG} || echo ""'
sh 'docker rmi jc21/${IMAGE}:${MAJOR_VERSION}-${AMD64_TAG} jc21/${IMAGE}:${MAJOR_VERSION}-${ARM64_TAG} jc21/${IMAGE}:${MAJOR_VERSION}-${ARMV7_TAG} || echo ""'
sh 'docker rmi jc21/${IMAGE}:${TAG_VERSION}-${AMD64_TAG} jc21/${IMAGE}:${TAG_VERSION}-${ARM64_TAG} jc21/${IMAGE}:${TAG_VERSION}-${ARMV7_TAG} || echo ""'
2019-03-06 18:45:01 -05:00
}
2019-03-06 18:45:01 -05:00
}
}
2019-03-06 18:45:01 -05:00
stage('Develop Cleanup') {
2019-03-06 18:45:01 -05:00
when {
branch 'develop'
}
steps {
ansiColor('xterm') {
2019-03-14 17:49:08 -04:00
sh 'docker rmi jc21/${IMAGE}:develop jc21/${IMAGE}:develop-${AMD64_TAG} || echo ""'
2019-03-06 18:45:01 -05:00
}
2019-03-06 18:45:01 -05:00
}
}
2019-03-06 18:45:01 -05:00
stage('PR Cleanup') {
2019-03-06 18:45:01 -05:00
when {
changeRequest()
}
steps {
ansiColor('xterm') {
2019-03-14 17:49:08 -04:00
sh 'docker rmi jc21/${IMAGE}:github-${BRANCH_LOWER}-${AMD64_TAG} || echo ""'
2019-02-18 06:12:41 -05:00
}
2018-05-03 01:43:04 -04:00
}
}
}
post {
success {
2018-07-30 19:09:20 -04:00
juxtapose event: 'success'
2018-05-17 19:33:41 -04:00
sh 'figlet "SUCCESS"'
2018-05-03 01:43:04 -04:00
}
failure {
2018-07-30 19:09:20 -04:00
juxtapose event: 'failure'
2018-05-17 19:33:41 -04:00
sh 'figlet "FAILURE"'
2018-05-03 01:43:04 -04:00
}
2019-10-09 18:44:12 -04:00
always {
sh 'echo Reverting ownership'
2019-10-09 19:50:46 -04:00
sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} chown -R $(id -u):$(id -g) /data'
2019-10-09 18:44:12 -04:00
}
2018-05-03 01:43:04 -04:00
}
}
2018-05-03 01:56:35 -04:00
def getPackageVersion() {
2019-02-19 23:35:10 -05:00
ver = sh(script: 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} bash -c "cat /data/package.json|jq -r \'.version\'"', returnStdout: true)
2018-05-03 01:56:35 -04:00
return ver.trim()
}