blob: 62a14010e80869fe37f291624c7f7a6147d7a732 [file] [log] [blame]
Jan Schär56d12992025-04-14 11:49:37 +00001load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
2load("//osbase/build/mkoci:def.bzl", "oci_os_image")
Jan Schärc53a9fc2025-04-14 11:09:27 +00003
4go_library(
5 name = "osimage",
6 srcs = [
7 "osimage.go",
8 "types.go",
9 ],
10 importpath = "source.monogon.dev/osbase/oci/osimage",
11 visibility = ["//visibility:public"],
12 deps = [
13 "//osbase/oci",
14 "//osbase/structfs",
15 "@com_github_klauspost_compress//zstd",
16 ],
17)
Jan Schär56d12992025-04-14 11:49:37 +000018
19oci_os_image(
20 name = "test_image",
21 srcs = {
22 # We need some test payload, which should be multiple MB in size to test
23 # the chunking, but also not too large.
24 "test": "//third_party/linux",
25 },
Jan Schär07e69052025-05-12 16:34:15 +000026 product_info = ":test_product_info.json",
Jan Schär56d12992025-04-14 11:49:37 +000027 visibility = ["//osbase/oci:__subpackages__"],
28)
29
30oci_os_image(
31 name = "test_image_uncompressed",
32 srcs = {
33 "test": "//third_party/linux",
34 },
35 compression_level = 0,
Jan Schär07e69052025-05-12 16:34:15 +000036 product_info = ":test_product_info.json",
Jan Schär56d12992025-04-14 11:49:37 +000037 visibility = ["//osbase/oci:__subpackages__"],
38)
39
40go_test(
41 name = "osimage_test",
42 srcs = ["osimage_test.go"],
43 data = [
44 ":test_image",
45 ":test_image_uncompressed",
46 "//third_party/linux",
47 ],
48 embed = [":osimage"],
49 x_defs = {
50 "xImagePath": "$(rlocationpath :test_image )",
51 "xImageUncompressedPath": "$(rlocationpath :test_image_uncompressed )",
52 "xTestPayloadPath": "$(rlocationpath //third_party/linux )",
53 },
54 deps = [
55 "//osbase/oci",
56 "//osbase/oci/registry",
57 "@com_github_cenkalti_backoff_v4//:backoff",
58 "@com_github_opencontainers_image_spec//specs-go/v1:specs-go",
59 "@io_bazel_rules_go//go/runfiles",
60 ],
61)