Skip to content

Commit b8e4513

Browse files
committed
hack: Remove the need to build wireServer.imageList
the images.all derivation builds a nice link farm which can be used instead.
1 parent 7d548f9 commit b8e4513

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,11 @@ upload-images:
319319
upload-images-dev:
320320
./hack/bin/upload-images.sh imagesUnoptimizedNoDocs
321321

322+
HOOGLE_IMAGE_DIR := $(shell mktemp -d -t wire-server-hoogle-image.XXXXXX)
323+
322324
upload-hoogle-image:
323-
./hack/bin/upload-image.sh wireServer.hoogleImage
325+
nix -v --show-trace -L build ".#wireServer.hoogleImage" --out-link=$(HOOGLE_IMAGE_DIR)/image --fallback
326+
./hack/bin/upload-image.sh $(HOOGLE_IMAGE_DIR)/image
324327

325328
#################################
326329
## cassandra / postgres management

hack/bin/upload-image.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ set -euo pipefail
1414

1515
readonly DOCKER_TAG=${DOCKER_TAG:?"Please set the DOCKER_TAG env variable"}
1616

17-
readonly usage="USAGE: $0 <image_attr>"
18-
readonly IMAGE_ATTR=${1:?$usage}
19-
20-
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
21-
ROOT_DIR=$(cd -- "$SCRIPT_DIR/../../" &>/dev/null && pwd)
22-
readonly SCRIPT_DIR ROOT_DIR
17+
readonly usage="USAGE: $0 <image_stream_file>"
18+
readonly IMAGE_STREAM_FILE=${1:?$usage}
2319

2420
credsArgs=""
2521
if [[ "${DOCKER_USER+x}" != "" ]]; then
@@ -63,10 +59,8 @@ tmp_link_store=$(mktemp -d)
6359
# product of other store paths which should already be cached and a lot of our
6460
# images should have a few common layers. More information:
6561
# https://nixos.org/manual/nixpkgs/unstable/#ssec-pkgs-dockerTools-streamLayeredImage
66-
image_stream_file="$tmp_link_store/image_stream"
67-
nix -v --show-trace -L build "$ROOT_DIR#$IMAGE_ATTR" -o "$image_stream_file"
6862
image_file="$tmp_link_store/image"
69-
"$image_stream_file" >"$image_file"
63+
"$IMAGE_STREAM_FILE" >"$image_file"
7064
repo=$(skopeo list-tags "docker-archive://$image_file" | jq -r '.Tags[0] | split(":") | .[0]')
7165
printf "*** Uploading $image_file to %s:%s\n" "$repo" "$DOCKER_TAG"
7266
# shellcheck disable=SC2086

hack/bin/upload-images.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
2020
ROOT_DIR=$(cd -- "$SCRIPT_DIR/../../" &>/dev/null && pwd)
2121
readonly SCRIPT_DIR ROOT_DIR
2222

23-
tmp_link_store=$(mktemp -d)
24-
image_list_file="$tmp_link_store/image-list"
25-
nix -v --show-trace -L build "$ROOT_DIR#wireServer.imagesList" -o "$image_list_file" --fallback
26-
2723
# Build everything first so we can benefit the most from having many cores.
28-
nix -v --show-trace -L build "$ROOT_DIR#wireServer.$IMAGES_ATTR.all" --no-link --fallback
24+
result=$(mktemp -d -t stream-images.XXXXXX)
25+
nix -v --show-trace -L build "$ROOT_DIR#wireServer.$IMAGES_ATTR.all" --out-link="$result" --fallback
2926

30-
xargs -I {} -P 10 "$SCRIPT_DIR/upload-image.sh" "wireServer.$IMAGES_ATTR.{}" < "$image_list_file"
27+
find "$result/" -print0 | xargs -0 -I {} -P 10 "$SCRIPT_DIR/upload-image.sh" {}
3128

3229
printf '*** Uploading image %s\n' nginz
33-
"$SCRIPT_DIR/upload-image.sh" nginz
30+
nginz_image=$(mktemp -d -t stream-nginz-image.XXXXXX)
31+
nix -v --show-trace -L build "$ROOT_DIR#wireServer.nginz" --out-link="$nginz_image/image" --fallback
32+
"$SCRIPT_DIR/upload-image.sh" "$nginz_image/image"

0 commit comments

Comments
 (0)