Skip to content

Commit

Permalink
Merge pull request #9 from eea/develop
Browse files Browse the repository at this point in the history
Allow digits in role_id filtering
  • Loading branch information
valipod committed Nov 22, 2021
2 parents e3419a7 + b78adb3 commit 8b9a37d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
24 changes: 20 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,24 @@ pipeline {

"PloneSaaS": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-plonesaas" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plonesaas-devel /debug.sh bin/test --test-path /plone/instance/src/$GIT_NAME -v -vv -s $GIT_NAME'''
script {
try {
sh '''docker pull eeacms/plonesaas-devel; docker run -i --name="$BUILD_TAG-plonesaas" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plonesaas-devel /debug.sh coverage'''
sh '''mkdir -p xunit-reports; docker cp $BUILD_TAG-plonesaas:/plone/instance/parts/xmltestreport/testreports/. xunit-reports/'''
stash name: "xunit-reports", includes: "xunit-reports/*.xml"
sh '''docker cp $BUILD_TAG-plonesaas:/plone/instance/src/$GIT_NAME/coverage.xml coverage.xml'''
stash name: "coverage.xml", includes: "coverage.xml"
} finally {
sh '''docker rm -v $BUILD_TAG-plonesaas'''
}
junit 'xunit-reports/*.xml'
}
}
}
},
)
}
}


stage('Report to SonarQube') {
when {
allOf {
Expand All @@ -105,17 +115,23 @@ pipeline {
node(label: 'swarm') {
script{
checkout scm
dir("xunit-reports") {
unstash "xunit-reports"
}
unstash "coverage.xml"
def scannerHome = tool 'SonarQubeScanner';
def nodeJS = tool 'NodeJS11';
withSonarQubeEnv('Sonarqube') {
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 '''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.reportPaths=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'''
}
}
}
}
}


stage('Pull Request') {
when {
not {
Expand Down
5 changes: 5 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

2.7 - (2021-11-22)
---------------------------
* allow digits in role_id filtering
[valipod]

2.6 - (2021-04-08)
---------------------------
* add email validation (replacing validate_email package) [dumitval]
Expand Down
2 changes: 1 addition & 1 deletion eea/usersdb/db_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def filter_roles(
pattern = pattern.lower()

for ch in pattern:
if ch not in ascii_lowercase + '-*':
if ch not in ascii_lowercase + digits + '-*':
return set()

if not pattern:
Expand Down
2 changes: 1 addition & 1 deletion eea/usersdb/tests/test_db_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import unittest
from copy import deepcopy

from mock import Mock
import six
from six.moves import map
from mock import Mock
import ldap
from eea.usersdb import db_agent
from eea.usersdb.tests.mock_recorder import Recorder
Expand Down
2 changes: 1 addition & 1 deletion eea/usersdb/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6
2.7

0 comments on commit 8b9a37d

Please sign in to comment.