mirror of
https://github.com/urbit/shrub.git
synced 2025-01-03 10:02:32 +03:00
Merge branch 'container-image-tags' (#1798)
* container-image-tags: build: Tag container images with git branch/sha build information Signed-off-by: Jared Tobin <jared@tlon.io>
This commit is contained in:
commit
b85936ee5c
16
sh/image
16
sh/image
@ -12,12 +12,22 @@ say() {
|
||||
echo "$1" >&2
|
||||
}
|
||||
|
||||
git_sha="$(git rev-parse HEAD)"
|
||||
git_sha="${git_sha:0:8}"
|
||||
|
||||
git_branch="$(git branch --show-current)"
|
||||
|
||||
git_tag="${build}:${git_branch}-${git_sha}"
|
||||
|
||||
say "Building $build..."
|
||||
image="$(nix-build default.nix --no-out-link -A $build)"
|
||||
|
||||
say "Loading $image into Docker..."
|
||||
tag="$(docker load --quiet --input $image)"
|
||||
tag="${tag#Loaded image: }"
|
||||
nix_tag="$(docker load --quiet --input $image)"
|
||||
nix_tag="${nix_tag#Loaded image: }"
|
||||
|
||||
say "Re-tagging with current git branch:$git_branch SHA:$git_sha"
|
||||
docker tag $nix_tag $git_tag
|
||||
|
||||
# Output only the tag on stdout for subsequent pipes/tooling.
|
||||
echo $tag
|
||||
echo $git_tag
|
||||
|
Loading…
Reference in New Issue
Block a user