Skip to content

Commit 74638f2

Browse files
nammnmircea-cosbuc
andauthored
fixing context image not created when manually running releases (#214)
# Summary This pull request includes several updates to improve code readability, streamline imports, and enhance observability in the `mongodb-kubernetes` project. The changes encompass YAML file formatting, Python test import simplifications, and additional tracing attributes in the pipeline logic. ### Pipeline Enhancements: * Updated the `should_skip_arm64` function in `pipeline.py` to accept a `BuildConfiguration` parameter. Otherwise - we are skipping arm64 releases during manually triggered releases * Added OpenTelemetry tracing attributes to capture architecture details and release metadata in the `get_architectures_set`, `inner`, and `build_image_generic` functions, improving observability. [[1]](diffhunk://#diff-6b92e3e77956f8020482ca91889a24f3411c9a4854f2aaaac30ee504ef26ede4L768-R771) [[2]](diffhunk://#diff-6b92e3e77956f8020482ca91889a24f3411c9a4854f2aaaac30ee504ef26ede4R830-R833) [[3]](diffhunk://#diff-6b92e3e77956f8020482ca91889a24f3411c9a4854f2aaaac30ee504ef26ede4R1023-R1028). * the idea here is to add as much visibility as I could easily add ## Proof of Work - passing ci ## Checklist - [ ] Have you linked a jira ticket and/or is the ticket in the title? - [ ] Have you checked whether your jira ticket required DOCSP changes? - [ ] Have you checked for release_note changes? ## Reminder (Please remove this when merging) - Please try to Approve or Reject Changes the PR, keep PRs in review as short as possible - Our Short Guide for PRs: [Link](https://docs.google.com/document/d/1T93KUtdvONq43vfTfUt8l92uo4e4SEEvFbIEKOxGr44/edit?tab=t.0) - Remember the following Communication Standards - use comment prefixes for clarity: * **blocking**: Must be addressed before approval. * **follow-up**: Can be addressed in a later PR or ticket. * **q**: Clarifying question. * **nit**: Non-blocking suggestions. * **note**: Side-note, non-actionable. Example: Praise * --> no prefix is considered a question --------- Co-authored-by: mircea-cosbuc <[email protected]>
1 parent 13d8bc6 commit 74638f2

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

pipeline.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -735,11 +735,15 @@ def submit(self, fn, *args, **kwargs):
735735
return super().submit(lambda: fn(*args, **kwargs))
736736

737737

738-
def should_skip_arm64():
738+
def should_skip_arm64(config: BuildConfiguration) -> bool:
739739
"""
740-
Determines if arm64 builds should be skipped based on environment.
741-
Returns True if running in Evergreen pipeline as a patch.
740+
Determines if arm64 builds should be skipped based on environment.
741+
Determines if arm64 builds should be skipped based on BuildConfiguration or environment.```
742+
And skipping the evergreen detail.
742743
"""
744+
if config.is_release_step_executed():
745+
return False
746+
743747
return is_running_in_evg_pipeline() and is_running_in_patch()
744748

745749

@@ -765,8 +769,8 @@ def get_architectures_set(build_configuration, args):
765769
if arch_set == {"arm64"}:
766770
raise ValueError("Building for ARM64 only is not supported yet")
767771

768-
if should_skip_arm64():
769-
logger.info("Skipping ARM64 builds as this is running in EVG pipeline as a patch")
772+
if should_skip_arm64(build_configuration):
773+
logger.info("Skipping ARM64 builds as this is running in as a patch and not a release step.")
770774
return {"amd64"}
771775

772776
# Automatic architecture detection is the default behavior if 'arch' argument isn't specified
@@ -824,6 +828,10 @@ def inner(build_configuration: BuildConfiguration):
824828
args["release_version"] = version
825829

826830
arch_set = get_architectures_set(build_configuration, args)
831+
span = trace.get_current_span()
832+
span.set_attribute("mck.architectures", str(arch_set))
833+
span.set_attribute("mck.architectures_numbers", len(arch_set))
834+
span.set_attribute("mck.release", build_configuration.is_release_step_executed())
827835

828836
if version not in completed_versions:
829837
if arch_set == {"amd64", "arm64"}:
@@ -973,6 +981,7 @@ def build_om_image(build_configuration: BuildConfiguration):
973981
)
974982

975983

984+
@TRACER.start_as_current_span("build_image_generic")
976985
def build_image_generic(
977986
config: BuildConfiguration,
978987
image_name: str,
@@ -1012,6 +1021,12 @@ def build_image_generic(
10121021
if config.sign and config.is_release_step_executed():
10131022
sign_and_verify_context_image(registry, version)
10141023

1024+
span = trace.get_current_span()
1025+
span.set_attribute("mck.image.image_name", image_name)
1026+
span.set_attribute("mck.image.version", version)
1027+
span.set_attribute("mck.image.is_release", config.is_release_step_executed())
1028+
span.set_attribute("mck.image.is_multi_arch", is_multi_arch)
1029+
10151030
# Release step. Release images via the daily image process.
10161031
if config.is_release_step_executed() and version and QUAY_REGISTRY_URL in registry:
10171032
logger.info(
@@ -1066,7 +1081,7 @@ def build_community_image(build_configuration: BuildConfiguration, image_type: s
10661081
golang_version = os.getenv("GOLANG_VERSION", "1.24")
10671082

10681083
# Use only amd64 if we should skip arm64 builds
1069-
if should_skip_arm64():
1084+
if should_skip_arm64(build_configuration):
10701085
architectures = ["amd64"]
10711086
logger.info("Skipping ARM64 builds for community image as this is running in EVG pipeline as a patch")
10721087
else:
@@ -1181,7 +1196,7 @@ def build_multi_arch_agent_in_sonar(
11811196
joined_args = [args | arch_amd]
11821197

11831198
# Only include arm64 if we shouldn't skip it
1184-
if not should_skip_arm64():
1199+
if not should_skip_arm64(build_configuration):
11851200
joined_args.append(args | arch_arm)
11861201

11871202
build_image_generic(

0 commit comments

Comments
 (0)