Skip to content

Commit 92fbf33

Browse files
ShahanaFarooquiclaude
authored andcommitted
build-release: fix VERSION build-arg and add --no-push for the docker target
Pass the computed VERSION as a build-arg, mirroring the docker-release workflow. Without it the container's VERSION is set-but-empty, `VERSION ?=` in the Makefile won't overwrite it, the git-describe fallback never runs, and `make install-program` fails with "git is required for generating version information". Also add --no-push, so a release captain can do a full test build without publishing elementsproject/lightningd:$VERSION and :latest (the target always runs `docker buildx build --push`, since multi-arch images cannot be --load'ed into the classic docker store). The build only populates the builder's cache; a subsequent run without the flag pushes from cache quickly. Co-Authored-By: Claude <claude@users.noreply.github.com>
1 parent 58863ab commit 92fbf33

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

‎tools/build-release.sh‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ fi
3131
FORCE_UNCLEAN=false
3232
VERIFY_RELEASE=false
3333
WITHOUT_ZIP=false
34+
NO_PUSH=false
3435
SUDO=
3536

3637
ALL_TARGETS="bin-Fedora bin-Ubuntu docker sign"
@@ -63,11 +64,14 @@ while [ $# -gt 0 ]; do
6364
--without-zip)
6465
WITHOUT_ZIP=true
6566
;;
67+
--no-push)
68+
NO_PUSH=true
69+
;;
6670
--sudo)
6771
SUDO=sudo
6872
;;
6973
--help)
70-
echo "Usage: [--force-version=<ver>] [--force-unclean] [--force-mtime=YYYY-MM-DD] [--verify] [TARGETS]"
74+
echo "Usage: [--force-version=<ver>] [--force-unclean] [--force-mtime=YYYY-MM-DD] [--verify] [--no-push] [TARGETS]"
7175
echo Known targets: "$ALL_TARGETS"
7276
echo "Example: tools/build-release.sh"
7377
echo "Example: tools/build-release.sh --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 bin-Fedora bin-Ubuntu sign"
@@ -213,9 +217,14 @@ if [ -z "${TARGETS##* docker *}" ] || [ -z "${TARGETS##* docker}" ]; then
213217
echo "Building Docker Images"
214218
DOCKER_USER="elementsproject"
215219
echo "Creating multi-platform images tagged as $VERSION and latest"
216-
# --load does not work with multiarch. Only --push works.
217-
# ERROR: docker exporter does not currently support exporting manifest lists
218-
DOCKER_OPTS="--push --platform linux/amd64,linux/arm64,linux/arm/v7"
220+
if $NO_PUSH; then
221+
# Build without publishing: the result only populates the builder's
222+
# cache, so a later run without --no-push pushes from cache quickly.
223+
DOCKER_OPTS="--platform linux/amd64,linux/arm64,linux/arm/v7"
224+
else
225+
DOCKER_OPTS="--push --platform linux/amd64,linux/arm64,linux/arm/v7"
226+
fi
227+
DOCKER_OPTS="$DOCKER_OPTS --build-arg VERSION=$VERSION"
219228
DOCKER_OPTS="$DOCKER_OPTS -t $DOCKER_USER/lightningd:$VERSION"
220229
DOCKER_OPTS="$DOCKER_OPTS -t $DOCKER_USER/lightningd:latest"
221230
DOCKER_OPTS="$DOCKER_OPTS --cache-to=type=local,dest=/tmp/docker-cache --cache-from=type=local,src=/tmp/docker-cache"
@@ -227,7 +236,11 @@ if [ -z "${TARGETS##* docker *}" ] || [ -z "${TARGETS##* docker}" ]; then
227236
fi
228237
# shellcheck disable=SC2086
229238
$SUDO docker buildx build $DOCKER_OPTS .
230-
echo "Pushed multi-platform images tagged as $VERSION and latest"
239+
if $NO_PUSH; then
240+
echo "Built multi-platform images without pushing (rerun without --no-push to publish)"
241+
else
242+
echo "Pushed multi-platform images tagged as $VERSION and latest"
243+
fi
231244
fi
232245

233246
if [ -z "${TARGETS##* sign *}" ] || [ -z "${TARGETS##* sign}" ]; then

0 commit comments

Comments
 (0)