From a77897087ad6f13b6adc3a3242982a9d02a3de15 Mon Sep 17 00:00:00 2001 From: Miu Razvan Date: Tue, 26 Jul 2022 14:10:06 +0300 Subject: [PATCH 1/5] Rerun tests --- Jenkinsfile | 174 ++++++++++++++++++++++++++-------------------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 895be74c..b6eb9906 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -108,93 +108,93 @@ pipeline { } } - // stage('Integration tests') { - // when { - // allOf { - // environment name: 'CHANGE_ID', value: '' - // anyOf { - // not { changelog '.*^Automated release [0-9\\.]+$' } - // branch 'master' - // } - // } - // } - // steps { - // parallel( - - // "Cypress": { - // node(label: 'docker') { - // script { - // try { - // sh '''docker pull eeacms/plone-backend; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend''' - // sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=development -e VOLTO="$VOLTO" plone/volto-addon-ci cypress''' - // } finally { - // try { - // sh '''rm -rf cypress-reports cypress-results cypress-coverage''' - // sh '''mkdir -p cypress-reports cypress-results cypress-coverage''' - // sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/''' - // sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/''' - // coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true - // if ( coverage == 0 ) { - // publishHTML (target : [allowMissing: false, - // alwaysLinkToLastBuild: true, - // keepAll: true, - // reportDir: 'cypress-coverage/coverage/lcov-report', - // reportFiles: 'index.html', - // reportName: 'CypressCoverage', - // reportTitles: 'Integration Tests Code Coverage']) - // } - // sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done''' - // archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true - // stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true - // } - // finally { - // catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { - // junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true - // } - // sh script: "docker stop $BUILD_TAG-plone", returnStatus: true - // sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true - // sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true - - // } - // } - // } - // } - // } - - // ) - // } - // } - - // stage('Report to SonarQube') { - // when { - // allOf { - // environment name: 'CHANGE_ID', value: '' - // anyOf { - // branch 'master' - // allOf { - // branch 'develop' - // not { changelog '.*^Automated release [0-9\\.]+$' } - // } - // } - // } - // } - // steps { - // node(label: 'swarm') { - // script{ - // checkout scm - // unstash "xunit-reports" - // unstash "cypress-coverage" - // def scannerHome = tool 'SonarQubeScanner'; - // def nodeJS = tool 'NodeJS'; - // withSonarQubeEnv('Sonarqube') { - // sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info''' - // sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -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''' - // } - // } - // } - // } - // } + stage('Integration tests') { + when { + allOf { + environment name: 'CHANGE_ID', value: '' + anyOf { + not { changelog '.*^Automated release [0-9\\.]+$' } + branch 'master' + } + } + } + steps { + parallel( + + "Cypress": { + node(label: 'docker') { + script { + try { + sh '''docker pull eeacms/plone-backend; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend''' + sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=development -e VOLTO="$VOLTO" plone/volto-addon-ci cypress''' + } finally { + try { + sh '''rm -rf cypress-reports cypress-results cypress-coverage''' + sh '''mkdir -p cypress-reports cypress-results cypress-coverage''' + sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/''' + sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/''' + coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true + if ( coverage == 0 ) { + publishHTML (target : [allowMissing: false, + alwaysLinkToLastBuild: true, + keepAll: true, + reportDir: 'cypress-coverage/coverage/lcov-report', + reportFiles: 'index.html', + reportName: 'CypressCoverage', + reportTitles: 'Integration Tests Code Coverage']) + } + sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done''' + archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true + stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true + } + finally { + catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { + junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true + } + sh script: "docker stop $BUILD_TAG-plone", returnStatus: true + sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true + sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true + + } + } + } + } + } + + ) + } + } + + stage('Report to SonarQube') { + when { + allOf { + environment name: 'CHANGE_ID', value: '' + anyOf { + branch 'master' + allOf { + branch 'develop' + not { changelog '.*^Automated release [0-9\\.]+$' } + } + } + } + } + steps { + node(label: 'swarm') { + script{ + checkout scm + unstash "xunit-reports" + unstash "cypress-coverage" + def scannerHome = tool 'SonarQubeScanner'; + def nodeJS = tool 'NodeJS'; + withSonarQubeEnv('Sonarqube') { + sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info''' + sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -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''' + } + } + } + } + } stage('Pull Request') { when { From 4529574b20232084cb5dea432f2a3ed60a25ddee Mon Sep 17 00:00:00 2001 From: Miu Razvan Date: Tue, 26 Jul 2022 14:37:46 +0300 Subject: [PATCH 2/5] Use volto@16.0.0-alpha.14 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b6eb9906..68dfe6d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { NAMESPACE = "@eeacms" SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,biodiversity.europa.eu,water.europa.eu-freshwater" DEPENDENCIES = "@eeacms/volto-embed" - VOLTO = "alpha" + VOLTO = "16.0.0-alpha.14" } stages { From 88a873558984eddf49fb62d91bb46b46c303108b Mon Sep 17 00:00:00 2001 From: EEA Jenkins <@users.noreply.github.com> Date: Tue, 26 Jul 2022 11:47:52 +0000 Subject: [PATCH 3/5] Automated release 3.0.16 --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ac84576..2838d73c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [3.0.16](https://github.com/eea/volto-datablocks/compare/3.0.15...3.0.16) + +- Use volto@16.0.0-alpha.14 [`4529574`](https://github.com/eea/volto-datablocks/commit/4529574b20232084cb5dea432f2a3ed60a25ddee) +- Rerun tests [`a778970`](https://github.com/eea/volto-datablocks/commit/a77897087ad6f13b6adc3a3242982a9d02a3de15) + #### [3.0.15](https://github.com/eea/volto-datablocks/compare/3.0.14...3.0.15) +> 25 July 2022 + +- Fix sources headers + replace @@download/file in csv connectors [`#55`](https://github.com/eea/volto-datablocks/pull/55) - Don't run cypress [`387820c`](https://github.com/eea/volto-datablocks/commit/387820ca4b62474e51bc8ed76939b5a222840c4a) - Update [`f201960`](https://github.com/eea/volto-datablocks/commit/f20196031459a358f77d67147fc7874333dfb799) - Fix connector for csv [`d97142f`](https://github.com/eea/volto-datablocks/commit/d97142fe6ce6ef8674504974f16491f056172c3c) diff --git a/package.json b/package.json index 7ee9e826..87f735c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eeacms/volto-datablocks", - "version": "3.0.15", + "version": "3.0.16", "description": "(EEA) Provides primitives for data connectivity to volto-plotlycharts and other blocks", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", From 2380c58c9fcf72e60144acee71af8e25c40aeb5f Mon Sep 17 00:00:00 2001 From: Miu Razvan Date: Mon, 22 Aug 2022 14:05:41 +0300 Subject: [PATCH 4/5] Allow extra conditions --- src/helpers.js | 9 ++++++++- src/hocs/connectToProviderData.js | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/helpers.js b/src/helpers.js index 6b9668ef..08fc0849 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -18,7 +18,13 @@ export function getProviderUrl(url) { .replace(/\/*$/, ''); } -export function getForm({ data = {}, location, pagination, extraQuery = {} }) { +export function getForm({ + data = {}, + location, + pagination, + extraQuery = {}, + extraConditions, +}) { const params = { ...(qs.parse(location?.search?.replace('?', '')) || {}), ...(data.form || {}), @@ -37,6 +43,7 @@ export function getForm({ data = {}, location, pagination, extraQuery = {} }) { return { ...(allowedParamsObj || params), + ...(extraConditions ? { extra_conditions: extraConditions } : {}), ...(pagination?.enabled ? { p: pagination.activePage, nrOfHits: pagination.itemsPerPage } : {}), diff --git a/src/hocs/connectToProviderData.js b/src/hocs/connectToProviderData.js index a7c5d0c4..aab62cc6 100644 --- a/src/hocs/connectToProviderData.js +++ b/src/hocs/connectToProviderData.js @@ -65,8 +65,9 @@ export function connectToProviderData(getConfig = () => ({})) { ...props, pagination, extraQuery: state.extraQuery, + extraConditions: state.extraConditions, }), - [props, pagination, state.extraQuery], + [props, pagination, state.extraQuery, state.extraConditions], ); const data_query = useMemo( () => getDataQuery({ ...props, params, pagination, provider_url }), From 3f7588cf616da6710e964851bd76b7ddc57b04d5 Mon Sep 17 00:00:00 2001 From: EEA Jenkins <@users.noreply.github.com> Date: Mon, 22 Aug 2022 11:16:03 +0000 Subject: [PATCH 5/5] Automated release 3.0.16 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2838d73c..61faffec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). #### [3.0.16](https://github.com/eea/volto-datablocks/compare/3.0.15...3.0.16) +- Allow extra conditions [`2380c58`](https://github.com/eea/volto-datablocks/commit/2380c58c9fcf72e60144acee71af8e25c40aeb5f) - Use volto@16.0.0-alpha.14 [`4529574`](https://github.com/eea/volto-datablocks/commit/4529574b20232084cb5dea432f2a3ed60a25ddee) - Rerun tests [`a778970`](https://github.com/eea/volto-datablocks/commit/a77897087ad6f13b6adc3a3242982a9d02a3de15)