Skip to content

Commit

Permalink
Added PR build steps to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jc21 committed Feb 19, 2019
1 parent c2f99e2 commit 444dbd5
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions Jenkinsfile
Expand Up @@ -14,9 +14,31 @@ pipeline {
MAJOR_VERSION = "2"
}
stages {
stage('Prepare') {
stage('Build PR') {
when {
changeRequest()
}
steps {
sh 'docker pull $DOCKER_CI_TOOLS'
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'
sh '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'

// Docker Build
sh 'docker build --pull --no-cache --squash --compress -t $TEMP_IMAGE .'

// Private Registry
sh 'docker tag $TEMP_IMAGE $DOCKER_PRIVATE_REGISTRY/$IMAGE:$BRANCH_NAME'
withCredentials([usernamePassword(credentialsId: 'jc21-private-registry', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
sh "docker login -u '${duser}' -p '$dpass' $DOCKER_PRIVATE_REGISTRY"
sh 'docker push $DOCKER_PRIVATE_REGISTRY/$IMAGE:$BRANCH_NAME'
}

sh 'docker rmi $TEMP_IMAGE'
}
}
}
stage('Build Develop') {
Expand Down

0 comments on commit 444dbd5

Please sign in to comment.