-
-
Notifications
You must be signed in to change notification settings - Fork 152
/
setup_assertion_repos.bzl
87 lines (74 loc) · 2.74 KB
/
setup_assertion_repos.bzl
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
"Setup for docker testing"
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
def _impl_configure_docker(rctx):
# See if docker_host is set
has_docker = "DOCKER_HOST" in rctx.os.environ
# See if standard docker sock exists
if not has_docker:
r = rctx.execute(["stat", "/var/run/docker.sock"])
if r.return_code == 0:
has_docker = True
compatible_with = "[]" if has_docker else '["@platforms//:incompatible"]'
rctx.file("defs.bzl", """
# Generated by configure_docker.bzl
TARGET_COMPATIBLE_WITH = %s
""" % compatible_with)
rctx.file("BUILD.bazel", 'exports_files(["defs.bzl"])')
pass
configure_docker = repository_rule(
implementation = _impl_configure_docker,
)
def setup_assertion_repos():
"creates repos necessary for testing agaisnt docker"
http_file(
name = "jd_darwin_arm64",
urls = [
"https://github.com/josephburnett/jd/releases/download/v1.8.1/jd-arm64-darwin",
],
sha256 = "8b0e51b902650287b7dedc2beee476b96c5d589309d3a7f556334c1baedbec61",
executable = True,
)
http_file(
name = "jd_darwin_amd64",
urls = [
"https://github.com/josephburnett/jd/releases/download/v1.8.1/jd-amd64-darwin",
],
sha256 = "c5fb5503d2804b1bf631bf12616d56b89711fd451ab233b688ca922402ff3444",
executable = True,
)
http_file(
name = "jd_linux_amd64",
urls = [
"https://github.com/josephburnett/jd/releases/download/v1.8.1/jd-amd64-linux",
],
sha256 = "ab918f52130561abd4f88d9c2d3ae95d4d56f1a2dff9762665890349d61c763e",
executable = True,
)
http_archive(
name = "docker_cli_darwin_arm64",
urls = [
"https://download.docker.com/mac/static/stable/aarch64/docker-23.0.0.tgz",
],
integrity = "sha256-naXFF3G/D3a8XieHkd2cm29/SHdheslS3VyI77ep/xA=",
strip_prefix = "docker",
build_file_content = 'exports_files(["docker"])',
)
http_archive(
name = "docker_cli_darwin_amd64",
urls = [
"https://download.docker.com/mac/static/stable/x86_64/docker-23.0.0.tgz",
],
integrity = "sha256-55P6RTHVIWEHuEuH8ZHFgu6TeCVPF7WqvPD6MBApOuc=",
strip_prefix = "docker",
build_file_content = 'exports_files(["docker"])',
)
http_archive(
name = "docker_cli_linux_amd64",
urls = [
"https://download.docker.com/linux/static/stable/x86_64/docker-23.0.0.tgz",
],
integrity = "sha256-agO72paEW3RRvi9qumnDgWxgqX3jGOg/0bOdG+Ji2K8=",
strip_prefix = "docker",
build_file_content = 'exports_files(["docker"])',
)
configure_docker(name = "docker_configure")