Last active
September 8, 2021 23:06
-
-
Save nij4t/7e53f99d8d909baede3cd22123aa4f80 to your computer and use it in GitHub Desktop.
Bazel Commands
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
# `services` is a directory with application services that are packages as docker containers. | |
# It has source codes as well as BUILD.bazel files that define container images for each service. | |
# We ask git to give us a list of changed files in services directory which is then piped into | |
# bazel query comand that will give you all container image targets that should be rebuild. | |
git diff --name-only services ${PREVIOUS_REVISION} | xargs -I{dep} bazel query 'kind("_app_layer", rdeps(//services, {dep}))' | |
# building changed packages | |
bazelisk build `git diff --name-only ${PREVIOUS_REVISION} | xargs -I{dep} -P8 bazelisk query 'rdeps(//..., {dep})' --output package` | |
# publishing docker container image with current revision | |
bazelisk run //fizzbuzz:publish --define VERSION=$(git rev-parse HEAD | head -c8) --define SERVICE=fizzbuzz | |
# publishing docker container image with git tag | |
bazelisk run //fizzbuzz:publish --define VERSION=$(git describe) --define SERVICE=fizzbuzz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment