-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0dacc2
commit 68b2bc1
Showing
3 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
def _minikube_tool_impl(ctx): | ||
os_build_name = "linux" | ||
if ctx.os.name.startswith("mac"): | ||
os_build_name = "darwin" | ||
ctx.download( | ||
"https://storage.googleapis.com/minikube/releases/latest/minikube-%s-amd64" % (os_build_name), | ||
output='minikube', | ||
executable=True, | ||
) | ||
ctx.file("BUILD", 'exports_files(["minikube"])') | ||
|
||
minikube_tool = repository_rule( | ||
implementation = _minikube_tool_impl, | ||
) | ||
|
||
def _minikube_start_impl(ctx): | ||
script = "{} -p airy-core start --driver=docker --cpus=4 --memory=7168 --container-runtime=containerd --ports=80:80 --extra-config=apiserver.service-nodeport-range=1-65535".format(ctx.executable._minikube_binary.path) | ||
|
||
ctx.actions.write( | ||
output = ctx.outputs.executable, | ||
content = script, | ||
is_executable = True, | ||
) | ||
|
||
runfiles = ctx.runfiles(files = [ctx.executable._minikube_binary]) | ||
return [DefaultInfo(runfiles = runfiles)] | ||
|
||
minikube_start = rule( | ||
implementation = _minikube_start_impl, | ||
executable = True, | ||
attrs = { | ||
"_minikube_binary": attr.label( | ||
executable = True, | ||
cfg = "exec", | ||
allow_files = True, | ||
default = Label("@minikube_binary//:minikube"), | ||
doc = "The Minikube binary downloaded with a repository rule.", | ||
), | ||
}, | ||
) | ||
|
||
def _minikube_stop_impl(ctx): | ||
script = "{} -p airy-core delete".format(ctx.executable._minikube_binary.path) | ||
|
||
ctx.actions.write( | ||
output = ctx.outputs.executable, | ||
content = script, | ||
is_executable = True, | ||
) | ||
|
||
runfiles = ctx.runfiles(files = [ctx.executable._minikube_binary]) | ||
return [DefaultInfo(runfiles = runfiles)] | ||
|
||
minikube_stop = rule( | ||
implementation = _minikube_stop_impl, | ||
executable = True, | ||
attrs = { | ||
"_minikube_binary": attr.label( | ||
executable = True, | ||
cfg = "exec", | ||
allow_files = True, | ||
default = Label("@minikube_binary//:minikube"), | ||
doc = "The Minikube binary downloaded with a repository rule.", | ||
), | ||
}, | ||
) |