diff --git a/packit_service/worker/helpers/testing_farm.py b/packit_service/worker/helpers/testing_farm.py index 590da91a2..3517a7f0f 100644 --- a/packit_service/worker/helpers/testing_farm.py +++ b/packit_service/worker/helpers/testing_farm.py @@ -10,8 +10,8 @@ from ogr.abstract import GitProject, PullRequest from ogr.utils import RequestResponse from packit.config import JobConfig, PackageConfig -from packit.exceptions import PackitConfigException, PackitException -from packit.utils import commands, nested_get +from packit.exceptions import PackitConfigException +from packit.utils import nested_get from packit.utils.koji_helper import KojiHelper from packit_service.config import Deployment, ServiceConfig @@ -1525,49 +1525,15 @@ def prepare_and_send_tf_request( ) def _payload_installability(self, distro: str, compose: str) -> dict: git_repo = "https://github.com/fedora-ci/installability-pipeline.git" - git_ref = ( - commands.run_command(["git", "ls-remote", git_repo, "HEAD"], output=True) - .stdout.strip() - .split()[0] - ) - - if distro == "fedora-rawhide": - # profile names are in "fedora-N" format - # extract current rawhide version number from its candidate tag - if not (candidate_tag := self.koji_helper.get_candidate_tag("rawhide")): - raise PackitException(f"Failed to get test profile for {distro}") - profile = re.sub(r"f(\d+)(-.*)?", r"fedora-\1", candidate_tag) - else: - profile = distro - - # installability test requires a Koji build - # (it should be guaranteed by the `HasEventSuccessfulScratchBuild` checker) - assert self.koji_build - - return { - "test": { - "tmt": { - "url": git_repo, - "ref": git_ref, - }, - }, - "environments": [ - { - "arch": "x86_64", - "os": {"compose": compose}, - "variables": { - "PROFILE_NAME": profile, - "TASK_ID": self.koji_build.task_id, - }, - }, - ], - "notification": { - "webhook": { - "url": f"{self.api_url}/testing-farm/results", - "token": self.service_config.testing_farm_secret, - }, + git_ref = "master" + payload = self._get_tf_base_payload(distro, compose) + payload["test"] = { + "tmt": { + "url": git_repo, + "ref": git_ref, }, } + return payload @implements_fedora_ci_test( "rpminspect", diff --git a/tests/integration/test_listen_to_fedmsg.py b/tests/integration/test_listen_to_fedmsg.py index 7574cd7e5..395f9f874 100644 --- a/tests/integration/test_listen_to_fedmsg.py +++ b/tests/integration/test_listen_to_fedmsg.py @@ -26,6 +26,7 @@ from packit.config.requirements import LabelRequirementsConfig, RequirementsConfig from packit.copr_helper import CoprHelper from packit.local_project import LocalProject, LocalProjectBuilder +from packit.utils import commands from packit.utils.koji_helper import KojiHelper import packit_service.service.urls as urls @@ -65,7 +66,6 @@ from packit_service.worker.helpers.testing_farm import ( TestingFarmClient, TestingFarmJobHelper, - commands, ) from packit_service.worker.jobs import SteveJobs from packit_service.worker.monitoring import Pushgateway @@ -2676,40 +2676,6 @@ def test_koji_build_end_downstream( koji_build_pr_downstream.should_receive("set_status").with_args("success").once() koji_build_pr_downstream.should_receive("set_build_logs_urls") koji_build_pr_downstream.should_receive("set_web_url") - - installability_repo = "https://github.com/fedora-ci/installability-pipeline.git" - installability_hash = "f6cd4a50476d9c8ffa36472c5ab2d2c8aad6cee1" - - flexmock(commands).should_receive("run_command").with_args( - ["git", "ls-remote", installability_repo, "HEAD"], output=True - ).and_return(flexmock(stdout=f"{installability_hash}\tHEAD")) - - payload_installability = { - "test": { - "tmt": { - "url": installability_repo, - "ref": installability_hash, - }, - }, - "environments": [ - { - "arch": "x86_64", - "os": {"compose": compose}, - "variables": { - "PROFILE_NAME": profile, - "TASK_ID": "1", - }, - }, - ], - "notification": { - "webhook": { - "url": "https://stg.packit.dev/api/testing-farm/results", - "token": "secret token", - }, - }, - } - - rpminspect_repo = "https://github.com/fedora-ci/rpminspect-pipeline.git" common_payload_no_compose = { "environments": [ { @@ -2743,6 +2709,20 @@ def test_koji_build_end_downstream( }, } + installability_repo = "https://github.com/fedora-ci/installability-pipeline.git" + payload_installability = { + "test": { + "tmt": { + "url": installability_repo, + "ref": "master", + }, + }, + **common_payload_no_compose, + } + payload_installability = copy.deepcopy(payload_installability) + payload_installability["environments"][0]["os"] = {"compose": compose} + + rpminspect_repo = "https://github.com/fedora-ci/rpminspect-pipeline.git" payload_rpminspect = { "test": { "tmt": { @@ -2839,10 +2819,6 @@ def test_koji_build_end_downstream( distro, ).and_return(compose) - flexmock(KojiHelper).should_receive("get_candidate_tag").with_args("rawhide").and_return( - "f43-updates-candidate" - ) - pipeline_id = "5e8079d8-f181-41cf-af96-28e99774eb68" flexmock(TestingFarmClient).should_receive( "send_testing_farm_request",