From 9fbfb1648b1a4809a35149f79f6dbbe48ffdbdc7 Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Mon, 30 Jul 2018 16:47:28 +1000 Subject: [PATCH] Fix CI --- Jenkinsfile | 96 ++++++++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dfed92b..1038817 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,67 +17,65 @@ pipeline { sh 'docker pull $DOCKER_CI_TOOLS' } } - stages { - stage('Build') { - parallel { - stage('x86_64') { - steps { - ansiColor('xterm') { - // Codebase - sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:latest yarn --registry=$NPM_REGISTRY install' - sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:latest npm runscript build' - sh 'rm -rf node_modules' - sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:latest yarn --registry=$NPM_REGISTRY install --prod' - sh 'docker run --rm -v $(pwd):/data $DOCKER_CI_TOOLS node-prune' + stage('Build') { + parallel { + stage('x86_64') { + steps { + ansiColor('xterm') { + // Codebase + sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:latest yarn --registry=$NPM_REGISTRY install' + sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:latest npm runscript build' + sh 'rm -rf node_modules' + sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:latest yarn --registry=$NPM_REGISTRY install --prod' + sh 'docker run --rm -v $(pwd):/data $DOCKER_CI_TOOLS node-prune' - // Docker Build - sh 'docker build --pull --no-cache --squash --compress -t $TEMP_IMAGE_NAME .' + // Docker Build + sh 'docker build --pull --no-cache --squash --compress -t $TEMP_IMAGE_NAME .' - // Private Registry - sh 'docker tag $TEMP_IMAGE_NAME $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION' - sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION' + // Private Registry + sh 'docker tag $TEMP_IMAGE_NAME $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION' + sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION' - // Dockerhub - sh 'docker tag $TEMP_IMAGE_NAME docker.io/jc21/$IMAGE_NAME:$TAG_VERSION' + // Dockerhub + sh 'docker tag $TEMP_IMAGE_NAME docker.io/jc21/$IMAGE_NAME:$TAG_VERSION' - withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) { - sh "docker login -u '${duser}' -p '$dpass'" - sh 'docker push docker.io/jc21/$IMAGE_NAME:$TAG_VERSION' - } - - sh 'docker rmi $TEMP_IMAGE_NAME' + withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) { + sh "docker login -u '${duser}' -p '$dpass'" + sh 'docker push docker.io/jc21/$IMAGE_NAME:$TAG_VERSION' } + + sh 'docker rmi $TEMP_IMAGE_NAME' } } - stage('armhf') { - agent { - label 'armhf' - } - steps { - ansiColor('xterm') { - // Codebase - sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:armhf yarn --registry=$NPM_REGISTRY install' - sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:armhf npm runscript build' - sh 'rm -rf node_modules' - sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:armhf yarn --registry=$NPM_REGISTRY install --prod' + } + stage('armhf') { + agent { + label 'armhf' + } + steps { + ansiColor('xterm') { + // Codebase + sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:armhf yarn --registry=$NPM_REGISTRY install' + sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:armhf npm runscript build' + sh 'rm -rf node_modules' + sh 'docker run --rm -v $(pwd):/srv/app -w /srv/app $IMAGE_NAME-base:armhf yarn --registry=$NPM_REGISTRY install --prod' - // Docker Build - sh 'docker build --pull --no-cache --squash --compress -t TEMP_IMAGE_NAME_ARM .' + // Docker Build + sh 'docker build --pull --no-cache --squash --compress -t TEMP_IMAGE_NAME_ARM .' - // Private Registry - sh 'docker tag TEMP_IMAGE_NAME_ARM $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION-armhf' - sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION-armhf' + // Private Registry + sh 'docker tag TEMP_IMAGE_NAME_ARM $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION-armhf' + sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE_NAME:$TAG_VERSION-armhf' - // Dockerhub - sh 'docker tag TEMP_IMAGE_NAME_ARM docker.io/jc21/$IMAGE_NAME:$TAG_VERSION-armhf' + // Dockerhub + sh 'docker tag TEMP_IMAGE_NAME_ARM docker.io/jc21/$IMAGE_NAME:$TAG_VERSION-armhf' - withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) { - sh "docker login -u '${duser}' -p '$dpass'" - sh 'docker push docker.io/jc21/$IMAGE_NAME:$TAG_VERSION-armhf' - } - - sh 'docker rmi TEMP_IMAGE_NAME_ARM' + withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) { + sh "docker login -u '${duser}' -p '$dpass'" + sh 'docker push docker.io/jc21/$IMAGE_NAME:$TAG_VERSION-armhf' } + + sh 'docker rmi TEMP_IMAGE_NAME_ARM' } } }