Skip to content

Commit 96f109a

Browse files
committed
feat: support docker/metadata-action for tags on GitHub
1 parent bde3e89 commit 96f109a

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

containers/debian/base.hcl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@ variable "BUILD_IMAGE" { default = "debian_base" }
44
# Variables whose defaults can be overridden on build
55
variable "BASE_IMAGE" { default = null }
66

7+
# docker/metadata-action overrides the following target with tags
8+
# but we implement it for use outside docker/metadata-action
9+
target "docker-metadata-action" {
10+
tags = compact(flatten([
11+
join("/", compact([ CI_REGISTRY, CI_PROJECT_PATH, "${BUILD_IMAGE}:${INTERNAL_TAG}"]) ),
12+
EXPORT_TAG != null && EXPORT_TAG != "" ? [
13+
for registry in registries: "${registry}/${BUILD_IMAGE}:${EXPORT_TAG}"
14+
] : [ null ]
15+
]))
16+
}
17+
718
target "default" {
19+
inherits = ["docker-metadata-action"]
820
attest = [
921
"type=provenance,disabled=true"
1022
]
@@ -15,10 +27,4 @@ target "default" {
1527
BASE_IMAGE = BASE_IMAGE
1628
BUILD_IMAGE = BUILD_IMAGE
1729
}
18-
tags = compact(flatten([
19-
join("/", compact([ CI_REGISTRY, CI_PROJECT_PATH, "${BUILD_IMAGE}:${INTERNAL_TAG}"]) ),
20-
EXPORT_TAG != null && EXPORT_TAG != "" ? [
21-
for registry in registries: "${registry}/${BUILD_IMAGE}:${EXPORT_TAG}"
22-
] : [ null ]
23-
]))
2430
}

containers/jug/dev.hcl

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,23 @@ image_names = [
2828
replace(image_name,"eic","jug")
2929
]
3030

31+
# docker/metadata-action overrides the following target with tags
32+
# but we implement it for use outside docker/metadata-action
33+
target "docker-metadata-action" {
34+
tags = compact(flatten([
35+
[
36+
for image_name in image_names:
37+
join("/", compact([ CI_REGISTRY, CI_PROJECT_PATH, "${image_name}:${INTERNAL_TAG}"]) )
38+
],
39+
EXPORT_TAG != null && EXPORT_TAG != "" ? [
40+
for registry_image_name in setproduct(registries, image_names):
41+
format("%s:%s", join("/", registry_image_name), EXPORT_TAG )
42+
] : [ null ]
43+
]))
44+
}
45+
3146
target "default" {
47+
inherits = ["docker-metadata-action"]
3248
attest = [
3349
"type=provenance,disabled=true"
3450
]
@@ -63,14 +79,4 @@ target "default" {
6379
EPIC_VERSION = BUILD_TYPE == "default" ? EPIC_VERSION : "main"
6480
JUGGLER_VERSION = BUILD_TYPE == "default" ? JUGGLER_VERSION : "main"
6581
}
66-
tags = compact(flatten([
67-
[
68-
for image_name in image_names:
69-
join("/", compact([ CI_REGISTRY, CI_PROJECT_PATH, "${image_name}:${INTERNAL_TAG}"]) )
70-
],
71-
EXPORT_TAG != null && EXPORT_TAG != "" ? [
72-
for registry_image_name in setproduct(registries, image_names):
73-
format("%s:%s", join("/", registry_image_name), EXPORT_TAG )
74-
] : [ null ]
75-
]))
7682
}

0 commit comments

Comments
 (0)