load("@container_structure_test//:defs.bzl", "container_structure_test") load("@io_bazel_rules_go//go:def.bzl", "go_test") load("@rules_apko//apko:defs.bzl", "apko_image") load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load") load("@rules_pkg//:pkg.bzl", "pkg_tar") load("//hack/build/rules/container:index.bzl", "container_push") apko_image( name = "novnc_base", config = "apko.yaml", contents = "@novnc_lock//:contents", tag = "novnc_base:latest", tags = ["requires-network"], ) pkg_tar( name = "nginx_conf", empty_dirs = ["/etc/nginx/conf.d"], extension = "tgz", files = { ":runNginx.sh": "/bin/runNginx.sh", ":nginx/nginx.conf": "/etc/nginx/nginx.conf", ":novnc/favicon.svg": "/usr/share/nginx/html/novnc/favicon.svg", ":novnc/visibility.svg": "/usr/share/nginx/html/novnc/visibility.svg", ":novnc/visibility_off.svg": "/usr/share/nginx/html/novnc/visibility_off.svg", ":novnc/vnc_lite.html": "/usr/share/nginx/html/novnc/vnc_lite.html", }, symlinks = { "/var/log/nginx/access.log": "/dev/stdout", "/var/log/nginx/error.log": "/dev/stderr", }, tags = [ "manual", "no-remote-cache", ], ) oci_image( name = "novnc-client", base = ":novnc_base", tars = [ "@novnc//:novnc", ":nginx_conf", ], ) oci_load( name = "novnc-client-load", image = ":novnc-client", repo_tags = ["novnc_client:latest"], ) filegroup( name = "novnc-client.tar", srcs = [":novnc-client-load"], output_group = "tarball", ) container_structure_test( name = "novnc-client-test", configs = [":novnc-client-test.yaml"], driver = "tar", image = ":novnc-client.tar", ) container_push( image = ":novnc-client", image_name = "novnc", repository_file = "//hack/build/rules/container:workloads-repo", tags = [ "manual", "no-remote-cache", ], visibility = ["//visibility:public"], ) go_test( name = "novnc_test", srcs = ["novnc_test.go"], data = [ "//hack/tools:etcd", "//hack/tools:kube-apiserver", "//hack/tools:kubectl", ], embedsrcs = [ "testdata/kustomization_manifests.yaml", "testdata/local_manifests.yaml", "testdata/README.md", ], tags = [ "integration", "needs-f2-refactor", "requires-network", ], visibility = ["//visibility:public"], deps = [ "//pkg/k8s/testing/kmp", "//pkg/sds/k8s/daemonsetdns/daemonsetdnstest", "//test/f2", "//test/f2/integration", "//test/f2/x/ktest", "//test/f2/x/ktest/envtest", "//test/f2/x/ktest/kustomization", "@com_github_gorilla_websocket//:websocket", "@com_github_stretchr_testify//assert", "@io_k8s_api//core/v1:core", "@tools_gotest_v3//poll", ], ) genrule( name = "novnc_local_copy", srcs = [ "//config/pallets/sds/vnc/novnc/local", "//cmd/sds/novnc/wsserver:kustomization", ], outs = [ "testdata/kustomization_manifests.yaml", "testdata/local_manifests.yaml", ], cmd = "mkdir -p $(RULEDIR)/testdata/ && cp $(SRCS) $(RULEDIR)/testdata/", )