Created
May 31, 2019 17:38
-
-
Save steeve/2c1608d007764f5e6a32802ed9980735 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
genrule( | |
name = "kubeconfig", | |
stamp = True, | |
outs = ["k3s.yaml"], | |
cmd = """\ | |
docker cp k3s:/etc/rancher/k3s/k3s.yaml $@ | |
""", | |
visibility = ["//visibility:public"], | |
) |
This file contains hidden or 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
# Inject k3s container id in the workspace | |
k3s_id=$(docker ps -aqf "name=k3s") | |
echo "STABLE_K3S_CONTAINER_ID" "${k3s_id}" |
I also have this handy rule, for quick stamp references in genrules/shell scripts:
genrule(
name = "stamps_sh",
outs = ["stamps.sh"],
cmd = """sed -E 's/ +/=/' bazel-out/stable-status.txt > $@""",
stamp = True,
visibility = ["//visibility:public"],
)
Which is then used:
. $(location //:stamps_sh)
echo ${STABLE_SOME_KEY} > $@
@steeve can you share the build rules that can spin up a k3s cluster?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
k3s_id
changes, and thus introduces stamp invalidation to the genrule, which is then re-executed.