Skip to content

Commit f7a6984

Browse files
Expose the copr build-id to testing-farm (#2857)
Expose the copr build-id to testing-farm TODO: Write new tests or update the old ones to cover new functionality. Update or write new documentation in packit/packit.dev. Related to packit/packit.dev#1068 RELEASE NOTES BEGIN The copr build id is now exposed as PACKIT_COPR_BUILD_ID in the testing-farm tests. RELEASE NOTES END Reviewed-by: gemini-code-assist[bot] Reviewed-by: Nikola Forró Reviewed-by: Cristian Le <[email protected]> Reviewed-by: Matej Focko
2 parents 9c5db5c + d94f176 commit f7a6984

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

packit_service/worker/helpers/testing_farm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,9 @@ def _payload(
483483
else:
484484
nvr = None
485485
packit_copr_projects.append(f"{build.owner}/{build.project_name}")
486+
build_id = int(build.build_id)
486487
else:
487-
build_log_url = nvr = srpm_url = None
488+
build_log_url = nvr = srpm_url = build_id = None
488489

489490
if additional_build is not None:
490491
packit_copr_projects.append(
@@ -528,6 +529,7 @@ def _payload(
528529
"PACKIT_COPR_PROJECT": (
529530
" ".join(packit_copr_projects) if packit_copr_projects else None
530531
),
532+
"PACKIT_COPR_BUILD_ID": build_id,
531533
"PACKIT_COPR_RPMS": (" ".join(packit_copr_rpms) if packit_copr_rpms else None),
532534
}
533535
predefined_environment = {k: v for k, v in predefined_environment.items() if v is not None}

tests/integration/test_listen_to_fedmsg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ def test_copr_build_end_testing_farm(copr_build_end, copr_build_pr):
711711
"PACKIT_TARGET_URL": "https://github.com/target/bar",
712712
"PACKIT_PR_ID": 24,
713713
"PACKIT_COPR_PROJECT": "some-owner/some-project",
714+
"PACKIT_COPR_BUILD_ID": 1,
714715
"PACKIT_COPR_RPMS": "hello-world-0.1-1.noarch",
715716
},
716717
},

tests/integration/test_pr_comment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,6 +2146,7 @@ def test_pr_test_command_handler_multiple_builds(
21462146
"PACKIT_TARGET_URL": "https://github.com/packit-service/hello-world",
21472147
"PACKIT_PR_ID": 9,
21482148
"PACKIT_COPR_PROJECT": "mf/tree another-owner/another-repo",
2149+
"PACKIT_COPR_BUILD_ID": 123456,
21492150
"PACKIT_COPR_RPMS": "repo-0:0.1-1.noarch another-repo-0:0.1-1.noarch",
21502151
},
21512152
"artifacts": [

tests/unit/test_testing_farm.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,10 @@ def test_payload(
959959
# URLs shortened for clarity
960960
log_url = "https://copr-be.cloud.fedoraproject.org/results/.../builder-live.log"
961961
srpm_url = f"https://download.copr.fedorainfracloud.org/results/.../{repo}-0.1-1.src.rpm"
962+
copr_build_id = "42"
962963
copr_build = flexmock(
963-
id=build_id,
964+
id=int(build_id),
965+
build_id=copr_build_id,
964966
built_packages=[
965967
{
966968
"name": repo,
@@ -1022,6 +1024,7 @@ def test_payload(
10221024
"PACKIT_TARGET_URL": "https://github.com/packit/packit",
10231025
"PACKIT_PR_ID": 123,
10241026
"PACKIT_COPR_PROJECT": "builder/some_package",
1027+
"PACKIT_COPR_BUILD_ID": int(copr_build_id),
10251028
"MY_ENV_VARIABLE": "my-value",
10261029
},
10271030
},
@@ -1410,11 +1413,13 @@ def test_test_repo(
14101413
flexmock(TFClient).should_receive("distro2compose").and_return(compose)
14111414

14121415
build_id = 1
1416+
copr_build_id = "22"
14131417
# URLs shortened for clarity
14141418
log_url = "https://copr-be.cloud.fedoraproject.org/results/.../builder-live.log"
14151419
srpm_url = f"https://download.copr.fedorainfracloud.org/results/.../{repo}-0.1-1.src.rpm"
14161420
copr_build = flexmock(
14171421
id=build_id,
1422+
build_id=copr_build_id,
14181423
built_packages=[
14191424
{
14201425
"name": repo,

0 commit comments

Comments
 (0)