diff --git a/Jenkinsfile b/Jenkinsfile index c8956ac0..cc821b96 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,81 +1,86 @@ +#!groovy + pipeline { agent any environment { GIT_NAME = "eea.progressbar" + GIT_ORG = "valentinab25" + GIT_VERSIONFILE = "eea/progressbar/version.txt" + GIT_HISTORYFILE = "docs/HISTORY.txt" } stages { - -stage('Functional tests') { - steps { - parallel( - "WWW": { - node(label: 'docker-1.13') { - script { - try { - checkout scm - sh '''docker run -p 8080 -d --name=$BUILD_TAG-ft-www -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" eeacms/www-devel''' - sh '''docker port $BUILD_TAG-ft-www 8080/tcp > url.file;docker_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' $BUILD_TAG-ft-www); sed -i -e "s/0.0.0.0/${docker_ip}/g" url.file''' - sh '''new_url=$(cat url.file);timeout 600 wget --retry-connrefused --tries=60 --waitretry=10 -q http://${new_url}/''' - sh '''new_url=$(cat url.file);casperjs test eea/progressbar/ftests/eea/*.js --url=${new_url} --xunit=ftestsreport.xml''' - } - finally { - sh '''docker stop $BUILD_TAG-ft-www''' - sh '''docker rm -v $BUILD_TAG-ft-www''' + + + stage('Pull request checks') { + when { + not { + environment name: 'CHANGE_ID', value: '' } - } - junit 'ftestsreport.xml' - archiveArtifacts 'screenshot_eea.png' - - } - }, - - "KGS": { + + environment name: 'CHANGE_TARGET', value: 'master' + } + steps { + + parallel( + "Check PR": { node(label: 'docker-1.13') { - script { - try { - checkout scm - sh '''docker run -p 8080 -d --name=$BUILD_TAG-ft-kgs -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" eeacms/kgs-devel''' - sh '''docker port $BUILD_TAG-ft-kgs 8080/tcp > url.file;docker_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' $BUILD_TAG-ft-kgs); sed -i -e "s/0.0.0.0/${docker_ip}/g" url.file''' - sh '''new_url=$(cat url.file);timeout 600 wget --retry-connrefused --tries=60 --waitretry=10 -q http://${new_url}/''' - sh '''new_url=$(cat url.file);casperjs test eea/progressbar/ftests/kgs/*.js --url=${new_url} --xunit=ftestsreport.xml''' - } - finally { - sh '''docker stop $BUILD_TAG-ft-kgs''' - sh '''docker rm -v $BUILD_TAG-ft-kgs''' - } - } - junit 'ftestsreport.xml' - archiveArtifacts 'screenshot_kgs.png' + + + + script { + + if ( env.CHANGE_BRANCH != "develop" && !( env.CHANGE_BRANCH.startsWith("hotfix")) ) { + error "Pipeline aborted due to PR not made from develop or hotfix branch" + } + + try { + sh '''docker run -i --name="$BUILD_TAG-gitflow-pr" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e GIT_SRC="$GIT_URL" -e GIT_VERSIONFILE="$GIT_VERSIONFILE" -e GIT_HISTORYFILE="$GIT_HISTORYFILE" -e GIT_NAME="$GIT_NAME" gitflow''' + } finally { + sh '''docker rm -v $BUILD_TAG-gitflow-pr''' + } + } + + } }, - - "Plone4": { - node(label: 'docker-1.13') { - script { - try { - checkout scm - sh '''docker run -p 8080 -d --name=$BUILD_TAG-ft-plone4 -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" eeacms/plone-test:4''' - sh '''docker port $BUILD_TAG-ft-plone4 8080/tcp > url.file;docker_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' $BUILD_TAG-ft-plone4); sed -i -e "s/0.0.0.0/${docker_ip}/g" url.file''' - sh '''new_url=$(cat url.file);timeout 600 wget --retry-connrefused --tries=60 --waitretry=10 -q http://${new_url}/''' - sh '''new_url=$(cat url.file);casperjs test eea/progressbar/ftests/plone4/*.js --url=${new_url} --xunit=ftestsreport.xml''' - } - finally { - sh '''docker stop $BUILD_TAG-ft-plone4''' - sh '''docker rm -v $BUILD_TAG-ft-plone4''' + "Tag": { + node(label: 'docker-1.13') { + } + } + ) + + } +} + + stage('Master branch release and tag') { + when { + allOf { + environment name: 'CHANGE_ID', value: '' + branch 'master' } - } - junit 'ftestsreport.xml' - archiveArtifacts 'screenshot_plone4.png' - - } - } + steps { + parallel( + "Release": { + node(label: 'docker-1.13') { + checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'eea.plonebuildout.core']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/eea/eea.plonebuildout.core.git']]]) + + + + } + }, + + "Tag": { + node(label: 'docker-1.13') { + } + } ) } } + } } diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index a3daefe0..755b8911 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -1,6 +1,7 @@ Changelog ========= + 4.1.dev0 - (unreleased) ----------------------- * Change: Remove Sphinx generated documentation diff --git a/eea/progressbar/version.txt b/eea/progressbar/version.txt index 3e45b80e..7d5c902e 100644 --- a/eea/progressbar/version.txt +++ b/eea/progressbar/version.txt @@ -1 +1 @@ -4.1.dev0 \ No newline at end of file +4.1