forked from bazel-contrib/rules_oci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.bazel
74 lines (69 loc) · 2.41 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
load("@aspect_bazel_lib//lib:diff_test.bzl", "diff_test")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load(":pull_tests.bzl", "parse_image_test")
IMAGES_TO_TEST = {
"linux/amd64": {
"distroless_java": "gcr.io/distroless/java17@sha256:161a1d97d592b3f1919801578c3a47c8e932071168a96267698f4b669c24c76d",
"distroless_static_linux_amd64": "gcr.io/distroless/static@sha256:c3c3d0230d487c0ad3a0d87ad03ee02ea2ff0b3dcce91ca06a1019e07de05f12",
"fluxcd_flux_single": "docker.io/fluxcd/flux:1.25.4",
"chainguard_static_linux_amd64": "cgr.dev/chainguard/static:latest",
},
"linux/arm64/v8": {
"ubuntu_linux_arm64_v8": "ubuntu@sha256:67211c14fa74f070d27cc59d69a7fa9aeff8e28ea118ef3babc295a0428a6d21"
}
}
# Use crane to pull images as a comparison for our oci_pull repository rule
[
genrule(
name = "pull_{}".format(repo_name),
outs = [repo_name],
cmd = "$(CRANE_BIN) pull {reference} $@ --format=oci --platform={platform}".format(
platform = platform,
reference = reference,
),
local = True, # needs to run locally to able to use credential helpers
message = "Pulling {reference} for {platform}".format(
platform = platform,
reference = reference,
),
output_to_bindir = True,
tags = ["requires-network"],
toolchains = [
"@oci_crane_toolchains//:current_toolchain",
],
visibility = ["//visibility:public"],
)
for platform in IMAGES_TO_TEST.keys()
for repo_name, reference in IMAGES_TO_TEST[platform].items()
]
[
diff_test(
name = "test_{}".format(repo_name),
file1 = repo_name,
file2 = "@{}".format(
repo_name,
),
)
for platform in IMAGES_TO_TEST.keys()
for repo_name, reference in IMAGES_TO_TEST[platform].items()
]
# assert than we don't break fetching these
build_test(
name = "pull_test",
targets = [
"@aws_lambda_python",
"@debian",
"@debian_latest",
"@debian_stable",
"@gitlab_assets_ce",
# TODO: https://github.com/bazel-contrib/rules_oci/issues/193
# "@apollo_router",
"@ecr_lambda_python",
"@from_rules_docker",
"@ubuntu",
"@es_kibana_image",
"@quay_clair_image",
"@nvidia_k8s_device_plugin_image",
],
)
parse_image_test(name = "parse_image_test")