1load("@container_structure_test//:defs.bzl", "container_structure_test")
2load("@rules_apko//apko:defs.bzl", "apko_image")
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
7pkg_tar(
8 name = "config",
9 extension = "tgz",
10 files = {
11 ":sysctl.conf": "sysctl.conf",
12 },
13 mode = "440",
14 package_dir = "/etc/",
15 tags = [
16 "manual",
17 "no-remote-cache",
18 ],
19)
20
21pkg_tar(
22 name = "entrypoint",
23 extension = "tgz",
24 files = {
25 ":wg-sync.sh": "wg-sync.sh",
26 },
27 mode = "550",
28 package_dir = "/entrypoint",
29 tags = [
30 "manual",
31 "no-remote-cache",
32 ],
33)
34
35apko_image(
36 name = "wireguard_base",
37 config = "apko.yaml",
38 contents = "@wireguard_lock//:contents",
39 tag = "wireguard_base:latest",
40 tags = ["requires-network"],
41)
42
43oci_image(
44 name = "wireguard-image",
45 base = ":wireguard_base",
46 entrypoint = ["/entrypoint/wg-sync.sh"],
47 tags = [
48 "manual",
49 "no-remote-cache",
50 ],
51 tars = [
52 ":entrypoint",
53 ":config",
54 ],
55)
56
57oci_load(
58 name = "wireguard-load",
59 image = ":wireguard-image",
60 repo_tags = ["latest"],
61 tags = ["manual"],
62)
63
64filegroup(
65 name = "wireguard.tar",
66 srcs = [":wireguard-load"],
67 output_group = "tarball",
68)
69
70container_structure_test(
71 name = "wireguard-test",
72 configs = [":wireguard-container-test.yaml"],
73 driver = "tar",
74 image = ":wireguard.tar",
75)
76
77container_push(
78 image = ":wireguard-image",
79 image_name = "wireguard-alpine",
80 repository_file = "//hack/build/rules/container:workloads-repo",
81 tags = ["manual"],
82)
View as plain text