From ea5bdab3740ae010423cf36861f493640ab0af89 Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Thu, 10 Oct 2019 09:50:46 +1000 Subject: [PATCH] Fix CI permissions, again and again --- Jenkinsfile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index eb0b820..530be9a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ pipeline { // 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' - sh 'rm -rf node_modules' + sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules' 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' @@ -58,7 +58,7 @@ pipeline { // 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' - sh 'rm -rf node_modules' + sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules' 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' @@ -93,7 +93,7 @@ pipeline { // 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' - sh 'rm -rf node_modules' + sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules' 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' @@ -128,7 +128,7 @@ pipeline { // 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' - sh 'sudo rm -rf node_modules' + sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules' sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install --prod' // Docker Build @@ -162,7 +162,7 @@ pipeline { // 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' - sh 'rm -rf node_modules' + sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules' sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install --prod' // Docker Build @@ -197,7 +197,7 @@ pipeline { // 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' - sh 'rm -rf node_modules' + sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} rm -rf node_modules' sh 'docker run --rm -v $(pwd):/app -w /app ${BASE_IMAGE} yarn install --prod' // Docker Build @@ -352,9 +352,8 @@ pipeline { sh 'figlet "FAILURE"' } always { - // Revert ownership sh 'echo Reverting ownership' - sh 'docker run --rm -v $(pwd):/project ${DOCKER_CI_TOOLS} chown -R $(id -u):$(id -g) /project' + sh 'docker run --rm -v $(pwd):/data ${DOCKER_CI_TOOLS} chown -R $(id -u):$(id -g) /data' } } }