Skip to content

Simplifying naming conventions in inventory files by removing the "ubi" suffix. #58

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions inventories/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ images:
- registry: $(inputs.params.quay_registry)
tag: $(inputs.params.version)-context

- name: mongodb-agent-build-ubi
- name: mongodb-agent-build
task_type: docker_build
buildargs:
imagebase: $(inputs.params.registry)/mongodb-agent-ubi:$(inputs.params.version)-context
Expand All @@ -53,8 +53,8 @@ images:
- registry: $(inputs.params.registry)/mongodb-agent-ubi
tag: $(inputs.params.agent_version)_latest

- name: mongodb-agent-template-ubi
- name: mongodb-agent-template
task_type: dockerfile_template
tags: ["release"]
output:
- dockerfile: $(inputs.params.s3_bucket)/$(inputs.params.version)/ubi/Dockerfile
- dockerfile: $(inputs.params.s3_bucket)/$(inputs.params.version)/Dockerfile
7 changes: 3 additions & 4 deletions inventories/daily.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ vars:
quay_registry: quay.io/mongodb/<image-name-quay>
s3_bucket_http: https://enterprise-operator-dockerfiles.s3.amazonaws.com/dockerfiles/<image-name-bucket>
ecr_registry_ubi: 268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/<image-name-ecr>
# ubi suffix is "-ubi" by default, but it's empty for mongodb-kubernetes-operator, readiness and versionhook images
# suffix is empty for mongodb-kubernetes-operator, readiness and versionhook images
ubi_suffix: "-ubi"
base_suffix: ""
architecture_suffix: ""
Expand All @@ -15,12 +15,11 @@ images:
context: .
platform: linux/$(inputs.params.platform)
stages:
- name: build-ubi
- name: build
task_type: docker_build
tags: ["ubi"]
inputs:
- build_id
dockerfile: $(inputs.params.s3_bucket_http)/$(inputs.params.release_version)/ubi/Dockerfile
dockerfile: $(inputs.params.s3_bucket_http)/$(inputs.params.release_version)/Dockerfile
buildargs:
imagebase: $(inputs.params.quay_registry)$(inputs.params.base_suffix):$(inputs.params.release_version)-context$(inputs.params.architecture_suffix)
# This is required for correctly labeling the agent image and is not used
Expand Down
10 changes: 3 additions & 7 deletions inventories/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,16 @@ images:
- registry: $(inputs.params.registry)/mongodb-enterprise-database-context
tag: $(inputs.params.version_id)

- name: init-appdb-template-ubi
- name: init-appdb-template
task_type: dockerfile_template
distro: ubi
tags: ["ubi"]
inputs:
- version
output:
- dockerfile: $(functions.tempfile)

- name: database-build-ubi
task_type: docker_build
dockerfile: $(stages['init-appdb-template-ubi'].outputs[0].dockerfile)
tags: ["ubi"]
dockerfile: $(stages['init-appdb-template'].outputs[0].dockerfile)
buildargs:
imagebase: $(inputs.params.registry)/mongodb-enterprise-database-context:$(inputs.params.version_id)
output:
Expand All @@ -55,9 +52,8 @@ images:
- registry: $(inputs.params.quay_registry)
tag: $(inputs.params.version)-context

- name: database-template-ubi
- name: database-template
task_type: dockerfile_template
distro: ubi
tags: ["release"]
inputs:
- version
Expand Down
10 changes: 4 additions & 6 deletions inventories/init_appdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,20 @@ images:
- registry: $(inputs.params.registry)/mongodb-kubernetes-init-appdb-context
tag: $(inputs.params.version_id)

- name: init-appdb-template-ubi
- name: init-appdb-template
task_type: dockerfile_template
template_file_extension: ubi_minimal
tags: ["ubi"]
inputs:
- is_appdb
output:
- dockerfile: $(functions.tempfile)

- name: init-appdb-build-ubi
- name: init-appdb-build
task_type: docker_build
tags: ["ubi"]
buildargs:
version: $(inputs.params.version)
imagebase: $(inputs.params.registry)/mongodb-kubernetes-init-appdb-context:$(inputs.params.version_id)
dockerfile: $(stages['init-appdb-template-ubi'].outputs[0].dockerfile)
dockerfile: $(stages['init-appdb-template'].outputs[0].dockerfile)
output:
- registry: $(inputs.params.registry)/mongodb-kubernetes-init-appdb
tag: $(inputs.params.version_id)
Expand All @@ -59,7 +57,7 @@ images:
- registry: $(inputs.params.quay_registry)
tag: $(inputs.params.version)-context

- name: init-appdb-template-ubi
- name: init-appdb-template-release
task_type: dockerfile_template
template_file_extension: ubi_minimal
tags: ["release"]
Expand Down
10 changes: 4 additions & 6 deletions inventories/init_database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,20 @@ images:
- registry: $(inputs.params.registry)/mongodb-kubernetes-init-database-context
tag: $(inputs.params.version)

- name: init-database-template-ubi
- name: init-database-template
task_type: dockerfile_template
template_file_extension: ubi_minimal
tags: ["ubi"]
inputs:
- is_appdb
output:
- dockerfile: $(functions.tempfile)

- name: init-database-build-ubi
- name: init-database-build
task_type: docker_build
tags: ["ubi"]
buildargs:
imagebase: $(inputs.params.registry)/mongodb-kubernetes-init-database-context:$(inputs.params.version_id)
version: $(inputs.params.version)
dockerfile: $(stages['init-database-template-ubi'].outputs[0].dockerfile)
dockerfile: $(stages['init-database-template'].outputs[0].dockerfile)
inputs:
- is_appdb
output:
Expand Down Expand Up @@ -65,7 +63,7 @@ images:
- registry: $(inputs.params.quay_registry)
tag: $(inputs.params.version)-context

- name: init-database-template-ubi
- name: init-database-template-release
task_type: dockerfile_template
template_file_extension: ubi_minimal
tags: ["release"]
Expand Down
12 changes: 5 additions & 7 deletions inventories/init_om.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@ images:
- registry: $(inputs.params.registry)/mongodb-kubernetes-init-ops-manager-context
tag: $(inputs.params.version_id)

- name: init-ops-manager-template-ubi
- name: init-ops-manager-template
task_type: dockerfile_template
template_file_extension: ubi_minimal
tags: ["ubi"]
inputs:
- version
output:
- dockerfile: $(functions.tempfile)

- name: init-ops-manager-build-ubi
- name: init-ops-manager-build
task_type: docker_build
dockerfile: $(stages['init-ops-manager-template-ubi'].outputs[0].dockerfile)
tags: ["ubi"]
dockerfile: $(stages['init-ops-manager-template'].outputs[0].dockerfile)
buildargs:
imagebase: $(inputs.params.registry)/mongodb-kubernetes-init-ops-manager-context:$(inputs.params.version_id)
output:
Expand All @@ -55,11 +53,11 @@ images:
- registry: $(inputs.params.quay_registry)
tag: $(inputs.params.version)-context

- name: init-ops-manager-template-ubi
- name: init-ops-manager-template-release
task_type: dockerfile_template
template_file_extension: ubi_minimal
tags: ["release"]
inputs:
- version
output:
- dockerfile: $(inputs.params.s3_bucket)/$(inputs.params.version)/ubi/Dockerfile
- dockerfile: $(inputs.params.s3_bucket)/$(inputs.params.version)/Dockerfile
8 changes: 3 additions & 5 deletions inventories/om.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ images:
- registry: $(inputs.params.registry)/ops-manager-context
tag: $(inputs.params.version_id)

- name: ops-manager-template-ubi
- name: ops-manager-template
task_type: dockerfile_template
template_file_extension: ubi
tags: ["ubi"]
inputs:
- om_download_url
- version
Expand All @@ -32,8 +31,7 @@ images:

- name: ops-manager-build
task_type: docker_build
dockerfile: $(stages['ops-manager-template-ubi'].outputs[0].dockerfile)
tags: ["ubi"]
dockerfile: $(stages['ops-manager-template'].outputs[0].dockerfile)
buildargs:
imagebase: $(inputs.params.registry)/ops-manager-context:$(inputs.params.version_id)
output:
Expand All @@ -44,7 +42,7 @@ images:
- name: ops-manager-template
task_type: dockerfile_template
template_file_extension: ubi
tags: ["ubi", "release"]
tags: ["release"]
inputs:
- om_download_url
- version
Expand Down
2 changes: 0 additions & 2 deletions inventories/readiness_probe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ images:
- name: readiness-probe-build-context
task_type: docker_build
dockerfile: docker/mongodb-kubernetes-readinessprobe/Dockerfile.builder
tags: ["ubi"]
buildargs:
GOLANG_VERSION: $(inputs.params.golang_version)
TARGETOS: linux
Expand All @@ -40,7 +39,6 @@ images:

- name: readiness-probe-build
task_type: docker_build
tags: ["ubi"]
buildargs:
imagebase: $(inputs.params.registry)/mongodb-kubernetes-readinessprobe:$(inputs.params.version_id)-context-$(inputs.params.architecture)
version: $(inputs.params.version)
Expand Down
4 changes: 1 addition & 3 deletions inventories/upgrade_hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ images:
- name: readiness-probe-build-context
task_type: docker_build
dockerfile: docker/mongodb-kubernetes-upgrade-hook/Dockerfile.builder
tags: ["ubi"]
buildargs:
GOLANG_VERSION: $(inputs.params.golang_version)
TARGETOS: linux
Expand All @@ -40,7 +39,6 @@ images:

- name: readiness-probe-build
task_type: docker_build
tags: ["ubi"]
buildargs:
imagebase: $(inputs.params.registry)/mongodb-kubernetes-operator-version-upgrade-post-start-hook:$(inputs.params.version_id)-context-$(inputs.params.architecture)
version: $(inputs.params.version)
Expand All @@ -59,4 +57,4 @@ images:
task_type: dockerfile_template
tags: ["release"]
output:
- dockerfile: $(inputs.params.s3_bucket)/$(inputs.params.version)/ubi/Dockerfile
- dockerfile: $(inputs.params.s3_bucket)/$(inputs.params.version)/Dockerfile
16 changes: 7 additions & 9 deletions inventory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,26 @@ images:
- registry: $(inputs.params.registry)/operator-context
tag: $(inputs.params.version_id)-race

- name: operator-template-ubi
- name: operator-template
task_type: dockerfile_template
distro: ubi
inputs:
- version
- debug
output:
- dockerfile: $(functions.tempfile)

- name: operator-ubi-build
- name: operator-build
task_type: docker_build
dockerfile: $(stages['operator-template-ubi'].outputs[0].dockerfile)
dockerfile: $(stages['operator-template'].outputs[0].dockerfile)
buildargs:
imagebase: $(inputs.params.registry)/operator-context:$(inputs.params.version_id)
output:
- registry: $(inputs.params.registry)/mongodb-kubernetes
tag: $(inputs.params.version_id)

- name: operator-ubi-race-build
- name: operator-race-build
task_type: docker_build
dockerfile: $(stages['operator-template-ubi'].outputs[0].dockerfile)
dockerfile: $(stages['operator-template'].outputs[0].dockerfile)
buildargs:
imagebase: $(inputs.params.registry)/operator-context:$(inputs.params.version_id)-race
output:
Expand All @@ -84,11 +83,10 @@ images:
- registry: $(inputs.params.quay_registry)
tag: $(inputs.params.version)-context

- name: operator-template-ubi
- name: operator-template
task_type: dockerfile_template
tags: ["release"]
distro: ubi
inputs:
- version
output:
- dockerfile: $(inputs.params.s3_bucket)/$(inputs.params.version)/ubi/Dockerfile
- dockerfile: $(inputs.params.s3_bucket)/$(inputs.params.version)/Dockerfile
37 changes: 14 additions & 23 deletions pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def produce_sbom(build_configuration, args):
return

try:
image_pull_spec = args["quay_registry"] + args.get("ubi_suffix", "")
image_pull_spec = args["quay_registry"]
except KeyError:
logger.error(f"Could not find image pull spec. Args: {args}, BuildConfiguration: {build_configuration}")
logger.error(f"Skipping SBOM generation")
Expand Down Expand Up @@ -619,7 +619,6 @@ def image_config(
image_name: str,
name_prefix: str = "mongodb-kubernetes-",
s3_bucket: str = "enterprise-operator-dockerfiles",
ubi_suffix: str = "-ubi",
base_suffix: str = "",
) -> Tuple[str, Dict[str, str]]:
"""Generates configuration for an image suitable to be passed
Expand All @@ -630,7 +629,6 @@ def image_config(
"quay_registry": "{}/{}{}".format(QUAY_REGISTRY_URL, name_prefix, image_name),
"ecr_registry_ubi": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/{}{}".format(name_prefix, image_name),
"s3_bucket_http": "https://{}.s3.amazonaws.com/dockerfiles/{}{}".format(s3_bucket, name_prefix, image_name),
"ubi_suffix": ubi_suffix,
"base_suffix": base_suffix,
}

Expand All @@ -643,31 +641,24 @@ def args_for_daily_image(image_name: str) -> Dict[str, str]:
This includes the quay_registry and ospid corresponding to RedHat's project id.
"""
image_configs = [
image_config("database", ubi_suffix=""),
image_config("init-appdb", ubi_suffix=""),
image_config("database"),
image_config("init-appdb"),
image_config("init-database"),
image_config("init-ops-manager"),
image_config("mongodb-kubernetes"),
image_config("agent", name_prefix="mongodb-enterprise-"),
image_config("init-database", ubi_suffix=""),
image_config("init-ops-manager", ubi_suffix=""),
image_config("mongodb-kubernetes", name_prefix="", ubi_suffix=""),
image_config("ops-manager", name_prefix="mongodb-enterprise-"),
image_config("mongodb-agent", name_prefix="", ubi_suffix="-ubi", base_suffix="-ubi"),
image_config("ops-manager", name_prefix="mongodb-enterprise-", base_suffix="-ubi"),
image_config("mongodb-agent", name_prefix="", base_suffix="-ubi"),
image_config(
image_name="mongodb-kubernetes-operator",
name_prefix="",
image_name="operator",
s3_bucket="enterprise-operator-dockerfiles",
# community ubi image does not have a suffix in its name
ubi_suffix="",
),
image_config(
image_name="mongodb-kubernetes-readinessprobe",
ubi_suffix="",
name_prefix="",
image_name="readinessprobe",
s3_bucket="enterprise-operator-dockerfiles",
),
image_config(
image_name="mongodb-kubernetes-operator-version-upgrade-post-start-hook",
ubi_suffix="",
name_prefix="",
image_name="operator-version-upgrade-post-start-hook",
s3_bucket="enterprise-operator-dockerfiles",
),
]
Expand Down Expand Up @@ -769,7 +760,7 @@ def get_architectures_set(build_configuration, args):
# Automatic architecture detection is the default behavior if 'arch' argument isn't specified
if arch_set == set():
if check_multi_arch(
image=args["quay_registry"] + args["ubi_suffix"] + ":" + args["release_version"],
image=args["quay_registry"] + ":" + args["release_version"],
suffix="-context",
):
arch_set = {"amd64", "arm64"}
Expand All @@ -785,7 +776,7 @@ def create_and_push_manifests(args: dict):
tags = [args["release_version"], args["release_version"] + "-b" + args["build_id"]]
for registry in registries:
for tag in tags:
create_and_push_manifest(registry + args["ubi_suffix"], tag)
create_and_push_manifest(registry, tag)

def sign_image_concurrently(executor, args, futures, arch=None):
v = args["release_version"]
Expand Down Expand Up @@ -886,7 +877,7 @@ def inner(build_configuration: BuildConfiguration):
@TRACER.start_as_current_span("sign_image_in_repositories")
def sign_image_in_repositories(args: Dict[str, str], arch: str = None):
span = trace.get_current_span()
repository = args["quay_registry"] + args["ubi_suffix"]
repository = args["quay_registry"]
tag = args["release_version"]
if arch:
tag = f"{tag}-{arch}"
Expand Down