diff --git a/Jenkinsfile b/Jenkinsfile index a735ce92..1baf4af7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,10 +13,14 @@ pipeline { SONARQUBE_TAG = "" } + + stages { - - stage('Integration tests') { - steps { + + stage('Integration tests') { + parallel { + stage('Cypress') { + steps { node(label: 'docker') { script { try { @@ -41,8 +45,40 @@ pipeline { } } } + } } + + stage("Docker test build") { + when { + not { + environment name: 'CHANGE_ID', value: '' + } + not { + buildingTag() + } + environment name: 'CHANGE_TARGET', value: 'master' + } + environment { + IMAGE_NAME = BUILD_TAG.toLowerCase() + } + steps { + node(label: 'docker-host') { + script { + checkout scm + try { + dockerImage = docker.build("${IMAGE_NAME}", "--no-cache .") + } finally { + sh script: "docker rmi ${IMAGE_NAME}", returnStatus: true + } + } + } + } + } + + + } } + stage('Pull Request') { when { @@ -116,9 +152,9 @@ pipeline { } steps{ node(label: 'docker') { - withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) { - sh '''docker pull eeacms/gitflow; docker run -i --rm --name="${BUILD_TAG}-release" -e GIT_TOKEN="${GITHUB_TOKEN}" -e RANCHER_CATALOG_PATH="${template}" -e DOCKER_IMAGEVERSION="${BRANCH_NAME}" -e DOCKER_IMAGENAME="${registry}" --entrypoint /add_rancher_catalog_entry.sh eeacms/gitflow''' - } + withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'), usernamePassword(credentialsId: 'jekinsdockerhub', usernameVariable: 'DOCKERHUB_USER', passwordVariable: 'DOCKERHUB_PASS')]) { + sh '''docker pull eeacms/gitflow; docker run -i --rm --name="$BUILD_TAG-release" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e DOCKERHUB_REPO="$registry" -e GIT_TOKEN="$GITHUB_TOKEN" -e DOCKERHUB_USER="$DOCKERHUB_USER" -e DOCKERHUB_PASS="$DOCKERHUB_PASS" -e RANCHER_CATALOG_PATHS="$template" -e GITFLOW_BEHAVIOR="RUN_ON_TAG" eeacms/gitflow''' + } } } } @@ -158,6 +194,7 @@ pipeline { } } + post { always { cleanWs(cleanWhenAborted: true, cleanWhenFailure: true, cleanWhenNotBuilt: true, cleanWhenSuccess: true, cleanWhenUnstable: true, deleteDirs: true)