Skip to content

Commit

Permalink
Merge pull request #496 from lbarcziova/testing_farm_bug
Browse files Browse the repository at this point in the history
Not overwrite git_ref in CoprBuildEvent

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
  • Loading branch information
softwarefactory-project-zuul[bot] committed Mar 17, 2020
2 parents 38e6e3a + b3e1833 commit a81043f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packit_service/service/events.py
Expand Up @@ -514,20 +514,18 @@ def __init__(
if build_pg:
self.pr_id = build_pg.pr.pr_id
self.commit_sha = build_pg.commit_sha
self.git_ref = (
self.commit_sha
) # ref should be name of the branch, not a hash
self.base_repo_name = build_pg.pr.project.repo_name
self.base_repo_namespace = build_pg.pr.project.namespace
# FIXME: hardcoded, move this to PG
https_url = f"https://github.com/{self.base_repo_namespace}/{self.base_repo_name}.git"
git_ref = self.commit_sha # ref should be name of the branch, not a hash
else:
self.pr_id = build.get("pr_id")
self.git_ref = build.get("ref", "")
self.commit_sha = build.get("commit_sha", "")
self.base_repo_name = build.get("repo_name")
self.base_repo_namespace = build.get("repo_namespace")
https_url = build["https_url"]
git_ref = build.get("ref", "")

self.topic = FedmsgTopic(topic)
if self.topic == FedmsgTopic.copr_build_started:
Expand All @@ -539,6 +537,7 @@ def __init__(

super().__init__(trigger=trigger, project_url=https_url)

self.git_ref = git_ref
self.build_id = build_id
self.build = build
self.chroot = chroot
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_events.py
Expand Up @@ -353,6 +353,7 @@ def test_parse_copr_build_event_end(self, copr_build_results_end, copr_build):
assert event_object.base_repo_name == "bar"
assert event_object.base_repo_namespace == "foo"
assert event_object.pkg == "hello"
assert event_object.git_ref == "0011223344"

def test_get_project_pr(self, pull_request, mock_config):
event_object = Parser.parse_event(pull_request)
Expand Down

0 comments on commit a81043f

Please sign in to comment.