Skip to content

Commit 6a0ef78

Browse files
committed
Rework build into reusable pieces
- only static, base and cc - standardize their debug image naming (//image:image_debug instead of //image:debug) Signed-off-by: Appu Goundan <[email protected]>
1 parent 28ee1eb commit 6a0ef78

File tree

25 files changed

+408
-307
lines changed

25 files changed

+408
-307
lines changed

.github/workflows/image-check.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ jobs:
6969
./verbose.log
7070
./report.log
7171
72+
- name: Write diff to job output for forks
73+
if: ${{ github.event.pull_request.head.repo.fork && steps.diff.outputs.changed_targets }}
74+
run: |
75+
echo "This pull request has modified the following images:"
76+
echo ${{ steps.diff.outputs.changed_targets }}
77+
7278
- uses: peter-evans/find-comment@v4
7379
id: fc
7480
if: ${{ !github.event.pull_request.head.repo.fork }}

BUILD

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("//:checksums.bzl", "ARCHITECTURES", "BASE_ARCHITECTURES")
2-
load("//base:distro.bzl", "DISTROS", "PREVIEW_DISTROS")
2+
load("//:distro.bzl", "DISTROS", "PREVIEW_DISTROS")
33
load("//private/oci:defs.bzl", "sign_and_push_all")
44
load("//nodejs:node_arch.bzl", "node_arch")
55

@@ -16,27 +16,27 @@ STATIC_VARIANTS = [
1616
]
1717

1818
STATIC = {
19-
"{REGISTRY}/{PROJECT_ID}/static:" + tag_base + "-" + arch: "//base:" + label + "_" + user + "_" + arch + "_" + DEFAULT_DISTRO
19+
"{REGISTRY}/{PROJECT_ID}/static:" + tag_base + "-" + arch: "//static:" + label + "_" + user + "_" + arch + "_" + DEFAULT_DISTRO
2020
for arch in ARCHITECTURES
2121
for (tag_base, label, user) in STATIC_VARIANTS
2222
}
2323

2424
# oci_image_index
2525
STATIC |= {
26-
"{REGISTRY}/{PROJECT_ID}/static:" + tag_base: "//base:" + label + "_" + user + "_" + DEFAULT_DISTRO
26+
"{REGISTRY}/{PROJECT_ID}/static:" + tag_base: "//static:" + label + "_" + user + "_" + DEFAULT_DISTRO
2727
for (tag_base, label, user) in STATIC_VARIANTS
2828
}
2929

3030
STATIC |= {
31-
"{REGISTRY}/{PROJECT_ID}/static-" + distro + ":" + tag_base + "-" + arch: "//base:" + label + "_" + user + "_" + arch + "_" + distro
31+
"{REGISTRY}/{PROJECT_ID}/static-" + distro + ":" + tag_base + "-" + arch: "//static:" + label + "_" + user + "_" + arch + "_" + distro
3232
for arch in ARCHITECTURES
3333
for (tag_base, label, user) in STATIC_VARIANTS
3434
for distro in DISTROS + PREVIEW_DISTROS
3535
}
3636

3737
# oci_image_index
3838
STATIC |= {
39-
"{REGISTRY}/{PROJECT_ID}/static-" + distro + ":" + tag_base: "//base:" + label + "_" + user + "_" + distro
39+
"{REGISTRY}/{PROJECT_ID}/static-" + distro + ":" + tag_base: "//static:" + label + "_" + user + "_" + distro
4040
for (tag_base, label, user) in STATIC_VARIANTS
4141
for distro in DISTROS + PREVIEW_DISTROS
4242
}
@@ -45,8 +45,8 @@ STATIC |= {
4545
BASE_VARIANTS = [
4646
("latest", "base", "root"),
4747
("nonroot", "base", "nonroot"),
48-
("debug", "debug", "root"),
49-
("debug-nonroot", "debug", "nonroot"),
48+
("debug", "base_debug", "root"),
49+
("debug-nonroot", "base_debug", "nonroot"),
5050
]
5151

5252
BASE = {
@@ -113,8 +113,8 @@ BASE_NOSSL |= {
113113
CC_VARIANTS = [
114114
("latest", "cc", "root"),
115115
("nonroot", "cc", "nonroot"),
116-
("debug", "debug", "root"),
117-
("debug-nonroot", "debug", "nonroot"),
116+
("debug", "cc_debug", "root"),
117+
("debug-nonroot", "cc_debug", "nonroot"),
118118
]
119119

120120
CC = {

base/BUILD

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,46 @@
1-
load(":base.bzl", "base_images")
2-
load(":distro.bzl", "DISTROS", "PREVIEW_DISTROS")
1+
load(":base.bzl", "base_image", "base_image_index", "base_nossl_image", "base_nossl_image_index")
2+
load("//:distro.bzl", "DISTROS", "PREVIEW_DISTROS")
3+
load("//:checksums.bzl", "ARCHITECTURES")
34

45
package(default_visibility = ["//visibility:public"])
56

7+
BASE_DISTROS = DISTROS + PREVIEW_DISTROS
8+
9+
BASE_ARCHITECTURES = ARCHITECTURES
10+
11+
# base nossl
12+
[
13+
base_nossl_image(
14+
arch = arch,
15+
distro = distro,
16+
)
17+
for distro in BASE_DISTROS
18+
for arch in BASE_ARCHITECTURES
19+
]
20+
21+
[
22+
base_nossl_image_index(
23+
architectures = BASE_ARCHITECTURES,
24+
distro = distro,
25+
)
26+
for distro in BASE_DISTROS
27+
]
28+
29+
# base (with libssl)
30+
31+
[
32+
base_image(
33+
arch = arch,
34+
distro = distro,
35+
)
36+
for distro in BASE_DISTROS
37+
for arch in BASE_ARCHITECTURES
38+
]
39+
640
[
7-
base_images(distro = distro)
8-
for distro in DISTROS + PREVIEW_DISTROS
41+
base_image_index(
42+
architectures = BASE_ARCHITECTURES,
43+
distro = distro,
44+
)
45+
for distro in BASE_DISTROS
946
]

0 commit comments

Comments
 (0)