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

[gitlab] Fix ancestor computation for check_pkg_size #32793

Merged
merged 2 commits into from
Jan 9, 2025
Merged
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
2 changes: 1 addition & 1 deletion tasks/libs/package/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_ancestor(ctx, package_sizes, on_main):
"""
ancestor = get_common_ancestor(ctx, "HEAD")
if not on_main and ancestor not in package_sizes:
return min(package_sizes, key=lambda x: package_sizes[x]['timestamp'])
return max(package_sizes, key=lambda x: package_sizes[x]['timestamp'])
return ancestor


Expand Down
2 changes: 1 addition & 1 deletion tasks/unit_tests/package_lib_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_found_on_dev(self):
@patch.dict('os.environ', {'CI_COMMIT_REF_NAME': 'puppet'})
def test_not_found_on_dev(self):
c = MockContext(run={'git merge-base HEAD origin/main': Result('grand_pa')})
self.assertEqual(get_ancestor(c, self.package_sizes, False), "grand_ma")
self.assertEqual(get_ancestor(c, self.package_sizes, False), "ma")

@patch.dict('os.environ', {'CI_COMMIT_REF_NAME': 'main'})
def test_on_main(self):
Expand Down
Loading