Skip to content

Commit

Permalink
ci: add ci build link in the qase test run description
Browse files Browse the repository at this point in the history
Signed-off-by: Yang Chiu <yang.chiu@suse.com>
  • Loading branch information
yangchiu authored and khushboo-rancher committed Sep 11, 2024
1 parent fc2c2f2 commit 320d373
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pipelines/e2e/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ node {
summary = robot outputPath: '.'

if(JOB_BASE_NAME != "longhorn-e2e-test") {
sh "docker exec ${JOB_BASE_NAME}-${BUILD_NUMBER} pipelines/utilities/junit_to_qase.py junit.xml"
sh "docker exec ${JOB_BASE_NAME}-${BUILD_NUMBER} pipelines/utilities/junit_to_qase.py junit.xml ${BUILD_URL}"
}
}

Expand Down
8 changes: 5 additions & 3 deletions pipelines/utilities/junit_to_qase.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,16 @@ def get_test_cases_id_and_add_missing_test_cases(test_results):
result["case_id"] = add_missing_case(result["case"], result["suite_id"])


def create_test_run(job_name, test_results):
def create_test_run(job_name, test_results, build_url):

test_cases_id = []
for result in test_results:
test_cases_id.append(result["case_id"])

payload = {
"cases": test_cases_id,
"title": job_name
"title": job_name,
"description": build_url
}
headers = {
"accept": "application/json",
Expand Down Expand Up @@ -230,6 +231,7 @@ def complete_test_run(test_run_id):
raise Exception("Report filename not provided")
else:
report_filename = sys.argv[1]
build_url = sys.argv[2]

with open(report_filename, 'r') as f:
file = f.read()
Expand Down Expand Up @@ -264,7 +266,7 @@ def complete_test_run(test_run_id):
# create test run
today = date.today()
job_name = f"{os.getenv('JOB_NAME', 'longhorn-regression-test')}-{today}"
test_run_id = create_test_run(job_name, test_results)
test_run_id = create_test_run(job_name, test_results, build_url)
print(f"test_run_id = {test_run_id}")

# update test results to test run
Expand Down
2 changes: 1 addition & 1 deletion test_framework/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ node {
}

if(JOB_BASE_NAME != "longhorn-tests-regression") {
sh "docker exec ${JOB_BASE_NAME}-${BUILD_NUMBER} pipelines/utilities/junit_to_qase.py ${TF_VAR_tf_workspace}/longhorn-test-junit-report.xml"
sh "docker exec ${JOB_BASE_NAME}-${BUILD_NUMBER} pipelines/utilities/junit_to_qase.py ${TF_VAR_tf_workspace}/longhorn-test-junit-report.xml ${BUILD_URL}"
}

if(LONGHORN_INSTALL_METHOD == "custom") {
Expand Down

0 comments on commit 320d373

Please sign in to comment.