1load("@container_structure_test//:defs.bzl", "container_structure_test")
2load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
3load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
4load("@rules_pkg//:pkg.bzl", "pkg_tar")
5load("//hack/build/rules/container:index.bzl", "container_push")
6
7go_library(
8 name = "apko-updater-bot_lib",
9 srcs = ["main.go"],
10 importpath = "edge-infra.dev/hack/tools/apko-updater-bot",
11 visibility = ["//visibility:private"],
12 deps = ["//hack/tools/apko-updater-bot/cmd"],
13)
14
15go_binary(
16 name = "apko-updater-bot",
17 embed = [":apko-updater-bot_lib"],
18 visibility = ["//visibility:public"],
19)
20
21go_binary(
22 name = "apko-updater-bot-linux",
23 embed = [":apko-updater-bot_lib"],
24 goarch = "amd64",
25 goos = "linux",
26 visibility = ["//visibility:public"],
27)
28
29pkg_tar(
30 name = "base_pkgs",
31 srcs = [
32 "@apko_linux_amd64//:file",
33 ],
34 extension = "tgz",
35 files = {
36 ":apko-updater-bot-linux": "apko-updater-bot",
37 },
38 mode = "755",
39 package_dir = "/usr/local/bin",
40)
41
42oci_image(
43 name = "apko-updater-bot-base",
44 base = "@distroless_base",
45 tars = [
46 ":base_pkgs",
47 ],
48)
49
50oci_load(
51 name = "apko-updater-bot-load",
52 image = ":apko-updater-bot-base",
53 repo_tags = ["apko-updater-bot:latest"],
54)
55
56filegroup(
57 name = "apko-updater-bot.tar",
58 srcs = [":apko-updater-bot-load"],
59 output_group = "tarball",
60)
61
62container_structure_test(
63 name = "test",
64 configs = [
65 ":test.yaml",
66 ],
67 driver = "tar",
68 image = ":apko-updater-bot.tar",
69 tags = ["manual"],
70)
71
72container_push(
73 name = "container_push",
74 image = ":apko-updater-bot-base",
75 image_name = "apko-updater",
76 repository_file = "//hack/build/rules/container:workloads-repo",
77 tags = ["requires-network"],
78)
View as plain text