Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow digits in role_id filtering #9

Merged
merged 6 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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