mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-13 12:32:48 +02:00
Merge pull request #11066 from starius/fix-docker-release
Some checks are pending
Vulnerability scan / Scan release binaries (push) Waiting to run
CI / Static Checks (push) Waiting to run
CI / Check commits (push) Waiting to run
CI / Lint code (push) Waiting to run
CI / Cross compilation (push) Waiting to run
CI / Cross compilation-1 (push) Waiting to run
CI / Cross compilation-2 (push) Waiting to run
CI / Run unit tests (push) Waiting to run
CI / Run unit tests-1 (push) Waiting to run
CI / Run unit tests-2 (push) Waiting to run
CI / Run unit tests-3 (push) Waiting to run
CI / Run unit tests-4 (push) Waiting to run
CI / Run unit tests-5 (push) Waiting to run
CI / Run unit tests-6 (push) Waiting to run
CI / Run unit tests-7 (push) Waiting to run
CI / Run unit tests-8 (push) Waiting to run
CI / Run unit tests-9 (push) Waiting to run
CI / Run basic itests (push) Waiting to run
CI / Run basic itests-1 (push) Waiting to run
CI / Run basic itests-2 (push) Waiting to run
CI / Run basic itests-3 (push) Waiting to run
CI / Run basic itests-4 (push) Waiting to run
CI / Run itests (push) Waiting to run
CI / Run itests-1 (push) Waiting to run
CI / Run itests-2 (push) Waiting to run
CI / Run itests-3 (push) Waiting to run
CI / Run itests-4 (push) Waiting to run
CI / Run itests-5 (push) Waiting to run
CI / Run itests-6 (push) Waiting to run
CI / Run itests-7 (push) Waiting to run
CI / Run windows itest (push) Waiting to run
CI / Run macOS itest (push) Waiting to run
CI / Check pinned dependencies (push) Waiting to run
CI / Check pinned dependencies-1 (push) Waiting to run
CI / Check release notes updated (push) Waiting to run
CI / Backwards compatibility test (push) Waiting to run
CI / Cache Cleanup (push) Waiting to run
CI / Send coverage report (push) Blocked by required conditions
Some checks are pending
Vulnerability scan / Scan release binaries (push) Waiting to run
CI / Static Checks (push) Waiting to run
CI / Check commits (push) Waiting to run
CI / Lint code (push) Waiting to run
CI / Cross compilation (push) Waiting to run
CI / Cross compilation-1 (push) Waiting to run
CI / Cross compilation-2 (push) Waiting to run
CI / Run unit tests (push) Waiting to run
CI / Run unit tests-1 (push) Waiting to run
CI / Run unit tests-2 (push) Waiting to run
CI / Run unit tests-3 (push) Waiting to run
CI / Run unit tests-4 (push) Waiting to run
CI / Run unit tests-5 (push) Waiting to run
CI / Run unit tests-6 (push) Waiting to run
CI / Run unit tests-7 (push) Waiting to run
CI / Run unit tests-8 (push) Waiting to run
CI / Run unit tests-9 (push) Waiting to run
CI / Run basic itests (push) Waiting to run
CI / Run basic itests-1 (push) Waiting to run
CI / Run basic itests-2 (push) Waiting to run
CI / Run basic itests-3 (push) Waiting to run
CI / Run basic itests-4 (push) Waiting to run
CI / Run itests (push) Waiting to run
CI / Run itests-1 (push) Waiting to run
CI / Run itests-2 (push) Waiting to run
CI / Run itests-3 (push) Waiting to run
CI / Run itests-4 (push) Waiting to run
CI / Run itests-5 (push) Waiting to run
CI / Run itests-6 (push) Waiting to run
CI / Run itests-7 (push) Waiting to run
CI / Run windows itest (push) Waiting to run
CI / Run macOS itest (push) Waiting to run
CI / Check pinned dependencies (push) Waiting to run
CI / Check pinned dependencies-1 (push) Waiting to run
CI / Check release notes updated (push) Waiting to run
CI / Backwards compatibility test (push) Waiting to run
CI / Cache Cleanup (push) Waiting to run
CI / Send coverage report (push) Blocked by required conditions
docker-release: fix running from Git worktree and if Go cache dir is missing
This commit is contained in:
commit
8ea98fd522
2 changed files with 43 additions and 3 deletions
6
Makefile
6
Makefile
|
|
@ -199,7 +199,11 @@ release: clean-mobile
|
|||
./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)" "$(GO_VERSION)"
|
||||
|
||||
#? docker-release: Same as release but within a docker container to support reproducible builds on BSD/MacOS platforms
|
||||
docker-release:
|
||||
docker-release-cache:
|
||||
$(call check_docker_release_cache,$(DOCKER_RELEASE_GOCACHE))
|
||||
$(call check_docker_release_cache,$(DOCKER_RELEASE_GOMODCACHE))
|
||||
|
||||
docker-release: docker-release-cache
|
||||
@$(call print, "Building release helper docker image.")
|
||||
if [ "$(tag)" = "" ]; then echo "Must specify tag=<commit_or_tag>!"; exit 1; fi
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,49 @@
|
|||
VERSION_TAG = $(shell date +%Y%m%d)-01
|
||||
VERSION_CHECK = @$(call print, "Building master with date version tag")
|
||||
|
||||
# Create these directories before Docker bind mounts them. Docker creates a
|
||||
# missing bind-mount source as root, which makes the cache unwritable because
|
||||
# the release helper deliberately runs as the invoking user.
|
||||
DOCKER_RELEASE_GOCACHE = $(shell bash -c 'cache="$$($(GOCC) env GOCACHE 2>/dev/null)" || cache=/tmp/go-cache; printf "%s" "$$cache"')
|
||||
DOCKER_RELEASE_GOMODCACHE = $(shell bash -c 'cache="$$($(GOCC) env GOMODCACHE 2>/dev/null)" || cache=/tmp/go-modcache; printf "%s" "$$cache"')
|
||||
|
||||
# A linked worktree has a .git file that points outside the worktree. Mount
|
||||
# its common Git directory at the same absolute path so tag checks and git
|
||||
# archive work inside the release helper too.
|
||||
DOCKER_RELEASE_GIT_COMMON_DIR = $(shell if [ -f .git ]; then git rev-parse --path-format=absolute --git-common-dir; fi)
|
||||
DOCKER_RELEASE_GIT_MOUNT = $(if $(DOCKER_RELEASE_GIT_COMMON_DIR),-v $(DOCKER_RELEASE_GIT_COMMON_DIR):$(DOCKER_RELEASE_GIT_COMMON_DIR):ro)
|
||||
|
||||
define check_docker_release_cache
|
||||
@cache="$(1)"; \
|
||||
if ! mkdir -p "$$cache"; then \
|
||||
echo "error: cannot create Docker release cache: $$cache"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
cache_ok=1; \
|
||||
for shard in $$(printf '%02x\n' $$(seq 0 255)); do \
|
||||
shard_dir="$$cache/$$shard"; created=; \
|
||||
if [ ! -e "$$shard_dir" ]; then \
|
||||
mkdir "$$shard_dir" || { cache_ok=; break; }; created=1; \
|
||||
fi; \
|
||||
test_dir=$$(mktemp -d "$$shard_dir/.lnd-release-cache.XXXXXX" 2>/dev/null) || { cache_ok=; break; }; \
|
||||
rmdir "$$test_dir"; \
|
||||
if [ -n "$$created" ] && ! rmdir "$$shard_dir"; then cache_ok=; break; fi; \
|
||||
done; \
|
||||
if [ -z "$$cache_ok" ]; then \
|
||||
echo "error: Docker release cache cannot create directories: $$cache"; \
|
||||
echo "hint: remove or chown root-owned files in this cache"; \
|
||||
exit 1; \
|
||||
fi
|
||||
endef
|
||||
|
||||
DOCKER_RELEASE_HELPER = docker run \
|
||||
-it \
|
||||
--rm \
|
||||
--user $(shell id -u):$(shell id -g) \
|
||||
-v $(shell pwd):/tmp/build/lnd \
|
||||
-v $(shell bash -c "$(GOCC) env GOCACHE || (mkdir -p /tmp/go-cache; echo /tmp/go-cache)"):/tmp/build/.cache \
|
||||
-v $(shell bash -c "$(GOCC) env GOMODCACHE || (mkdir -p /tmp/go-modcache; echo /tmp/go-modcache)"):/tmp/build/.modcache \
|
||||
$(DOCKER_RELEASE_GIT_MOUNT) \
|
||||
-v $(DOCKER_RELEASE_GOCACHE):/tmp/build/.cache \
|
||||
-v $(DOCKER_RELEASE_GOMODCACHE):/tmp/build/.modcache \
|
||||
-e SKIP_VERSION_CHECK \
|
||||
lnd-release-helper
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue