Skip to content

Commit

Permalink
PBM move reports to zephyr cloud (#2591)
Browse files Browse the repository at this point in the history
  • Loading branch information
olexandr-havryliak authored Apr 4, 2024
1 parent 1e0d32b commit 17bd828
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
16 changes: 3 additions & 13 deletions pbm/pbm-functional-tests-full.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ pipeline {
string(name: 'PBM_BRANCH', defaultValue: 'main', description: 'PBM branch or commit')
string(name: 'GO_VER', defaultValue: 'bullseye', description: 'GOLANG docker image for building PBM from sources')
choice(name: 'instance', choices: ['docker-64gb','docker-64gb-aarch64'], description: 'Ec2 instance type for running tests')
choice(name: 'JIRA_REPORT', choices: ['no','yes'], description: 'Send report to jira')
string(name: 'TEST_CYCLE_NAME', defaultValue: 'test', description: 'Jira test cycle name')
string(name: 'TESTING_BRANCH', defaultValue: 'main', description: 'psmdb-testing repo branch')
}
stages {
Expand Down Expand Up @@ -44,7 +42,7 @@ pipeline {
stages {
stage ('Run tests') {
steps {
withCredentials([usernamePassword(credentialsId: 'JIRA_CREDENTIALS', passwordVariable: 'JIRA_PASSWORD', usernameVariable: 'JIRA_USERNAME')]) {
withCredentials([string(credentialsId: 'olexandr_zephyr_token', variable: 'ZEPHYR_TOKEN')]) {
sh """
docker kill \$(docker ps -a -q) || true
docker rm \$(docker ps -a -q) || true
Expand All @@ -64,17 +62,9 @@ pipeline {
cd pbm-functional/pytest
PSMDB=percona/percona-server-mongodb:${PSMDB}-multi docker-compose build
docker-compose up -d
if [ ${params.JIRA_REPORT} = "yes" ]; then
export JIRA_SERVER=https://jira.percona.com
export JIRA_USERNAME=${JIRA_USERNAME}
export JIRA_PASSWORD=${JIRA_PASSWORD}
echo "test_cycle_name=${params.TEST_CYCLE_NAME} - PSMDB${PSMDB}" >> pytest.ini
echo "test_environment=${PSMDB}" >> pytest.ini
docker-compose run test pytest --adaptavist -s --junitxml=junit.xml -k ${TEST} || true
else
docker-compose run test pytest -s --junitxml=junit.xml -k ${TEST} || true
fi
docker-compose run test pytest -s --junitxml=junit.xml -k ${TEST} || true
docker-compose down -v --remove-orphans
curl -H "Content-Type:multipart/form-data" -H "Authorization: Bearer ${ZEPHYR_TOKEN}" -F "[email protected];type=application/xml" 'https://api.zephyrscale.smartbear.com/v2/automations/executions/junit?projectKey=PBM' -F 'testCycle={"name":"${JOB_NAME}-${BUILD_NUMBER}","customFields": { "PBM branch": "${PBM_BRANCH}","PSMDB docker image": "percona/percona-server-mongodb:${PSMDB}-multi","instance": "${instance}"}};type=application/json' -i || true
"""
}
}
Expand Down
15 changes: 3 additions & 12 deletions pbm/pbm-functional-tests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ pipeline {
string(name: 'PSMDB', defaultValue: 'percona/percona-server-mongodb', description: 'PSMDB docker image')
string(name: 'GO_VER', defaultValue: 'bullseye', description: 'GOLANG docker image for building PBM from sources')
choice(name: 'instance', choices: ['docker-64gb','docker-64gb-aarch64'], description: 'Ec2 instance type for running tests')
choice(name: 'JIRA_REPORT', choices: ['no','yes'], description: 'Send report to jira')
string(name: 'TEST_CYCLE_NAME', defaultValue: 'test', description: 'Jira test cycle name')
string(name: 'TESTING_BRANCH', defaultValue: 'main', description: 'psmdb-testing repo branch')
}
stages {
Expand All @@ -41,7 +39,7 @@ pipeline {
stages {
stage ('Run tests') {
steps {
withCredentials([usernamePassword(credentialsId: 'JIRA_CREDENTIALS', passwordVariable: 'JIRA_PASSWORD', usernameVariable: 'JIRA_USERNAME')]) {
withCredentials([string(credentialsId: 'olexandr_zephyr_token', variable: 'ZEPHYR_TOKEN')]) {
sh """
docker kill \$(docker ps -a -q) || true
docker rm \$(docker ps -a -q) || true
Expand All @@ -61,16 +59,9 @@ pipeline {
cd pbm-functional/pytest
docker-compose build
docker-compose up -d
if [ ${params.JIRA_REPORT} = "yes" ]; then
export JIRA_SERVER=https://jira.percona.com
export JIRA_USERNAME=${JIRA_USERNAME}
export JIRA_PASSWORD=${JIRA_PASSWORD}
echo "test_cycle_name=${params.TEST_CYCLE_NAME}" >> pytest.ini
docker-compose run test pytest --adaptavist -s --junitxml=junit.xml -k ${TEST} || true
else
docker-compose run test pytest -s --junitxml=junit.xml -k ${TEST} || true
fi
docker-compose run test pytest -s --junitxml=junit.xml -k ${TEST} || true
docker-compose down -v --remove-orphans
curl -H "Content-Type:multipart/form-data" -H "Authorization: Bearer ${ZEPHYR_TOKEN}" -F "[email protected];type=application/xml" 'https://api.zephyrscale.smartbear.com/v2/automations/executions/junit?projectKey=PBM' -F 'testCycle={"name":"${JOB_NAME}-${BUILD_NUMBER}","customFields": { "PBM branch": "${PBM_BRANCH}","PSMDB docker image": "${PSMDB}","instance": "${instance}"}};type=application/json' -i || true
"""
}
}
Expand Down

0 comments on commit 17bd828

Please sign in to comment.