-
Notifications
You must be signed in to change notification settings - Fork 163
/
BUILD.plz
93 lines (85 loc) · 3.19 KB
/
BUILD.plz
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
github_repo(
name = "pleasings2",
repo = "sagikazarmark/mypleasings",
revision = "09137dd3e633e2c4dc37f8b840e824a9ceb35d3e",
)
genrule(
name = "docker-compose.override.yml",
srcs = ["docker-compose.override.yml.dist"],
outs = ["docker-compose.override.yml"],
cmd = "cat docker-compose.override.yml.dist | sed -e \"s/# user: \\\"\\\\${uid}:\\\\${gid}\\\"/user: \\\"$(id -u):$(id -g)\\\"/\" > \"$OUTS\"" if CONFIG.HOSTOS == "linux" else 'cp docker-compose.override.yml.dist "$OUTS"',
)
sh_cmd(
name = "up",
cmd = [
"if [ ! -f etc/config/dex.yml ]; then plz make //etc/config:dex.yml; fi",
"if [ ! -f config/ui/feature-set.json ]; then plz make //config/ui:feature-set.json; fi",
"if [ ! -f config/config.yaml ]; then plz make //config:config.yaml; fi",
"$(out_location :start)",
],
deps = [":start"],
)
sh_cmd(
name = "down",
cmd = [
"docker-compose down -v",
"sudo rm -rf .docker/" if CONFIG.HOSTOS == "linux" else "rm -rf .docker/",
],
)
sh_cmd(
name = "start",
cmd = [
"if [ ! -f docker-compose.override.yml ]; then plz make :docker-compose.override.yml; fi",
"mkdir -p .docker/volumes/{mysql,postgres,vault/file,vault/keys}",
"docker-compose up -d",
],
)
sh_cmd(
name = "stop",
cmd = "docker-compose stop",
)
remote_file(
name = "kube-apiserver",
out = "bin/test/kube-apiserver",
binary = True,
hashes = [
"9e5800c171e55973d33cbc751226b0b9bc27cfbe16fa039c98572ad50ef6c1dc", # Note: v1.19.11, linux, amd64.
"c80fbbccc726b0f2ad5fcd52e1395b3354705513326b83f45213f5ddd33a338f", # Note: v1.19.11, linux, arm64.
],
test_only = True,
url = [
f"https://dl.k8s.io/v{CONFIG.KUBE_APISERVER_VERSION}/bin/{CONFIG.HOSTOS}/{CONFIG.HOSTARCH}/kube-apiserver",
f"https://dl.k8s.io/v{CONFIG.KUBE_APISERVER_VERSION}/bin/linux/{CONFIG.HOSTARCH}/kube-apiserver", # Note: fallback until other OSes become available to not break `plz build` on macOS.
],
)
_etcd_archive_extension = {
"darwin": "zip",
"linux": "tar.gz",
"windows": "zip",
}
remote_file(
name = "etcd",
out = "bin/test/etcd",
binary = True,
exported_files = [
f"etcd-v{CONFIG.ETCD_VERSION}-{CONFIG.HOSTOS}-{CONFIG.HOSTARCH}/etcd",
],
extract = True,
hashes = [
"8bd279948877cfb730345ecff2478f69eaaa02513c2a43384ba182c9985267bd", # Note: v3.5.5, darwin, amd64, zip.
"33094133a771b2d086dc04f2ede41c249258947042de72132af127972880171f", # Note: v3.5.5, darwin, arm64, zip.
"7910a2fdb1863c80b885d06f6729043bff0540f2006bf6af34674df2636cb906", # Note: v3.5.5, linux, amd64, tar.gz.
"a8d177ae8ecfd1ef025c35ac8c444041d14e67028c1a7b4eda3a69a8dee5f9c3", # Note: v3.5.5, linux, arm64, tar.gz.
"bcabe6bbeb1ac0b91395e19856e39c1056c05eb303b714670876acf21158bd3f", # Note: v3.5.5, windows, amd64, zip.
],
test_only = True,
url = [
"https://github.com/etcd-io/etcd/releases/download/v%s/etcd-v%s-%s-%s.%s" % (
CONFIG.ETCD_VERSION,
CONFIG.ETCD_VERSION,
CONFIG.HOSTOS,
CONFIG.HOSTARCH,
_etcd_archive_extension[CONFIG.HOSTOS],
),
],
)