mirror of
https://github.com/urbit/shrub.git
synced 2024-12-18 15:55:00 +03:00
578adc9363
Rather than conditional reconstructing the "urbit/bin/urbit-debug -g" string everytime using the debug conditional, this information has been added to the derivation's .meta attribute.
31 lines
698 B
Bash
Executable File
31 lines
698 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
say() {
|
|
echo "$1" >&2
|
|
}
|
|
|
|
git_sha="$(git rev-parse HEAD)"
|
|
git_sha="${git_sha:0:8}"
|
|
|
|
git_branch="$(git branch --show-current)"
|
|
|
|
git_tag="${git_branch}-${git_sha}"
|
|
|
|
say "Building nix/ops/image..."
|
|
nix_out="$(nix-build nix/ops -A image --no-out-link "$@")"
|
|
|
|
say "Loading $nix_out into Docker..."
|
|
nix_name="$(docker load --quiet --input $nix_out)"
|
|
nix_name="${nix_name#Loaded image: }"
|
|
|
|
say "Re-tagging with git metadata..."
|
|
image_repo="$(docker images $nix_name --format '{{.Repository}}')"
|
|
image_name="${image_repo}:${git_tag}"
|
|
docker tag $nix_name $image_name
|
|
|
|
# Output only the new tag on stdout for subsequent pipes/tooling.
|
|
say $nix_name
|
|
echo $image_name
|