diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6c0f7555..c91c0260 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -57,6 +57,7 @@ jobs: echo "GOCACHE=$gopath/gocache" >> $GITHUB_ENV echo "PATH=$gopath/bin:$PATH" >> $GITHUB_ENV echo "SLOW_TEST=${{inputs.slow-test}}" >> $GITHUB_ENV + echo "STACKER_DOCKER_BASE=oci:$PWD/.build/oci-clone:" >> $GITHUB_ENV echo "PWD=$PWD" cat "$GITHUB_ENV" @@ -69,6 +70,9 @@ jobs: GO111MODULE=off go get github.com/opencontainers/umoci/cmd/umoci make download-tools echo "running kernel is: $(uname -a)" + - name: docker-clone + run: | + make docker-clone "STACKER_DOCKER_BASE=docker://" CLONE_D="$PWD/.build/oci-clone" - name: Go-download run: | make go-download diff --git a/Makefile b/Makefile index dd9b2654..276254af 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ export GOCACHE = $(GOPATH)/gocache GO_SRC=$(shell find pkg cmd -name \*.go) VERSION?=$(shell git describe --tags || git rev-parse HEAD) VERSION_FULL?=$(if $(shell git status --porcelain --untracked-files=no),$(VERSION)-dirty,$(VERSION)) +HASH = \# LXC_VERSION?=$(shell pkg-config --modversion lxc) @@ -21,6 +22,7 @@ STACKER_DOCKER_BASE?=docker:// STACKER_BUILD_BASE_IMAGE?=$(STACKER_DOCKER_BASE)alpine:edge STACKER_BUILD_CENTOS_IMAGE?=$(STACKER_DOCKER_BASE)centos:latest STACKER_BUILD_UBUNTU_IMAGE?=$(STACKER_DOCKER_BASE)ubuntu:latest +STACKER_BUILD_IMAGES = $(STACKER_BUILD_BASE_IMAGE) $(STACKER_BUILD_CENTOS_IMAGE) $(STACKER_BUILD_UBUNTU_IMAGE) LXC_CLONE_URL?=https://github.com/lxc/lxc LXC_BRANCH?=stable-5.0 @@ -116,7 +118,19 @@ test: stacker $(REGCLIENT) $(ZOT) $(shell [ -z $(PRIVILEGE_LEVEL) ] || echo --privilege-level=$(PRIVILEGE_LEVEL)) \ $(patsubst %,test/%.bats,$(TEST)) -.PHONY: + +CLONE_D = $(BUILD_D)/oci-clone +CLONE_RETRIES = 3 +.PHONY: docker-clone +docker-clone: + mkdir -p $(CLONE_D) + vr() { echo "$$" "$$@" 1>&2; "$$@"; }; \ + for u in $(STACKER_BUILD_IMAGES); do \ + name=$${u$(HASH)$(HASH)*/}; \ + vr skopeo copy --retry-times $(CLONE_RETRIES) "$$u" "oci:$(CLONE_D):$${name}"; \ + done + +.PHONY: show-info show-info: @echo BUILD_D=$(BUILD_D) @go env diff --git a/doc/hacking.md b/doc/hacking.md index 3dfc5331..ba9a0127 100644 --- a/doc/hacking.md +++ b/doc/hacking.md @@ -19,13 +19,11 @@ The Makefile supports setting some variables for quicker development. or just to speed up iterative development, you can copy these images to a local oci repository or local zot repository and point the Make system at that. - $ OCI_D=/tmp/my.oci - $ for d in alpine:edge centos:latest ubuntu:latest; do - skopeo copy docker://$d oci:$OCI_D:$d; done + $ make docker-clone STACKER_DOCKER_BASE=docker:// CLONE_D=/tmp/my-oci And then invoke make like: - make STACKER_DOCKER_BASE="oci:$OCI_D:" + make STACKER_DOCKER_BASE="oci:/tmp/my-oci:" I have a nightly sync job that copies these to a local zot repo and then I can build with: