Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #54 from Tatskaari/label-k8s-target
Browse files Browse the repository at this point in the history
Label k8s and docker targets to easily find them
  • Loading branch information
Tatskaari authored Dec 7, 2020
2 parents 8a2ca37 + 7fa34bc commit b85bbd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docker/docker.build_defs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def docker_image(name:str, srcs:list=[], image:str=None, version:str='',
cmd = f'echo -n "{repo}/{image}:{version}" >> $OUT',
outs = [f'{name}_fqn'],
deps = [f'{base_image}_fqn' if base_image else None],
labels = labels,
labels = labels + ["docker-fqn"],
stamp = True,
visibility = visibility,
test_only = test_only,
Expand Down Expand Up @@ -93,7 +93,7 @@ def docker_image(name:str, srcs:list=[], image:str=None, version:str='',
deps = [docker_build],
visibility = visibility,
test_only = test_only,
labels = labels,
labels = labels + ["docker-run"],
)

# docker push
Expand All @@ -104,7 +104,7 @@ def docker_image(name:str, srcs:list=[], image:str=None, version:str='',
deps = [docker_build],
visibility = visibility,
test_only = test_only,
labels = labels,
labels = labels + ["docker-push"],
)

# The TAR rule defines an output file for _save so it can be retrivable later
Expand All @@ -114,7 +114,7 @@ def docker_image(name:str, srcs:list=[], image:str=None, version:str='',
cmd = f'echo -n "" >> $OUT',
outs = [f'{name}.tar'],
deps = [f'{base_image}_fqn' if base_image else None],
labels = labels,
labels = labels + ["docker-tar"],
stamp = True,
visibility = visibility,
test_only = test_only,
Expand All @@ -128,7 +128,7 @@ def docker_image(name:str, srcs:list=[], image:str=None, version:str='',
deps = [docker_build, tar],
visibility = visibility,
test_only = test_only,
labels = labels,
labels = labels + ["docker-save"],
)
return docker_build

Expand Down
2 changes: 2 additions & 0 deletions k8s/k8s.build_defs
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ def k8s_config(name:str, srcs:list, containers:list=[], params:dict=None, visibi
name = name + '_push',
cmd = ' && '.join([f'kubectl apply -f $(out_location {x})' for x in rules]),
deps = rules,
labels = ["k8s-push"],
)

# Generate a rule to cleanup the configs.
sh_cmd(
name = name + '_cleanup',
cmd = ' && '.join([f'kubectl delete --ignore-not-found -f $(out_location {x})' for x in rules]),
deps = rules,
labels = ["k8s-cleanup"],
)
return files

0 comments on commit b85bbd0

Please sign in to comment.