Skip to content
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 misc/python/materialize/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_latest_version(

def get_tags_of_current_commit(include_tags: YesNoOnce = YesNoOnce.ONCE) -> list[str]:
if include_tags:
fetch(include_tags=include_tags, only_tags=True)
fetch(get_remote(), include_tags=include_tags, only_tags=True)

result = spawn.capture(["git", "tag", "--points-at", "HEAD"])

Expand Down
4 changes: 2 additions & 2 deletions misc/python/materialize/scalability/endpoint/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def __init__(
self,
composition: Composition,
specified_target: str,
resolved_target: str,
resolved_target: str | None,
use_balancerd: bool,
image: str | None = None,
alternative_image: str | None = None,
Expand All @@ -141,7 +141,7 @@ def __init__(
self.use_balancerd = use_balancerd
super().__init__(specified_target)

def resolved_target(self) -> str:
def resolved_target(self) -> str | None:
return self._resolved_target

def port(self) -> int:
Expand Down
47 changes: 28 additions & 19 deletions misc/python/materialize/version_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def get_supported_self_managed_versions() -> list[MzVersion]:
_SKIP_IMAGE_CHECK_BELOW_THIS_VERSION = MzVersion.parse_mz("v0.77.0")


def resolve_ancestor_image_tag(ancestor_overrides: dict[str, MzVersion]) -> str:
def resolve_ancestor_image_tag(ancestor_overrides: dict[str, MzVersion]) -> str | None:
"""
Resolve the ancestor image tag.
:param ancestor_overrides: one of #ANCESTOR_OVERRIDES_FOR_PERFORMANCE_REGRESSIONS, #ANCESTOR_OVERRIDES_FOR_SCALABILITY_REGRESSIONS, #ANCESTOR_OVERRIDES_FOR_CORRECTNESS_REGRESSIONS
Expand All @@ -148,7 +148,10 @@ def resolve_ancestor_image_tag(ancestor_overrides: dict[str, MzVersion]) -> str:
return image_tag

ancestor_image_resolution = _create_ancestor_image_resolution(ancestor_overrides)
image_tag, context = ancestor_image_resolution.resolve_image_tag()
result = ancestor_image_resolution.resolve_image_tag()
if result is None:
return None
image_tag, context = result
print(f"Using {image_tag} as image tag for ancestor (context: {context})")
return image_tag

Expand Down Expand Up @@ -201,7 +204,7 @@ def _get_override_commit_instead_of_version(

def _resolve_image_tag_of_previous_release(
self, context_prefix: str, previous_minor: bool
) -> tuple[str, str]:
) -> tuple[str, str] | None:
tagged_release_version = git.get_tagged_release_version(version_type=MzVersion)
assert tagged_release_version is not None
previous_release_version = get_previous_published_version(
Expand All @@ -213,11 +216,13 @@ def _resolve_image_tag_of_previous_release(
)

if override_commit is not None:
# TODO(def-): This currently doesn't work because we only tag the Optimized builds with tags like v0.164.0-dev.0--main.gc28d0061a6c9e63ee50a5f555c5d90373d006686, but not the Release builds we should use
# use the commit instead of the previous release
return (
commit_to_image_tag(override_commit),
f"commit override instead of previous release ({previous_release_version})",
)
# return (
# commit_to_image_tag(override_commit),
# f"commit override instead of previous release ({previous_release_version})",
# )
return None

return (
release_version_to_image_tag(previous_release_version),
Expand All @@ -226,7 +231,7 @@ def _resolve_image_tag_of_previous_release(

def _resolve_image_tag_of_previous_release_from_current(
self, context: str
) -> tuple[str, str]:
) -> tuple[str, str] | None:
# Even though we are on main we might be in an older state, pick the
# latest release that was before our current version.
current_version = MzVersion.parse_cargo()
Expand All @@ -239,11 +244,13 @@ def _resolve_image_tag_of_previous_release_from_current(
)

if override_commit is not None:
# TODO(def-): This currently doesn't work because we only tag the Optimized builds with tags like v0.164.0-dev.0--main.gc28d0061a6c9e63ee50a5f555c5d90373d006686, but not the Release builds we should use
# use the commit instead of the latest release
return (
commit_to_image_tag(override_commit),
f"commit override instead of latest release ({previous_published_version})",
)
# return (
Comment on lines 248 to +249
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: How soon are we thinking of uncommenting this code? If not soon, feels weird to have no separation between the TODO comment and the commented code itself.

# commit_to_image_tag(override_commit),
# f"commit override instead of latest release ({previous_published_version})",
# )
return None

return (
release_version_to_image_tag(previous_published_version),
Expand All @@ -254,7 +261,7 @@ def _resolve_image_tag_of_merge_base(
self,
context_when_image_of_commit_exists: str,
context_when_falling_back_to_latest: str,
) -> tuple[str, str]:
) -> tuple[str, str] | None:
# If the current PR has a known and accepted regression, don't compare
# against merge base of it
override_commit = self._get_override_commit_instead_of_version(
Expand All @@ -263,10 +270,12 @@ def _resolve_image_tag_of_merge_base(
common_ancestor_commit = buildkite.get_merge_base()

if override_commit is not None:
return (
commit_to_image_tag(override_commit),
f"commit override instead of merge base ({common_ancestor_commit})",
)
# TODO(def-): This currently doesn't work because we only tag the Optimized builds with tags like v0.164.0-dev.0--main.gc28d0061a6c9e63ee50a5f555c5d90373d006686, but not the Release builds we should use
# return (
# commit_to_image_tag(override_commit),
# f"commit override instead of merge base ({common_ancestor_commit})",
# )
return None

if image_of_commit_exists(common_ancestor_commit):
return (
Expand All @@ -281,7 +290,7 @@ def _resolve_image_tag_of_merge_base(


class AncestorImageResolutionLocal(AncestorImageResolutionBase):
def resolve_image_tag(self) -> tuple[str, str]:
def resolve_image_tag(self) -> tuple[str, str] | None:
if build_context.is_on_release_version():
return self._resolve_image_tag_of_previous_release(
"previous minor release because on local release branch",
Expand All @@ -299,7 +308,7 @@ def resolve_image_tag(self) -> tuple[str, str]:


class AncestorImageResolutionInBuildkite(AncestorImageResolutionBase):
def resolve_image_tag(self) -> tuple[str, str]:
def resolve_image_tag(self) -> tuple[str, str] | None:
if buildkite.is_in_pull_request():
return self._resolve_image_tag_of_merge_base(
"merge base of pull request",
Expand Down
6 changes: 4 additions & 2 deletions test/feature-benchmark/mzcompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,12 @@ def run_one_scenario(
return result


resolved_tags: dict[tuple[str, frozenset[tuple[str, MzVersion]]], str] = {}
resolved_tags: dict[tuple[str, frozenset[tuple[str, MzVersion]]], str | None] = {}


def resolve_tag(tag: str, scenario_class: type[Scenario], scale: str | None) -> str:
def resolve_tag(
tag: str, scenario_class: type[Scenario], scale: str | None
) -> str | None:
if tag == "common-ancestor":
overrides = get_ancestor_overrides_for_performance_regressions(
scenario_class, scale
Expand Down
6 changes: 3 additions & 3 deletions test/parallel-benchmark/mzcompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
PARALLEL_BENCHMARK_FRAMEWORK_VERSION = "1.2.0"


def known_regression(scenario: str, other_tag: str) -> bool:
def known_regression(scenario: str, other_tag: str | None) -> bool:
return False


Expand Down Expand Up @@ -567,7 +567,7 @@ def less_than_is_regression(stat: str) -> bool:
def check_regressions(
this_stats: dict[Scenario, dict[str, Statistics]],
other_stats: dict[Scenario, dict[str, Statistics]],
other_tag: str,
other_tag: str | None,
) -> list[TestFailureDetails]:
failures: list[TestFailureDetails] = []

Expand Down Expand Up @@ -641,7 +641,7 @@ def check_regressions(
return failures


def resolve_tag(tag: str) -> str:
def resolve_tag(tag: str) -> str | None:
if tag == "common-ancestor":
# TODO: We probably will need overrides too
return resolve_ancestor_image_tag({})
Expand Down
2 changes: 1 addition & 1 deletion test/version-consistency/mzcompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
raise FailedTestExecutionError(errors=test_summary.failures)


def resolve_tag(tag: str) -> str:
def resolve_tag(tag: str) -> str | None:
if tag == "common-ancestor":
return resolve_ancestor_image_tag(
ANCESTOR_OVERRIDES_FOR_CORRECTNESS_REGRESSIONS
Expand Down