From 27e94adb4d2a9a493a40e64bf426d02b4bd17708 Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Fri, 7 Sep 2018 13:21:38 +0300 Subject: [PATCH 01/10] Back to devel --- docs/HISTORY.txt | 4 +++- eea/forms/version.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index 91237fb..a1c7228 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -1,6 +1,9 @@ Changelog ========= +7.6-dev0 - (unreleased) +--------------------- + 7.5 - (2018-09-07) --------------------- * Bugfix: Fixed size of the prev/next wizard buttons on edit @@ -236,4 +239,3 @@ Changelog [szabozo0] * Move ManagementPlan form & widget from eea.dataservice [szabozo0] - diff --git a/eea/forms/version.txt b/eea/forms/version.txt index c382960..6a1672f 100644 --- a/eea/forms/version.txt +++ b/eea/forms/version.txt @@ -1 +1 @@ -7.5 +7.6-dev0 From b975594b2da2acdb9ca24f2b580104e8dac8bac4 Mon Sep 17 00:00:00 2001 From: valentinab25 Date: Fri, 21 Dec 2018 15:56:14 +0200 Subject: [PATCH 02/10] Added sonarqube scan to jenkins - Refs #100845 --- Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 483a045..7b7299d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,6 +11,21 @@ pipeline { steps { parallel( + "SonarQube analysis": { + node(label: 'swarm'){ + script{ + if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME == "master") { + checkout scm + def scannerHome = tool 'SonarQubeScanner'; + def nodeJS = tool 'NodeJS11'; + withSonarQubeEnv('Sonarqube') { + sh "${scannerHome}/bin/sonar-scanner -Dsonar.nodejs.executable=${nodeJS}/bin/node -Dsonar.sources=./eea -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER" + } + } + } + } + }, + "ZPT Lint": { node(label: 'docker') { sh '''docker run -i --rm --name="$BUILD_TAG-zptlint" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:4 zptlint''' From 37260f3dc3f24c2fc4cf40e58f37eba7365190f0 Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Fri, 11 Jan 2019 18:15:54 +0200 Subject: [PATCH 03/10] Refs #100694 - Jenkins - Add SonarQube reporting --- Jenkinsfile | 149 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 86 insertions(+), 63 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7b7299d..61c17a8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,130 +7,153 @@ pipeline { stages { - stage('Code') { + stage('Cosmetics') { steps { parallel( - "SonarQube analysis": { - node(label: 'swarm'){ - script{ - if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME == "master") { - checkout scm - def scannerHome = tool 'SonarQubeScanner'; - def nodeJS = tool 'NodeJS11'; - withSonarQubeEnv('Sonarqube') { - sh "${scannerHome}/bin/sonar-scanner -Dsonar.nodejs.executable=${nodeJS}/bin/node -Dsonar.sources=./eea -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER" - } + "JS Hint": { + node(label: 'docker') { + script { + try { + sh '''docker run -i --rm --name="$BUILD_TAG-jshint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/jshint''' + } catch (err) { + echo "Unstable: ${err}" } } - } - }, - - "ZPT Lint": { - node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-zptlint" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:4 zptlint''' } }, - "JS Lint": { + "CSS Lint": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-jslint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/jslint4java''' + script { + try { + sh '''docker run -i --rm --name="$BUILD_TAG-csslint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/csslint''' + } catch (err) { + echo "Unstable: ${err}" + } + } } }, - "PyFlakes": { + "PEP8": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-pyflakes" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pyflakes''' + script { + try { + sh '''docker run -i --rm --name="$BUILD_TAG-pep8" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pep8''' + } catch (err) { + echo "Unstable: ${err}" + } + } } }, - "i18n": { + "PyLint": { node(label: 'docker') { - sh '''docker run -i --rm --name=$BUILD_TAG-i18n -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/i18ndude''' + script { + try { + sh '''docker run -i --rm --name="$BUILD_TAG-pylint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pylint''' + } catch (err) { + echo "Unstable: ${err}" + } + } } } + ) } } - stage('Tests') { + stage('Code') { steps { parallel( - "WWW": { + "ZPT Lint": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-www" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/www-devel /debug.sh bin/test -v -vv -s $GIT_NAME''' + sh '''docker run -i --rm --name="$BUILD_TAG-zptlint" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:4 zptlint''' } }, - "KGS": { + "JS Lint": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-kgs" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/kgs-devel /debug.sh bin/test --test-path /plone/instance/src/$GIT_NAME -v -vv -s $GIT_NAME''' + sh '''docker run -i --rm --name="$BUILD_TAG-jslint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/jslint4java''' } }, - "Plone4": { + "PyFlakes": { node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-plone4" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:4 -v -vv -s $GIT_NAME''' + sh '''docker run -i --rm --name="$BUILD_TAG-pyflakes" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pyflakes''' + } + }, + + "i18n": { + node(label: 'docker') { + sh '''docker run -i --rm --name=$BUILD_TAG-i18n -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/i18ndude''' } } ) } } - stage('Cosmetics') { + stage('Tests') { steps { parallel( - "JS Hint": { + "WWW": { node(label: 'docker') { script { try { - sh '''docker run -i --rm --name="$BUILD_TAG-jshint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/jshint''' - } catch (err) { - echo "Unstable: ${err}" + sh '''docker run -i --name="$BUILD_TAG-www" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/www-devel /debug.sh coverage''' + sh '''mkdir -p xunit-reports; docker cp $BUILD_TAG-www:/plone/instance/parts/xmltestreport/testreports/. xunit-reports/''' + stash name: "xunit-reports", includes: "xunit-reports/*.xml" + sh '''mkdir -p xunit-coverage; docker cp $BUILD_TAG-www:/plone/instance/src/$GIT_NAME/coverage.xml xunit-coverage/coverage.xml''' + stash name: "xunit-coverage", includes: "xunit-coverage/*.xml" + } finally { + sh '''docker rm -v $BUILD_TAG-www''' } + junit 'xunit-reports/*.xml' } } }, - "CSS Lint": { + "KGS": { node(label: 'docker') { - script { - try { - sh '''docker run -i --rm --name="$BUILD_TAG-csslint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/csslint''' - } catch (err) { - echo "Unstable: ${err}" - } - } + sh '''docker run -i --rm --name="$BUILD_TAG-kgs" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/kgs-devel /debug.sh bin/test --test-path /plone/instance/src/$GIT_NAME -v -vv -s $GIT_NAME''' } }, - "PEP8": { + "Plone4": { node(label: 'docker') { - script { - try { - sh '''docker run -i --rm --name="$BUILD_TAG-pep8" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pep8''' - } catch (err) { - echo "Unstable: ${err}" - } - } + sh '''docker run -i --rm --name="$BUILD_TAG-plone4" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:4 -v -vv -s $GIT_NAME''' } - }, + } + ) + } + } - "PyLint": { - node(label: 'docker') { - script { - try { - sh '''docker run -i --rm --name="$BUILD_TAG-pylint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pylint''' - } catch (err) { - echo "Unstable: ${err}" - } - } + stage('Report') { + when { + allOf { + environment name: 'CHANGE_ID', value: '' + } + } + steps { + node(label: 'docker') { + script{ + checkout scm + dir("xunit-reports") { + unstash "xunit-reports" + } + dir('xunit-coverage') { + unstash "xunit-coverage" + } + def scannerHome = tool 'SonarQubeScanner'; + def nodeJS = tool 'NodeJS11'; + withSonarQubeEnv('Sonarqube') { + sh '''sed -i "s|/plone/instance/src/$GIT_NAME|$(pwd)|g" xunit-coverage/coverage.xml''' + sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.python.xunit.skipDetails=true -Dsonar.python.xunit.reportPath=xunit-reports/*.xml -Dsonar.python.coverage.reportPath=xunit-coverage/coverage.xml -Dsonar.sources=./eea -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER" } } - - ) + } } } From f21370125bbe2cb13fa5e80280ea38b831c84aa9 Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Mon, 14 Jan 2019 18:02:25 +0200 Subject: [PATCH 04/10] Jenkins fix coverage.xml --- Jenkinsfile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 61c17a8..83d3d5c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -105,8 +105,8 @@ pipeline { sh '''docker run -i --name="$BUILD_TAG-www" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/www-devel /debug.sh coverage''' sh '''mkdir -p xunit-reports; docker cp $BUILD_TAG-www:/plone/instance/parts/xmltestreport/testreports/. xunit-reports/''' stash name: "xunit-reports", includes: "xunit-reports/*.xml" - sh '''mkdir -p xunit-coverage; docker cp $BUILD_TAG-www:/plone/instance/src/$GIT_NAME/coverage.xml xunit-coverage/coverage.xml''' - stash name: "xunit-coverage", includes: "xunit-coverage/*.xml" + sh '''docker cp $BUILD_TAG-www:/plone/instance/src/$GIT_NAME/coverage.xml coverage.xml''' + stash name: "coverage.xml", includes: "coverage.xml" } finally { sh '''docker rm -v $BUILD_TAG-www''' } @@ -143,14 +143,12 @@ pipeline { dir("xunit-reports") { unstash "xunit-reports" } - dir('xunit-coverage') { - unstash "xunit-coverage" - } + unstash "coverage.xml" def scannerHome = tool 'SonarQubeScanner'; def nodeJS = tool 'NodeJS11'; withSonarQubeEnv('Sonarqube') { - sh '''sed -i "s|/plone/instance/src/$GIT_NAME|$(pwd)|g" xunit-coverage/coverage.xml''' - sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.python.xunit.skipDetails=true -Dsonar.python.xunit.reportPath=xunit-reports/*.xml -Dsonar.python.coverage.reportPath=xunit-coverage/coverage.xml -Dsonar.sources=./eea -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER" + sh '''sed -i "s|/plone/instance/src/$GIT_NAME|$(pwd)|g" coverage.xml''' + sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.python.xunit.skipDetails=true -Dsonar.python.xunit.reportPath=xunit-reports/*.xml -Dsonar.python.coverage.reportPath=coverage.xml -Dsonar.sources=./eea -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER" } } } @@ -213,7 +211,7 @@ pipeline { } else if (status == 'FAILURE') { color = '#FF0000' } - slackSend (color: color, message: summary) + emailext (subject: '$DEFAULT_SUBJECT', to: '$DEFAULT_RECIPIENTS', body: details) } } From ec1fc4dbc072fb485778a999830f0caa2f987d91 Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Mon, 21 Jan 2019 11:05:57 +0200 Subject: [PATCH 05/10] Refs #101552 - Add SonarQube to step title --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 83d3d5c..6903140 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -130,14 +130,14 @@ pipeline { } } - stage('Report') { + stage('Report to Sonarqube') { when { allOf { environment name: 'CHANGE_ID', value: '' } } steps { - node(label: 'docker') { + node(label: 'swarm') { script{ checkout scm dir("xunit-reports") { From 53487e1e9bbb3097ea1fad4de481bd4face54a76 Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Mon, 21 Jan 2019 13:00:44 +0200 Subject: [PATCH 06/10] Trigger new build --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6903140..0e625d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -130,7 +130,7 @@ pipeline { } } - stage('Report to Sonarqube') { + stage('Report to SonarQube') { when { allOf { environment name: 'CHANGE_ID', value: '' From 4023f95e5982c1ac107a2d5eff4b3e5430571b30 Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Tue, 22 Jan 2019 12:34:43 +0200 Subject: [PATCH 07/10] Refs #101552 - Jenkins add SonarQube tags --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 0e625d9..0dcf888 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,6 +3,7 @@ pipeline { environment { GIT_NAME = "eea.forms" + SONARQUBE_TAGS = "www.eea.europa.eu" } stages { @@ -149,6 +150,7 @@ pipeline { withSonarQubeEnv('Sonarqube') { sh '''sed -i "s|/plone/instance/src/$GIT_NAME|$(pwd)|g" coverage.xml''' sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.python.xunit.skipDetails=true -Dsonar.python.xunit.reportPath=xunit-reports/*.xml -Dsonar.python.coverage.reportPath=coverage.xml -Dsonar.sources=./eea -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER" + sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done''' } } } From a41dc1cdff997f9ad1b5b8cedc31f99144f1d7cb Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Mon, 28 Jan 2019 17:36:26 +0200 Subject: [PATCH 08/10] Updated version to 7.6 --- eea/forms/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eea/forms/version.txt b/eea/forms/version.txt index 6a1672f..38abeb2 100644 --- a/eea/forms/version.txt +++ b/eea/forms/version.txt @@ -1 +1 @@ -7.6-dev0 +7.6 From bad41be767836ddb610cecec1ecf97ba0be0bb7a Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Mon, 28 Jan 2019 18:33:52 +0200 Subject: [PATCH 09/10] Updated changelog - removed develop information --- docs/HISTORY.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index a1c7228..5732c01 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -1,7 +1,7 @@ Changelog ========= -7.6-dev0 - (unreleased) +7.6 - (2019-01-28) --------------------- 7.5 - (2018-09-07) From f73fee2ffd03b4cf837c2d79d097969cf05406e6 Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Tue, 29 Jan 2019 12:33:40 +0200 Subject: [PATCH 10/10] Refs #101552 - Update history --- docs/HISTORY.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index 5732c01..1492413 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -3,6 +3,8 @@ Changelog 7.6 - (2019-01-28) --------------------- +* Jenkins: Add sonarqube step + [avoinea refs #101552] 7.5 - (2018-09-07) ---------------------