mirror of
https://github.com/kubevirt/containerized-data-importer.git
synced 2025-06-03 06:30:22 +00:00

Changeup some bazel code to be able to build the tinycore image needed for some functional tests for arm and s390x Signed-off-by: Thomas-David Griedel griedel911@gmail.com Signed-off-by: Thomas-David Griedel griedel911@gmail.com
267 lines
10 KiB
Python
267 lines
10 KiB
Python
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
|
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
|
|
load("@bazel_gazelle//:def.bzl", "gazelle")
|
|
load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair")
|
|
load("@bazeldnf//:def.bzl", "bazeldnf")
|
|
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
|
|
|
|
py_runtime(
|
|
name = "python2_runtime",
|
|
interpreter_path = "/usr/bin/python2",
|
|
python_version = "PY2",
|
|
)
|
|
|
|
py_runtime(
|
|
name = "python3_runtime",
|
|
interpreter_path = "/usr/bin/python3",
|
|
python_version = "PY3",
|
|
)
|
|
|
|
py_runtime_pair(
|
|
name = "python_runtimes",
|
|
py2_runtime = ":python2_runtime",
|
|
py3_runtime = ":python3_runtime",
|
|
)
|
|
|
|
toolchain(
|
|
name = "python_toolchain",
|
|
toolchain = ":python_runtimes",
|
|
toolchain_type = "@bazel_tools//tools/python:toolchain_type",
|
|
)
|
|
|
|
# gazelle:prefix kubevirt.io/containerized-data-importer
|
|
gazelle(name = "gazelle")
|
|
|
|
bazeldnf(name = "bazeldnf")
|
|
|
|
go_library(
|
|
name = "go_default_library",
|
|
srcs = ["doc.go"],
|
|
importpath = "kubevirt.io/containerized-data-importer",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
load(
|
|
"@io_bazel_rules_docker//container:container.bzl",
|
|
"container_bundle",
|
|
"container_image",
|
|
"container_push",
|
|
)
|
|
|
|
container_bundle(
|
|
name = "test-container-images-amd64",
|
|
images = {
|
|
"$(container_prefix)/cdi-func-test-bad-webserver:$(container_tag)": "//tools/cdi-func-test-bad-webserver:cdi-func-test-bad-webserver-image",
|
|
"$(container_prefix)/cdi-func-test-proxy:$(container_tag)": "//tools/cdi-func-test-proxy:cdi-func-test-proxy-image",
|
|
"$(container_prefix)/cdi-func-test-sample-populator:$(container_tag)": "//tools/cdi-func-test-sample-populator:cdi-func-test-sample-populator-image",
|
|
"$(container_prefix)/cdi-func-test-file-host-init:$(container_tag)": "//tools/cdi-func-test-file-host-init:cdi-func-test-file-host-init-image",
|
|
"$(container_prefix)/cdi-func-test-file-host-http:$(container_tag)": "//tools/cdi-func-test-file-host-init:cdi-func-test-file-host-http-image",
|
|
"$(container_prefix)/cdi-func-test-registry-init:$(container_tag)": "//tools/cdi-func-test-registry-init:cdi-func-test-registry-init-image",
|
|
"$(container_prefix)/cdi-func-test-registry-populate:$(container_tag)": "//tools/cdi-func-test-registry-init:cdi-func-test-registry-populate-image",
|
|
"$(container_prefix)/cdi-func-test-registry:$(container_tag)": "//tools/cdi-func-test-registry-init:cdi-func-test-registry-image",
|
|
"$(container_prefix)/imageio-init:$(container_tag)": "//tools/imageio-init:imageio-init-image",
|
|
"$(container_prefix)/vcenter-simulator:$(container_tag)": "//tools/vddk-test:vcenter-simulator",
|
|
"$(container_prefix)/vddk-init:$(container_tag)": "//tools/vddk-init:vddk-init-image",
|
|
"$(container_prefix)/vddk-test:$(container_tag)": "//tools/vddk-test:vddk-test-image",
|
|
"$(container_prefix)/cdi-func-test-tinycore:$(container_tag)": "//tests:cdi-func-test-tinycore",
|
|
"$(container_prefix)/cdi-func-test-imageio:$(container_tag)": "//tools/image-io:cdi-func-test-imageio-image",
|
|
"$(container_prefix)/cdi-func-test-cirros-qcow2:$(container_tag)": "//tests:cdi-func-test-cirros-qcow2",
|
|
},
|
|
)
|
|
|
|
container_bundle(
|
|
name = "test-container-images-aarch64",
|
|
images = {
|
|
"$(container_prefix)/cdi-func-test-bad-webserver:$(container_tag)": "//tools/cdi-func-test-bad-webserver:cdi-func-test-bad-webserver-image",
|
|
"$(container_prefix)/cdi-func-test-proxy:$(container_tag)": "//tools/cdi-func-test-proxy:cdi-func-test-proxy-image",
|
|
"$(container_prefix)/cdi-func-test-sample-populator:$(container_tag)": "//tools/cdi-func-test-sample-populator:cdi-func-test-sample-populator-image",
|
|
"$(container_prefix)/cdi-func-test-file-host-init:$(container_tag)": "//tools/cdi-func-test-file-host-init:cdi-func-test-file-host-init-image",
|
|
"$(container_prefix)/cdi-func-test-file-host-http:$(container_tag)": "//tools/cdi-func-test-file-host-init:cdi-func-test-file-host-http-image",
|
|
"$(container_prefix)/cdi-func-test-registry-init:$(container_tag)": "//tools/cdi-func-test-registry-init:cdi-func-test-registry-init-image",
|
|
"$(container_prefix)/cdi-func-test-registry-populate:$(container_tag)": "//tools/cdi-func-test-registry-init:cdi-func-test-registry-populate-image",
|
|
"$(container_prefix)/cdi-func-test-registry:$(container_tag)": "//tools/cdi-func-test-registry-init:cdi-func-test-registry-image",
|
|
"$(container_prefix)/imageio-init:$(container_tag)": "//tools/imageio-init:imageio-init-image",
|
|
"$(container_prefix)/cdi-func-test-tinycore:$(container_tag)": "//tests:cdi-func-test-tinycore",
|
|
"$(container_prefix)/cdi-func-test-imageio:$(container_tag)": "//tools/image-io:cdi-func-test-imageio-image",
|
|
"$(container_prefix)/cdi-func-test-cirros-qcow2:$(container_tag)": "//tests:cdi-func-test-cirros-qcow2",
|
|
},
|
|
)
|
|
|
|
container_bundle(
|
|
name = "test-container-images-s390x",
|
|
images = {
|
|
"$(container_prefix)/cdi-func-test-bad-webserver:$(container_tag)": "//tools/cdi-func-test-bad-webserver:cdi-func-test-bad-webserver-image",
|
|
"$(container_prefix)/cdi-func-test-proxy:$(container_tag)": "//tools/cdi-func-test-proxy:cdi-func-test-proxy-image",
|
|
"$(container_prefix)/cdi-func-test-sample-populator:$(container_tag)": "//tools/cdi-func-test-sample-populator:cdi-func-test-sample-populator-image",
|
|
"$(container_prefix)/cdi-func-test-file-host-init:$(container_tag)": "//tools/cdi-func-test-file-host-init:cdi-func-test-file-host-init-image",
|
|
"$(container_prefix)/cdi-func-test-file-host-http:$(container_tag)": "//tools/cdi-func-test-file-host-init:cdi-func-test-file-host-http-image",
|
|
"$(container_prefix)/cdi-func-test-registry-init:$(container_tag)": "//tools/cdi-func-test-registry-init:cdi-func-test-registry-init-image",
|
|
"$(container_prefix)/cdi-func-test-tinycore:$(container_tag)": "//tests:cdi-func-test-tinycore",
|
|
"$(container_prefix)/cdi-func-test-registry-populate:$(container_tag)": "//tools/cdi-func-test-registry-init:cdi-func-test-registry-populate-image",
|
|
"$(container_prefix)/cdi-func-test-registry:$(container_tag)": "//tools/cdi-func-test-registry-init:cdi-func-test-registry-image",
|
|
"$(container_prefix)/vcenter-simulator:$(container_tag)": "//tools/vddk-test:vcenter-simulator",
|
|
},
|
|
)
|
|
|
|
load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push")
|
|
|
|
|
|
|
|
alias(
|
|
name = "test-container-images",
|
|
actual = select({
|
|
"@io_bazel_rules_go//go/platform:linux_s390x":":test-container-images-s390x",
|
|
"@io_bazel_rules_go//go/platform:linux_arm64":":test-container-images-aarch64",
|
|
"//conditions:default": ":test-container-images-amd64",
|
|
})
|
|
)
|
|
|
|
docker_push(
|
|
name = "push-test-images",
|
|
bundle = ":test-container-images",
|
|
)
|
|
|
|
container_push(
|
|
name = "push-cdi-operator",
|
|
format = "Docker",
|
|
image = "//cmd/cdi-operator:cdi-operator-image",
|
|
registry = "$(container_prefix)",
|
|
repository = "cdi-operator",
|
|
tag = "$(container_tag)",
|
|
)
|
|
|
|
container_push(
|
|
name = "push-cdi-controller",
|
|
format = "Docker",
|
|
image = "//cmd/cdi-controller:cdi-controller-image",
|
|
registry = "$(container_prefix)",
|
|
repository = "cdi-controller",
|
|
tag = "$(container_tag)",
|
|
)
|
|
|
|
container_push(
|
|
name = "push-cdi-apiserver",
|
|
format = "Docker",
|
|
image = "//cmd/cdi-apiserver:cdi-apiserver-image",
|
|
registry = "$(container_prefix)",
|
|
repository = "cdi-apiserver",
|
|
tag = "$(container_tag)",
|
|
)
|
|
|
|
container_push(
|
|
name = "push-cdi-cloner",
|
|
format = "Docker",
|
|
image = "//cmd/cdi-cloner:cdi-cloner-image",
|
|
registry = "$(container_prefix)",
|
|
repository = "cdi-cloner",
|
|
tag = "$(container_tag)",
|
|
)
|
|
|
|
container_push(
|
|
name = "push-cdi-importer",
|
|
format = "Docker",
|
|
image = "//cmd/cdi-importer:cdi-importer-image",
|
|
registry = "$(container_prefix)",
|
|
repository = "cdi-importer",
|
|
tag = "$(container_tag)",
|
|
)
|
|
|
|
container_push(
|
|
name = "push-cdi-uploadproxy",
|
|
format = "Docker",
|
|
image = "//cmd/cdi-uploadproxy:cdi-uploadproxy-image",
|
|
registry = "$(container_prefix)",
|
|
repository = "cdi-uploadproxy",
|
|
tag = "$(container_tag)",
|
|
)
|
|
|
|
container_push(
|
|
name = "push-cdi-uploadserver",
|
|
format = "Docker",
|
|
image = "//cmd/cdi-uploadserver:cdi-uploadserver-image",
|
|
registry = "$(container_prefix)",
|
|
repository = "cdi-uploadserver",
|
|
tag = "$(container_tag)",
|
|
)
|
|
|
|
filegroup(
|
|
name = "test-images",
|
|
srcs = [
|
|
"//tests:images/tinyCore.iso",
|
|
"//tests:images/tinyCore.vdi",
|
|
"//tests:images/archive.tar",
|
|
"//tests:images/cirros-qcow2.img",
|
|
"//tests:images/cirros.raw",
|
|
"//tests:images/cirros-large-virtual-size.raw.xz",
|
|
"//tests:images/cirros-large-virtual-size.qcow2",
|
|
"//tests:images/cirros-large-physical-size.raw.xz",
|
|
"//tests:images/cirros-large-physical-size.qcow2",
|
|
"//tests:images/cirros-snapshot1.qcow2",
|
|
"//tests:images/cirros-snapshot2.qcow2",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "test-invalid-images",
|
|
srcs = [
|
|
"//tests:images/invalid_qcow_images/invalid-qcow-large-memory.img",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
container_image(
|
|
name = "testimage_base",
|
|
tars = select({
|
|
"@io_bazel_rules_go//go/platform:linux_s390x": [
|
|
"//rpm:testimage_s390x",
|
|
],
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": [
|
|
"//rpm:testimage_aarch64",
|
|
],
|
|
"//conditions:default": [
|
|
"//rpm:testimage_x86_64",
|
|
],
|
|
}),
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
container_image(
|
|
name = "centos_base",
|
|
tars = select({
|
|
"@io_bazel_rules_go//go/platform:linux_s390x": [
|
|
"//rpm:centos_base_s390x",
|
|
],
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": [
|
|
"//rpm:centos_base_aarch64",
|
|
],
|
|
"//conditions:default": [
|
|
"//rpm:centos_base_x86_64",
|
|
],
|
|
}),
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
genrule(
|
|
name = "ca_anchors",
|
|
outs = ["tls-ca-bundle.pem"],
|
|
cmd = "/usr/bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --comment --purpose server-auth $@",
|
|
)
|
|
|
|
genrule(
|
|
name = "build-ginkgo",
|
|
srcs = [
|
|
"//vendor/github.com/onsi/ginkgo/v2/ginkgo",
|
|
],
|
|
outs = ["ginkgo-copier"],
|
|
cmd = "echo '#!/bin/sh\n\ncp -f $(SRCS) $$1' > \"$@\"",
|
|
executable = 1,
|
|
)
|
|
|
|
pkg_tar(
|
|
name = "ca_anchors_tar",
|
|
srcs = [":ca_anchors"],
|
|
package_dir = "/etc/pki/ca-trust/extracted/pem",
|
|
visibility = ["//visibility:public"],
|
|
)
|