| Jan Schär | 56d1299 | 2025-04-14 11:49:37 +0000 | [diff] [blame] | 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") |
| 2 | load("//osbase/build/mkoci:def.bzl", "oci_os_image") |
| Jan Schär | c53a9fc | 2025-04-14 11:09:27 +0000 | [diff] [blame] | 3 | |
| 4 | go_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är | 56d1299 | 2025-04-14 11:49:37 +0000 | [diff] [blame] | 18 | |
| 19 | oci_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 | |
| 29 | oci_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 | |
| 38 | go_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 | ) |