forked from mikeroyal/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
159 lines (142 loc) · 5.03 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
load("@bazel_gazelle//:def.bzl", "gazelle")
gazelle(
name = "gazelle",
prefix = "kubevirt.io",
)
genrule(
name = "get-version",
srcs = [],
outs = [".version"],
cmd = "grep ^STABLE_BUILD_SCM_REVISION bazel-out/stable-status.txt | cut -d' ' -f2 >$@",
stamp = 1,
visibility = ["//visibility:public"],
)
genrule(
name = "libvirt-shared-libs",
srcs = ["@libvirt_libs//file"],
outs = [
"libvirt.so.0.5000.0",
"libvirt-lxc.so.0.5000.0",
"libvirt-qemu.so.0.5000.0",
],
cmd = "\n".join([
"rpm2archive $(location @libvirt_libs//file)",
"tar -xzf $(location @libvirt_libs//file).tgz",
"cp -R usr/lib64/*.so.0.5000.0 $(@D)",
]),
)
cc_library(
name = "libvirt-libs",
srcs = [
":libvirt-shared-libs",
],
visibility = ["//visibility:public"],
)
genrule(
name = "libvirt-devel-headers",
srcs = ["@libvirt_devel//file"],
outs = [
"libvirt/libvirt-admin.h",
"libvirt/libvirt-common.h",
"libvirt/libvirt-domain.h",
"libvirt/libvirt-domain-snapshot.h",
"libvirt/libvirt-event.h",
"libvirt/libvirt.h",
"libvirt/libvirt-host.h",
"libvirt/libvirt-interface.h",
"libvirt/libvirt-lxc.h",
"libvirt/libvirt-network.h",
"libvirt/libvirt-nodedev.h",
"libvirt/libvirt-nwfilter.h",
"libvirt/libvirt-qemu.h",
"libvirt/libvirt-secret.h",
"libvirt/libvirt-storage.h",
"libvirt/libvirt-stream.h",
"libvirt/virterror.h",
],
cmd = "\n".join([
"rpm2archive $(location @libvirt_devel//file)",
"tar -xzf $(location @libvirt_devel//file).tgz",
"cp -R usr/include/libvirt $(@D)",
]),
)
cc_library(
name = "libvirt-headers",
hdrs = [
":libvirt-devel-headers",
],
visibility = ["//visibility:public"],
)
load("@io_bazel_rules_docker//contrib:passwd.bzl", "passwd_entry", "passwd_file")
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
passwd_entry(
name = "nonroot-user",
home = "/home/nonroot-user",
shell = "/bin/bash",
uid = 1001,
gid = 1001,
username = "nonroot-user",
)
passwd_file(
name = "passwd",
entries = [
":nonroot-user",
],
)
pkg_tar(
name = "passwd-tar",
srcs = [":passwd"],
mode = "0644",
package_dir = "etc",
visibility = ["//visibility:public"],
)
load(
"@io_bazel_rules_docker//container:container.bzl",
"container_image",
container_repositories = "repositories",
)
container_image(
name = "passwd-image",
base = "@fedora//image",
tars = [":passwd-tar"],
user = "1001",
visibility = ["//visibility:public"],
)
load(
"@io_bazel_rules_docker//container:container.bzl",
"container_bundle",
container_repositories = "repositories",
)
config_setting(
name = "release",
values = {"define": "release=true"},
)
container_bundle(
name = "build-images",
images = {
# cmd images
"$(container_prefix)/container-disk-v1alpha:$(container_tag)": "//cmd/container-disk-v1alpha:container-disk-v1alpha-image",
"$(container_prefix)/example-hook-sidecar:$(container_tag)": "//cmd/example-hook-sidecar:example-hook-sidecar-image",
"$(container_prefix)/subresource-access-test:$(container_tag)": "//cmd/subresource-access-test:subresource-access-test-image",
"$(container_prefix)/virt-controller:$(container_tag)": "//cmd/virt-controller:virt-controller-image",
"$(container_prefix)/virt-launcher:$(container_tag)": "//cmd/virt-launcher:virt-launcher-image",
"$(container_prefix)/virt-handler:$(container_tag)": "//cmd/virt-handler:virt-handler-image",
"$(container_prefix)/virt-api:$(container_tag)": "//cmd/virt-api:virt-api-image",
"$(container_prefix)/virt-operator:$(container_tag)": "//cmd/virt-operator:virt-operator-image",
# container-disk images
"$(container_prefix)/alpine-container-disk-demo:$(container_tag)": "//cmd/container-disk-v1alpha:alpine-container-disk-image",
"$(container_prefix)/cirros-container-disk-demo:$(container_tag)": "//cmd/container-disk-v1alpha:cirros-container-disk-image",
"$(container_prefix)/fedora-cloud-container-disk-demo:$(container_tag)": "//cmd/container-disk-v1alpha:fedora-cloud-container-disk-image",
"$(container_prefix)/virtio-container-disk:$(container_tag)": "//cmd/container-disk-v1alpha:virtio-container-disk-image",
# testing images
"$(container_prefix)/disks-images-provider:$(container_tag)": "//images/disks-images-provider:disks-images-provider-image",
"$(container_prefix)/cdi-http-import-server:$(container_tag)": "//images/cdi-http-import-server:cdi-http-import-server-image",
"$(container_prefix)/vm-killer:$(container_tag)": "//images/vm-killer:vm-killer-image",
"$(container_prefix)/winrmcli:$(container_tag)": "//images/winrmcli:winrmcli-image",
},
)
load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push")
docker_push(
name = "push-images",
bundle = ":build-images",
)