Skip to content

Commit d27d23b

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongodb-kubernetes into multi-arch-mco
2 parents 0bb1c76 + b338418 commit d27d23b

28 files changed

+380
-264
lines changed

.githooks/pre-commit

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,24 +142,27 @@ function check_incorrect_makefile_variable_brackets() {
142142
}
143143

144144
function pre_commit() {
145+
if [[ "${MDB_UPDATE_LICENSES:-""}" == "true" ]]; then
146+
( (time update_licenses) 2>&1 | prepend "update_licenses" ) &
147+
fi
148+
( (time scripts/evergreen/lint_code.sh) 2>&1 | prepend "lint_code.sh" ) &
149+
( (time start_shellcheck) 2>&1 | prepend "shellcheck" ) &
150+
145151
# Update release.json first in case there is a newer version
146152
(time update_release_json) 2>&1 | prepend "update_release_json"
147153
# We need to generate the values files first
148154
(time update_values_yaml_files) 2>&1 | prepend "update_values_yaml_files"
149155
# The values files are used for generating the standalone yaml
150156
(time generate_standalone_yaml) 2>&1 | prepend "generate_standalone_yaml"
151-
# Run black on python files that have changed
152-
(time python_formatting) 2>&1 | prepend "python_formatting"
153-
154-
(time regenerate_public_rbac_multi_cluster) 2>&1 | prepend "regenerate_public_rbac_multi_cluster"
155157

156-
(time start_shellcheck) 2>&1 | prepend "shellcheck"
158+
( (time regenerate_public_rbac_multi_cluster) 2>&1 | prepend "regenerate_public_rbac_multi_cluster" ) &
157159

158-
(time check_erroneous_kubebuilder_annotations) 2>&1 | prepend "check_erroneous_kubebuilder_annotations"
160+
# Run black and isort on python files that have changed
161+
( (time python_formatting) 2>&1 | prepend "python_formatting") &
159162

160-
(time scripts/evergreen/lint_code.sh) 2>&1 | prepend "lint_code.sh"
163+
( (time check_erroneous_kubebuilder_annotations) 2>&1 | prepend "check_erroneous_kubebuilder_annotations" ) &
161164

162-
(time update_licenses) 2>&1 | prepend "update_licenses"
165+
wait
163166
}
164167

165168
# Function to run shellcheck on a single file
@@ -196,7 +199,7 @@ if [[ "${cmd}" == "generate_standalone_yaml" ]]; then
196199
shift 1
197200
generate_standalone_yaml "$@"
198201
elif [[ "${cmd}" == "pre-commit" ]]; then
199-
pre_commit
202+
time pre_commit
200203
elif [[ "${cmd}" == "shellcheck" ]]; then
201204
start_shellcheck
202205
elif [[ "${cmd}" == "lint" ]]; then

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,17 @@ prerequisites:
5757
@ scripts/dev/install.sh
5858

5959
precommit:
60-
@ EVERGREEN_MODE=true .githooks/pre-commit
60+
@ .githooks/pre-commit
61+
62+
precommit-with-licenses:
63+
@ MDB_UPDATE_LICENSE=true .githooks/pre-commit
6164

6265
switch:
6366
@ scripts/dev/switch_context.sh $(context) $(additional_override)
6467

68+
switcht:
69+
@ scripts/dev/switch_context_by_test.sh $(test)
70+
6571
# builds the Operator binary file and docker image and pushes it to the remote registry if using a remote registry. Deploys it to
6672
# k8s cluster
6773
operator: configure-operator build-and-push-operator-image
@@ -322,9 +328,9 @@ deploy: manifests kustomize
322328
undeploy:
323329
$(KUSTOMIZE) build config/default | kubectl delete -f -
324330

325-
# Generate manifests e.g. CRD, RBAC etc.
331+
# Generate manifests e.g. CRD etc.
326332
manifests: controller-gen
327-
export PATH="$(PATH)"; export GOROOT=$(GOROOT); $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths=./... output:crd:artifacts:config=config/crd/bases
333+
export PATH="$(PATH)"; export GOROOT=$(GOROOT); $(CONTROLLER_GEN) $(CRD_OPTIONS) paths=./... output:crd:artifacts:config=config/crd/bases
328334
# copy the CRDs to the public folder
329335
cp config/crd/bases/* helm_chart/crds/
330336
cat "helm_chart/crds/"* > public/crds.yaml

config/manager/manager.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ spec:
196196
value: "quay.io/mongodb/mongodb-agent-ubi:12.0.35.7911-1_1.0.1"
197197
- name: RELATED_IMAGE_AGENT_IMAGE_12_0_35_7911_1_1_1_0
198198
value: "quay.io/mongodb/mongodb-agent-ubi:12.0.35.7911-1_1.1.0"
199-
- name: RELATED_IMAGE_AGENT_IMAGE_13_35_0_9498_1
200-
value: "quay.io/mongodb/mongodb-agent-ubi:13.35.0.9498-1"
201-
- name: RELATED_IMAGE_AGENT_IMAGE_13_35_0_9498_1_1_0_0
202-
value: "quay.io/mongodb/mongodb-agent-ubi:13.35.0.9498-1_1.0.0"
203-
- name: RELATED_IMAGE_AGENT_IMAGE_13_35_0_9498_1_1_0_1
204-
value: "quay.io/mongodb/mongodb-agent-ubi:13.35.0.9498-1_1.0.1"
205-
- name: RELATED_IMAGE_AGENT_IMAGE_13_35_0_9498_1_1_1_0
206-
value: "quay.io/mongodb/mongodb-agent-ubi:13.35.0.9498-1_1.1.0"
199+
- name: RELATED_IMAGE_AGENT_IMAGE_13_36_0_9555_1
200+
value: "quay.io/mongodb/mongodb-agent-ubi:13.36.0.9555-1"
201+
- name: RELATED_IMAGE_AGENT_IMAGE_13_36_0_9555_1_1_0_0
202+
value: "quay.io/mongodb/mongodb-agent-ubi:13.36.0.9555-1_1.0.0"
203+
- name: RELATED_IMAGE_AGENT_IMAGE_13_36_0_9555_1_1_0_1
204+
value: "quay.io/mongodb/mongodb-agent-ubi:13.36.0.9555-1_1.0.1"
205+
- name: RELATED_IMAGE_AGENT_IMAGE_13_36_0_9555_1_1_1_0
206+
value: "quay.io/mongodb/mongodb-agent-ubi:13.36.0.9555-1_1.1.0"
207207
- name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_6_0_25
208208
value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:6.0.25"
209209
- name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_6_0_26

config/rbac/role.yaml

Lines changed: 0 additions & 156 deletions
This file was deleted.

config/rbac/role_binding.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

helm_chart/values-openshift.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ relatedImages:
124124
- 12.0.35.7911-1_1.0.0
125125
- 12.0.35.7911-1_1.0.1
126126
- 12.0.35.7911-1_1.1.0
127-
- 13.35.0.9498-1
128-
- 13.35.0.9498-1_1.0.0
129-
- 13.35.0.9498-1_1.0.1
130-
- 13.35.0.9498-1_1.1.0
127+
- 13.36.0.9555-1
128+
- 13.36.0.9555-1_1.0.0
129+
- 13.36.0.9555-1_1.0.1
130+
- 13.36.0.9555-1_1.1.0
131131
mongodbLegacyAppDb:
132132
- 4.2.11-ent
133133
- 4.2.2-ent

pipeline.py

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

761761

762-
def should_skip_arm64():
762+
def should_skip_arm64(config: BuildConfiguration) -> bool:
763763
"""
764-
Determines if arm64 builds should be skipped based on environment.
765-
Returns True if running in Evergreen pipeline as a patch.
764+
Determines if arm64 builds should be skipped based on environment.
765+
Determines if arm64 builds should be skipped based on BuildConfiguration or environment.```
766+
And skipping the evergreen detail.
766767
"""
768+
if config.is_release_step_executed():
769+
return False
770+
767771
return is_running_in_evg_pipeline() and is_running_in_patch()
768772

769773

@@ -789,8 +793,8 @@ def get_architectures_set(build_configuration, args):
789793
if arch_set == {"arm64"}:
790794
raise ValueError("Building for ARM64 only is not supported yet")
791795

792-
if should_skip_arm64():
793-
logger.info("Skipping ARM64 builds as this is running in EVG pipeline as a patch")
796+
if should_skip_arm64(build_configuration):
797+
logger.info("Skipping ARM64 builds as this is running in as a patch and not a release step.")
794798
return {"amd64"}
795799

796800
# Automatic architecture detection is the default behavior if 'arch' argument isn't specified
@@ -848,6 +852,10 @@ def inner(build_configuration: BuildConfiguration):
848852
args["release_version"] = version
849853

850854
arch_set = get_architectures_set(build_configuration, args)
855+
span = trace.get_current_span()
856+
span.set_attribute("mck.architectures", str(arch_set))
857+
span.set_attribute("mck.architectures_numbers", len(arch_set))
858+
span.set_attribute("mck.release", build_configuration.is_release_step_executed())
851859

852860
if version not in completed_versions:
853861
if arch_set == {"amd64", "arm64"}:
@@ -997,6 +1005,7 @@ def build_om_image(build_configuration: BuildConfiguration):
9971005
)
9981006

9991007

1008+
@TRACER.start_as_current_span("build_image_generic")
10001009
def build_image_generic(
10011010
config: BuildConfiguration,
10021011
image_name: str,
@@ -1036,6 +1045,12 @@ def build_image_generic(
10361045
if config.sign and config.is_release_step_executed():
10371046
sign_and_verify_context_image(registry, version)
10381047

1048+
span = trace.get_current_span()
1049+
span.set_attribute("mck.image.image_name", image_name)
1050+
span.set_attribute("mck.image.version", version)
1051+
span.set_attribute("mck.image.is_release", config.is_release_step_executed())
1052+
span.set_attribute("mck.image.is_multi_arch", is_multi_arch)
1053+
10391054
# Release step. Release images via the daily image process.
10401055
if config.is_release_step_executed() and version and QUAY_REGISTRY_URL in registry:
10411056
logger.info(
@@ -1090,7 +1105,7 @@ def build_community_image(build_configuration: BuildConfiguration, image_type: s
10901105
golang_version = os.getenv("GOLANG_VERSION", "1.24")
10911106

10921107
# Use only amd64 if we should skip arm64 builds
1093-
if should_skip_arm64():
1108+
if should_skip_arm64(build_configuration):
10941109
architectures = ["amd64"]
10951110
logger.info("Skipping ARM64 builds for community image as this is running in EVG pipeline as a patch")
10961111
else:
@@ -1205,7 +1220,7 @@ def build_multi_arch_agent_in_sonar(
12051220
joined_args = [args | arch_amd]
12061221

12071222
# Only include arm64 if we shouldn't skip it
1208-
if not should_skip_arm64():
1223+
if not should_skip_arm64(build_configuration):
12091224
joined_args.append(args | arch_arm)
12101225

12111226
build_image_generic(

public/mongodb-kubernetes-openshift.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -478,14 +478,14 @@ spec:
478478
value: "quay.io/mongodb/mongodb-agent-ubi:12.0.35.7911-1_1.0.1"
479479
- name: RELATED_IMAGE_AGENT_IMAGE_12_0_35_7911_1_1_1_0
480480
value: "quay.io/mongodb/mongodb-agent-ubi:12.0.35.7911-1_1.1.0"
481-
- name: RELATED_IMAGE_AGENT_IMAGE_13_35_0_9498_1
482-
value: "quay.io/mongodb/mongodb-agent-ubi:13.35.0.9498-1"
483-
- name: RELATED_IMAGE_AGENT_IMAGE_13_35_0_9498_1_1_0_0
484-
value: "quay.io/mongodb/mongodb-agent-ubi:13.35.0.9498-1_1.0.0"
485-
- name: RELATED_IMAGE_AGENT_IMAGE_13_35_0_9498_1_1_0_1
486-
value: "quay.io/mongodb/mongodb-agent-ubi:13.35.0.9498-1_1.0.1"
487-
- name: RELATED_IMAGE_AGENT_IMAGE_13_35_0_9498_1_1_1_0
488-
value: "quay.io/mongodb/mongodb-agent-ubi:13.35.0.9498-1_1.1.0"
481+
- name: RELATED_IMAGE_AGENT_IMAGE_13_36_0_9555_1
482+
value: "quay.io/mongodb/mongodb-agent-ubi:13.36.0.9555-1"
483+
- name: RELATED_IMAGE_AGENT_IMAGE_13_36_0_9555_1_1_0_0
484+
value: "quay.io/mongodb/mongodb-agent-ubi:13.36.0.9555-1_1.0.0"
485+
- name: RELATED_IMAGE_AGENT_IMAGE_13_36_0_9555_1_1_0_1
486+
value: "quay.io/mongodb/mongodb-agent-ubi:13.36.0.9555-1_1.0.1"
487+
- name: RELATED_IMAGE_AGENT_IMAGE_13_36_0_9555_1_1_1_0
488+
value: "quay.io/mongodb/mongodb-agent-ubi:13.36.0.9555-1_1.1.0"
489489
- name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_6_0_25
490490
value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:6.0.25"
491491
- name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_6_0_26

0 commit comments

Comments
 (0)