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

Remove deprecated code #2532

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
15 changes: 0 additions & 15 deletions packit_service/trigger_mapping.py

This file was deleted.

3 changes: 0 additions & 3 deletions packit_service/worker/handlers/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class ProposeDownstreamHandler(JobHandler):
E.g. CoprBuildHandler uses both copr_build and build:
```
@configured_as(job_type=JobType.copr_build)
@configured_as(job_type=JobType.build)
class CoprBuildHandler(JobHandler):
```
"""
Expand Down Expand Up @@ -122,7 +121,6 @@ def run_for_comment(command: str):
```
@configured_as(job_type=JobType.propose_downstream)
@run_for_comment(command="propose-downstream")
@run_for_comment(command="propose-update")
@reacts_to(event=ReleaseEvent)
@reacts_to(event=IssueCommentEvent)
class ProposeDownstreamHandler(JobHandler):
Expand All @@ -149,7 +147,6 @@ def run_for_check_rerun(prefix: str):
Example:
```
@configured_as(job_type=JobType.copr_build)
@configured_as(job_type=JobType.build)
@run_for_check_rerun(prefix="rpm-build")
@reacts_to(CheckRerunPullRequestEvent)
@reacts_to(CheckRerunCommitEvent)
Expand Down
5 changes: 1 addition & 4 deletions packit_service/worker/handlers/copr.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@


@configured_as(job_type=JobType.copr_build)
@configured_as(job_type=JobType.build)
@run_for_comment(command="build")
@run_for_comment(command="copr-build")
@run_for_comment(command="rebuild-failed")
Expand Down Expand Up @@ -151,7 +150,6 @@ def get_checkers() -> Tuple[Type[Checker], ...]:


@configured_as(job_type=JobType.copr_build)
@configured_as(job_type=JobType.build)
@reacts_to(event=CoprBuildStartEvent)
class CoprBuildStartHandler(AbstractCoprBuildReportHandler):
topic = "org.fedoraproject.prod.copr.build.start"
Expand Down Expand Up @@ -242,7 +240,6 @@ def run(self):


@configured_as(job_type=JobType.copr_build)
@configured_as(job_type=JobType.build)
@reacts_to(event=CoprBuildEndEvent)
class CoprBuildEndHandler(AbstractCoprBuildReportHandler):
topic = "org.fedoraproject.prod.copr.build.end"
Expand Down Expand Up @@ -613,7 +610,7 @@ def find_base_build_job(self) -> Optional[JobConfig]:

for job in self.copr_build_helper.package_config.get_job_views():
if (
job.type in (JobType.copr_build, JobType.build)
job.type == JobType.copr_build
and job.trigger == JobConfigTriggerType.commit
and (
(
Expand Down
2 changes: 0 additions & 2 deletions packit_service/worker/handlers/distgit.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ def sync_branch(
create_pr=True,
local_pr_branch_suffix=branch_suffix,
use_downstream_specfile=is_pull_from_upstream_job,
sync_default_files=not is_pull_from_upstream_job,
add_pr_instructions=True,
resolved_bugs=self.get_resolved_bugs(),
release_monitoring_project_id=self.data.event_dict.get(
Expand Down Expand Up @@ -540,7 +539,6 @@ class AbortSyncRelease(Exception):

@configured_as(job_type=JobType.propose_downstream)
@run_for_comment(command="propose-downstream")
@run_for_comment(command="propose-update") # deprecated
@run_for_check_rerun(prefix="propose-downstream")
@reacts_to(event=ReleaseEvent)
@reacts_to(event=ReleaseGitlabEvent)
Expand Down
4 changes: 0 additions & 4 deletions packit_service/worker/handlers/koji.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,8 @@
logger = logging.getLogger(__name__)


@configured_as(job_type=JobType.production_build)
@configured_as(job_type=JobType.upstream_koji_build)
@run_for_comment(command="production-build")
@run_for_comment(command="upstream-koji-build")
@run_for_check_rerun(prefix="production-build")
@run_for_check_rerun(prefix="koji-build")
@reacts_to(ReleaseEvent)
@reacts_to(ReleaseGitlabEvent)
Expand Down Expand Up @@ -127,7 +124,6 @@ def run(self) -> TaskResults:
return self.koji_build_helper.run_koji_build()


@configured_as(job_type=JobType.production_build)
@configured_as(job_type=JobType.upstream_koji_build)
@reacts_to(event=KojiTaskEvent)
class KojiTaskReportHandler(
Expand Down
15 changes: 8 additions & 7 deletions packit_service/worker/helpers/build/build_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
ProjectEventModel,
)
from packit_service.service.urls import get_srpm_build_info_url
from packit_service.trigger_mapping import are_job_types_same
from packit_service.worker.events import EventData
from packit_service.worker.helpers.job_helper import BaseJobHelper
from packit_service.worker.monitoring import Pushgateway
Expand Down Expand Up @@ -149,9 +148,10 @@ def job_build(self) -> Optional[JobConfig]:
return None
if not self._job_build:
for job in [self.job_config] + self.package_config.jobs:
if are_job_types_same(
job.type, self.job_type_build
) and self.is_job_config_trigger_matching(job):
if (
job.type == self.job_type_build
and self.is_job_config_trigger_matching(job)
):
self._job_build = job
break
return self._job_build
Expand All @@ -173,9 +173,10 @@ def job_tests_all(self) -> List[JobConfig]:

if not self._job_tests_all:
for job in self.package_config.jobs:
if are_job_types_same(
job.type, self.job_type_test
) and self.is_job_config_trigger_matching(job):
if (
job.type == self.job_type_test
and self.is_job_config_trigger_matching(job)
):
matching_jobs.append(job)
self._job_tests_all = matching_jobs

Expand Down
2 changes: 1 addition & 1 deletion packit_service/worker/helpers/build/koji_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


class KojiBuildJobHelper(BaseBuildJobHelper):
job_type_build = JobType.production_build
job_type_build = JobType.upstream_koji_build
job_type_test = None
status_name_build: str = "koji-build"
status_name_test: str = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from packit.config import aliases
from packit_service.config import ServiceConfig
from packit_service.models import ProjectEventModel
from packit_service.trigger_mapping import are_job_types_same
from packit_service.worker.events import EventData
from packit_service.worker.helpers.job_helper import BaseJobHelper

Expand Down Expand Up @@ -98,7 +97,7 @@ def job(self) -> Optional[JobConfig]:
"""
if not self._job:
for job in [self.job_config] + self.package_config.jobs:
if are_job_types_same(job.type, self.job_type) and (
if job.type == self.job_type and (
self._db_project_object
and (
self._db_project_object.job_config_trigger_type == job.trigger
Expand Down
14 changes: 0 additions & 14 deletions packit_service/worker/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@

from ogr.exceptions import GithubAppNotInstalledError
from packit.config import JobConfig, JobConfigView, JobType, JobConfigTriggerType
from packit.config.job_config import DEPRECATED_JOB_TYPES
from packit.utils import nested_get
from packit_service.config import PackageConfig, PackageConfigGetter, ServiceConfig
from packit_service.constants import (
DOCS_CONFIGURATION_URL,
TASK_ACCEPTED,
COMMENT_REACTION,
PACKIT_VERIFY_FAS_COMMAND,
Expand Down Expand Up @@ -565,18 +563,6 @@ def should_task_be_created_for_job_config_and_handler(
):
return False

if deprecation_msg := DEPRECATED_JOB_TYPES.get(job_config.type):
job_helper = self.initialize_job_helper(handler_kls, job_config)
job_helper.status_reporter.report(
state=BaseCommitStatus.error,
description=f"Job name `{job_config.type.name}` deprecated.",
url=f"{DOCS_CONFIGURATION_URL}/#supported-jobs",
check_names=f"config-deprecation-{job_config.type.name}",
markdown_content=f"{deprecation_msg}\n\n"
"The support for the old name will be removed "
"by the end of the year.",
)

return True

def is_project_public_or_enabled_private(self) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"created_at": "2019-08-08T15:22:24Z",
"updated_at": "2019-08-08T15:22:24Z",
"author_association": "NONE",
"body": "/packit production-build"
"body": "/packit upstream-koji-build"
},
"repository": {
"id": 184635124,
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_babysit.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def test_check_copr_build_updated(
PackageConfig(
jobs=[
JobConfig(
type=JobType.build,
type=JobType.copr_build,
trigger=JobConfigTriggerType.pull_request,
packages={"package": CommonPackageConfig()},
)
Expand Down Expand Up @@ -243,7 +243,7 @@ def test_check_copr_build_waiting_started(add_pull_request_event_with_sha_123456
PackageConfig(
jobs=[
JobConfig(
type=JobType.build,
type=JobType.copr_build,
trigger=JobConfigTriggerType.pull_request,
packages={"package": CommonPackageConfig()},
)
Expand Down Expand Up @@ -342,7 +342,7 @@ def test_check_copr_build_waiting_srpm_failed(add_pull_request_event_with_sha_12
PackageConfig(
jobs=[
JobConfig(
type=JobType.build,
type=JobType.copr_build,
trigger=JobConfigTriggerType.pull_request,
packages={"package": CommonPackageConfig()},
)
Expand Down Expand Up @@ -425,7 +425,7 @@ def test_check_copr_build_waiting_already_started(
PackageConfig(
jobs=[
JobConfig(
type=JobType.build,
type=JobType.copr_build,
trigger=JobConfigTriggerType.pull_request,
packages={"package": CommonPackageConfig()},
)
Expand Down
18 changes: 1 addition & 17 deletions tests/integration/test_check_rerun.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def test_check_rerun_pr_koji_build_handler(
[
{
"trigger": "pull_request",
"job": "production_build",
"job": "upstream_koji_build",
"metadata": {"targets": "fedora-all", "scratch": "true"},
}
]
Expand All @@ -404,22 +404,6 @@ def test_check_rerun_pr_koji_build_handler_old_job_name(
flexmock(koji_build).should_receive("get_koji_targets").and_return(
{"rawhide", "f34"}
)
flexmock(StatusReporterGithubChecks).should_receive("set_status").with_args(
state=BaseCommitStatus.error,
description="Job name `production_build` deprecated.",
check_name="config-deprecation-production_build",
url="https://packit.dev/docs/configuration/#supported-jobs",
links_to_external_services=None,
markdown_content="The `production_build` name for upstream Koji build is misleading "
"because it is not used to run production/non-scratch builds and "
"because it can be confused with "
"the `koji_build` job that is triggered for dist-git commits. "
"(The `koji_build` job can trigger both scratch and "
"non-scratch/production builds.) "
"To be explicit, use `upstream_koji_build` for builds triggered in upstream and "
"`koji_build` for builds triggered in downstream.\n\n"
"The support for the old name will be removed by the end of the year.",
).once()
flexmock(StatusReporterGithubChecks).should_receive("set_status").with_args(
state=BaseCommitStatus.pending,
description=TASK_ACCEPTED,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def test_precheck_koji_build_non_scratch(github_pr_event):
package_config = PackageConfig(
jobs=[
JobConfig(
type=JobType.production_build,
type=JobType.upstream_koji_build,
trigger=JobConfigTriggerType.pull_request,
packages={
"package": CommonPackageConfig(
Expand All @@ -369,7 +369,7 @@ def test_precheck_koji_build_non_scratch(github_pr_event):
packages={"package": CommonPackageConfig()},
)
job_config = JobConfig(
type=JobType.production_build,
type=JobType.upstream_koji_build,
trigger=JobConfigTriggerType.pull_request,
packages={
"package": CommonPackageConfig(
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_new_hotness_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ def test_new_hotness_update(new_hotness_update, sync_release_model):
create_pr=True,
local_pr_branch_suffix="update-pull_from_upstream",
use_downstream_specfile=True,
sync_default_files=False,
add_pr_instructions=True,
resolved_bugs=["rhbz#2106196"],
release_monitoring_project_id=4181,
Expand Down Expand Up @@ -388,7 +387,6 @@ def test_new_hotness_update_non_git(new_hotness_update, sync_release_model_non_g
create_pr=True,
local_pr_branch_suffix="update-pull_from_upstream",
use_downstream_specfile=True,
sync_default_files=False,
add_pr_instructions=True,
resolved_bugs=["rhbz#2106196"],
release_monitoring_project_id=4181,
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_pr_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2698,7 +2698,6 @@ def _get_project(url, *_, **__):
create_pr=True,
local_pr_branch_suffix="update-pull_from_upstream",
use_downstream_specfile=True,
sync_default_files=False,
add_pr_instructions=True,
resolved_bugs=["rhbz#123", "rhbz#124"],
release_monitoring_project_id=None,
Expand Down Expand Up @@ -2866,7 +2865,6 @@ def _get_project(url, *_, **__):
create_pr=True,
local_pr_branch_suffix="update-pull_from_upstream",
use_downstream_specfile=True,
sync_default_files=False,
add_pr_instructions=True,
resolved_bugs=["rhbz#123", "rhbz#124"],
release_monitoring_project_id=None,
Expand Down
6 changes: 0 additions & 6 deletions tests/integration/test_release_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ def test_dist_git_push_release_handle(
create_pr=True,
local_pr_branch_suffix="update-propose_downstream",
use_downstream_specfile=False,
sync_default_files=True,
add_pr_instructions=True,
resolved_bugs=[],
release_monitoring_project_id=None,
Expand Down Expand Up @@ -357,7 +356,6 @@ def test_dist_git_push_release_handle_multiple_branches(
create_pr=True,
local_pr_branch_suffix="update-propose_downstream",
use_downstream_specfile=False,
sync_default_files=True,
add_pr_instructions=True,
resolved_bugs=[],
release_monitoring_project_id=None,
Expand Down Expand Up @@ -508,7 +506,6 @@ def test_dist_git_push_release_handle_one_failed(
create_pr=True,
local_pr_branch_suffix="update-propose_downstream",
use_downstream_specfile=False,
sync_default_files=True,
add_pr_instructions=True,
resolved_bugs=[],
release_monitoring_project_id=None,
Expand All @@ -532,7 +529,6 @@ def test_dist_git_push_release_handle_one_failed(
create_pr=True,
local_pr_branch_suffix="update-propose_downstream",
use_downstream_specfile=False,
sync_default_files=True,
add_pr_instructions=True,
resolved_bugs=[],
release_monitoring_project_id=None,
Expand Down Expand Up @@ -777,7 +773,6 @@ def test_retry_propose_downstream_task(
create_pr=True,
local_pr_branch_suffix="update-propose_downstream",
use_downstream_specfile=False,
sync_default_files=True,
add_pr_instructions=True,
resolved_bugs=[],
release_monitoring_project_id=None,
Expand Down Expand Up @@ -891,7 +886,6 @@ def test_dont_retry_propose_downstream_task(
create_pr=True,
local_pr_branch_suffix="update-propose_downstream",
use_downstream_specfile=False,
sync_default_files=True,
add_pr_instructions=True,
resolved_bugs=[],
release_monitoring_project_id=None,
Expand Down
Loading
Loading