blob: f54cdfb1c5861f856e91b54577009f3aaa415d8f [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 },
26 visibility = ["//osbase/oci:__subpackages__"],
27)
28
29oci_os_image(
30 name = "test_image_uncompressed",
31 srcs = {
32 "test": "//third_party/linux",
33 },
34 compression_level = 0,
35 visibility = ["//osbase/oci:__subpackages__"],
36)
37
38go_test(
39 name = "osimage_test",
40 srcs = ["osimage_test.go"],
41 data = [
42 ":test_image",
43 ":test_image_uncompressed",
44 "//third_party/linux",
45 ],
46 embed = [":osimage"],
47 x_defs = {
48 "xImagePath": "$(rlocationpath :test_image )",
49 "xImageUncompressedPath": "$(rlocationpath :test_image_uncompressed )",
50 "xTestPayloadPath": "$(rlocationpath //third_party/linux )",
51 },
52 deps = [
53 "//osbase/oci",
54 "//osbase/oci/registry",
55 "@com_github_cenkalti_backoff_v4//:backoff",
56 "@com_github_opencontainers_image_spec//specs-go/v1:specs-go",
57 "@io_bazel_rules_go//go/runfiles",
58 ],
59)