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

Add commit sha to all tags #1681

Merged
merged 1 commit into from
Sep 25, 2024
Merged
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
33 changes: 12 additions & 21 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ STATIC_VARIANTS = [
]

STATIC = {
"{REGISTRY}/{PROJECT_ID}/static:{COMMIT_SHA}": "//base:static_root_amd64_" + DEFAULT_DISTRO,
"{REGISTRY}/{PROJECT_ID}/static-debian12:{COMMIT_SHA}": "//base:static_root_amd64_debian12",
}

STATIC |= {
"{REGISTRY}/{PROJECT_ID}/static:" + tag_base + "-" + arch: "//base:" + label + "_" + user + "_" + arch + "_" + DEFAULT_DISTRO
for arch in ARCHITECTURES
for (tag_base, label, user) in STATIC_VARIANTS
Expand Down Expand Up @@ -54,11 +49,6 @@ BASE_VARIANTS = [
]

BASE = {
"{REGISTRY}/{PROJECT_ID}/base:{COMMIT_SHA}": "//base:base_root_amd64_" + DEFAULT_DISTRO,
"{REGISTRY}/{PROJECT_ID}/base-debian12:{COMMIT_SHA}": "//base:base_root_amd64_debian12",
}

BASE |= {
"{REGISTRY}/{PROJECT_ID}/base:" + tag_base + "-" + arch: "//base:" + label + "_" + user + "_" + arch + "_" + DEFAULT_DISTRO
for arch in ARCHITECTURES
for (tag_base, label, user) in BASE_VARIANTS
Expand Down Expand Up @@ -93,11 +83,6 @@ BASE_NOSSL_VARIANTS = [
]

BASE_NOSSL = {
"{REGISTRY}/{PROJECT_ID}/base-nossl:{COMMIT_SHA}": "//base:base_nossl_root_amd64_" + DEFAULT_DISTRO,
"{REGISTRY}/{PROJECT_ID}/base-nossl-debian12:{COMMIT_SHA}": "//base:base_nossl_root_amd64_debian12",
}

BASE_NOSSL |= {
"{REGISTRY}/{PROJECT_ID}/base-nossl:" + tag_base + "-" + arch: "//base:" + label + "_" + user + "_" + arch + "_" + DEFAULT_DISTRO
for arch in ARCHITECTURES
for (tag_base, label, user) in BASE_NOSSL_VARIANTS
Expand Down Expand Up @@ -132,11 +117,6 @@ CC_VARIANTS = [
]

CC = {
"{REGISTRY}/{PROJECT_ID}/cc:{COMMIT_SHA}": "//cc:cc_root_amd64_" + DEFAULT_DISTRO,
"{REGISTRY}/{PROJECT_ID}/cc-debian12:{COMMIT_SHA}": "//cc:cc_root_amd64_debian12",
}

CC |= {
"{REGISTRY}/{PROJECT_ID}/cc:" + tag_base + "-" + arch: "//cc:" + label + "_" + user + "_" + arch + "_" + DEFAULT_DISTRO
for arch in ARCHITECTURES
for (tag_base, label, user) in CC_VARIANTS
Expand Down Expand Up @@ -297,7 +277,7 @@ JAVA17 |= {
for (tag_base, label) in JAVA_VARIATIONS
}

## JAVA 21 (experimental for now)
## JAVA 21 from temurin
JAVA_21_ARCHITECTURES = [
"amd64",
"arm64",
Expand Down Expand Up @@ -341,6 +321,17 @@ ALL |= JAVA17

ALL |= JAVA21

# create additional tags by appending COMMIT_SHA to all tags
# remove "latest" if they contain it (this is brittle if we make funky changes):
# - image:latest -> image:{COMMIT_SHA}
# - image:latest-xyz -> image:xyz-{COMMIT_SHA}
COMMIT_SUFFIXED_TAGS = {
(image_ref.replace("latest", "") + "-{COMMIT_SHA}").replace(":-", ":"): build_target
for (image_ref, build_target) in ALL.items()
}

ALL |= COMMIT_SUFFIXED_TAGS

sign_and_push_all(
name = "sign_and_push",
images = ALL,
Expand Down
Loading