From 23b5551e218c8165c149486183383b4092f3ba14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Fri, 7 May 2021 19:14:07 +0200 Subject: [PATCH 01/13] Modify build-image to support linux/{amd64,arm64} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added new Makefile target to build multi-arch build image. Signed-off-by: Peter Štibraný --- Makefile | 9 ++++++-- build-image/Dockerfile | 52 ++++++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 1ee0cbb2f1b..eecd375b244 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # WARNING: do not commit to a repository! -include Makefile.local -.PHONY: all test cover clean images protos exes dist doc clean-doc check-doc +.PHONY: all test cover clean images protos exes dist doc clean-doc check-doc push-multiarch-build-image .DEFAULT_GOAL := all # Version number @@ -39,9 +39,14 @@ SED ?= $(shell which gsed 2>/dev/null || which sed) %/$(UPTODATE): %/Dockerfile @echo $(SUDO) docker build --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)$(shell basename $(@D)) $(@D)/ - $(SUDO) docker tag $(IMAGE_PREFIX)$(shell basename $(@D)) $(IMAGE_PREFIX)$(shell basename $(@D)):$(IMAGE_TAG) + @echo + @echo Please use push-multiarch-build-image to build and push build image for all supported architectures. touch $@ +push-multiarch-build-image: + @echo + $(SUDO) docker buildx build -o type=registry --platform linux/amd64,linux/arm64 --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)build-image -t $(IMAGE_PREFIX)build-image:$(IMAGE_TAG) build-image/ + # We don't want find to scan inside a bunch of directories, to accelerate the # 'make: Entering directory '/go/src/github.com/cortexproject/cortex' phase. DONT_FIND := -name vendor -prune -o -name .git -prune -o -name .cache -prune -o -name .pkg -prune -o -name packaging -prune -o diff --git a/build-image/Dockerfile b/build-image/Dockerfile index 7ab2559206f..8fa7889c13d 100644 --- a/build-image/Dockerfile +++ b/build-image/Dockerfile @@ -10,45 +10,47 @@ RUN apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # and viceversa. RUN npm install -g postcss-cli@5.0.1 autoprefixer@9.8.5 -ENV HUGO_VERSION=v0.72.0 -RUN git clone https://github.com/gohugoio/hugo.git --branch ${HUGO_VERSION} --depth 1 && \ - cd hugo && go install --tags extended && cd ../ && \ - rm -rf hugo/ && rm -rf /go/pkg /go/src -ENV SHFMT_VERSION=3.1.0 -RUN curl -fsSLo shfmt https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64 && \ - echo "cb91ea08a075a2f96b5230f09b4e211b7c108b1c97603caceb48d117d2ac5508 shfmt" | sha256sum -c && \ +ENV HUGO_VERSION=0.72.0 +RUN GOARCH=$(go env GOARCH) && echo $GOARCH && \ + if [ "$GOARCH"="amd64" ]; then \ + URL=https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz; \ + elif [ "$GOARCH"="arm64" ]; then \ + URL=https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-ARM64.tar.gz; \ + fi && \ + echo Downloading ${URL} && \ + curl -s -L -o hugo.tar.gz "${URL}" && \ + tar xzvf hugo.tar.gz -C /usr/bin && \ + chmod +x /usr/bin/hugo + +ENV SHFMT_VERSION=3.2.4 +RUN curl -fsSLo shfmt https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_$(go env GOARCH) && \ chmod +x shfmt && \ mv shfmt /usr/bin + RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /usr/bin v1.27.0 -RUN GO111MODULE=on go get -tags netgo \ + +RUN GO111MODULE=on go get \ github.com/client9/misspell/cmd/misspell@v0.3.4 \ github.com/golang/protobuf/protoc-gen-go@v1.3.1 \ github.com/gogo/protobuf/protoc-gen-gogoslick@v1.3.0 \ github.com/gogo/protobuf/gogoproto@v1.3.0 \ - github.com/weaveworks/tools/cover@bdd647e92546027e12cdde3ae0714bb495e43013 && \ - rm -rf /go/pkg /go/src + github.com/weaveworks/tools/cover@bdd647e92546027e12cdde3ae0714bb495e43013 \ + github.com/fatih/faillint@v1.5.0 \ + github.com/campoy/embedmd@v1.0.0 \ + && true -ENV KUBEVAL_VERSION=0.15.0 -RUN curl -Ls https://github.com/instrumenta/kubeval/releases/download/${KUBEVAL_VERSION}/kubeval-linux-amd64.tar.gz -o /tmp/kubeval-linux-amd64.tar.gz && \ - tar -xf /tmp/kubeval-linux-amd64.tar.gz -C /tmp && \ - cp /tmp/kubeval /usr/local/bin && \ - rm -f /tmp/kubeval* +# Cannot get it to run together in above go get. +RUN GO111MODULE=on go get \ + github.com/instrumenta/kubeval@v0.16.1 \ + && true + +RUN rm -rf /go/pkg /go/src ENV NODE_PATH=/usr/lib/node_modules COPY build.sh / ENV GOCACHE=/go/cache ENTRYPOINT ["/build.sh"] -# Install faillint used to lint go imports in CI. -ENV FAILLINT_VERSION=1.5.0 -RUN GO111MODULE=on go get github.com/fatih/faillint@v${FAILLINT_VERSION} && \ - rm -rf /go/pkg /go/src - -# Install embedmd used to embed content into markdown files. -ENV EMBEDMD_VERSION=1.0.0 -RUN GO111MODULE=on go get github.com/campoy/embedmd@v${EMBEDMD_VERSION} && \ - rm -rf /go/pkg /go/src - ARG revision LABEL org.opencontainers.image.title="build-image" \ org.opencontainers.image.source="https://github.com/cortexproject/cortex/tree/master/build-image" \ From 516ce9311fc9d53cbd78197482f50bcf0e3c4723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Fri, 7 May 2021 20:01:53 +0200 Subject: [PATCH 02/13] Don't push multiarch to tag-less image name. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index eecd375b244..28981a75883 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ SED ?= $(shell which gsed 2>/dev/null || which sed) push-multiarch-build-image: @echo - $(SUDO) docker buildx build -o type=registry --platform linux/amd64,linux/arm64 --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)build-image -t $(IMAGE_PREFIX)build-image:$(IMAGE_TAG) build-image/ + $(SUDO) docker buildx build -o type=registry --platform linux/amd64,linux/arm64 --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)build-image:$(IMAGE_TAG) build-image/ # We don't want find to scan inside a bunch of directories, to accelerate the # 'make: Entering directory '/go/src/github.com/cortexproject/cortex' phase. From 86886b78a8751c983f0095f579aaddadddc52c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Fri, 7 May 2021 20:09:09 +0200 Subject: [PATCH 03/13] Remove downloaded hugo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- build-image/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/build-image/Dockerfile b/build-image/Dockerfile index 8fa7889c13d..94d9783b8b3 100644 --- a/build-image/Dockerfile +++ b/build-image/Dockerfile @@ -20,6 +20,7 @@ RUN GOARCH=$(go env GOARCH) && echo $GOARCH && \ echo Downloading ${URL} && \ curl -s -L -o hugo.tar.gz "${URL}" && \ tar xzvf hugo.tar.gz -C /usr/bin && \ + rm hugo.tar.gz && \ chmod +x /usr/bin/hugo ENV SHFMT_VERSION=3.2.4 From ede9aabc1700116834114218ddf9c242b4d38d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Fri, 21 May 2021 13:32:48 +0200 Subject: [PATCH 04/13] Address review feedback. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- Makefile | 2 +- build-image/Dockerfile | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 28981a75883..724d5361739 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ SED ?= $(shell which gsed 2>/dev/null || which sed) # declared. %/$(UPTODATE): %/Dockerfile @echo - $(SUDO) docker build --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)$(shell basename $(@D)) $(@D)/ + $(SUDO) docker build --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)$(shell basename $(@D)) -t $(IMAGE_PREFIX)$(shell basename $(@D)):$(IMAGE_TAG) $(@D)/ @echo @echo Please use push-multiarch-build-image to build and push build image for all supported architectures. touch $@ diff --git a/build-image/Dockerfile b/build-image/Dockerfile index 94d9783b8b3..06759ae37fc 100644 --- a/build-image/Dockerfile +++ b/build-image/Dockerfile @@ -38,14 +38,12 @@ RUN GO111MODULE=on go get \ github.com/weaveworks/tools/cover@bdd647e92546027e12cdde3ae0714bb495e43013 \ github.com/fatih/faillint@v1.5.0 \ github.com/campoy/embedmd@v1.0.0 \ - && true + && rm -rf /go/pkg /go/src # Cannot get it to run together in above go get. RUN GO111MODULE=on go get \ github.com/instrumenta/kubeval@v0.16.1 \ - && true - -RUN rm -rf /go/pkg /go/src + && rm -rf /go/pkg /go/src ENV NODE_PATH=/usr/lib/node_modules COPY build.sh / From dcc26dcfed3eea90b7f0a5741da8085d76b1d002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Fri, 21 May 2021 14:57:19 +0200 Subject: [PATCH 05/13] Added back checking of digest for shfmt. Also check digest of downloaded hugo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- build-image/Dockerfile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/build-image/Dockerfile b/build-image/Dockerfile index 06759ae37fc..bf60d3845b4 100644 --- a/build-image/Dockerfile +++ b/build-image/Dockerfile @@ -11,20 +11,31 @@ RUN apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN npm install -g postcss-cli@5.0.1 autoprefixer@9.8.5 ENV HUGO_VERSION=0.72.0 -RUN GOARCH=$(go env GOARCH) && echo $GOARCH && \ - if [ "$GOARCH"="amd64" ]; then \ +RUN GOARCH=$(go env GOARCH) && \ + if [ "$GOARCH" = "amd64" ]; then \ URL=https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz; \ - elif [ "$GOARCH"="arm64" ]; then \ + DIGEST=28353611210d48c681f1f83a64ce36972d010e751f2794122db80f5060fe933d; \ + elif [ "$GOARCH" = "arm64" ]; then \ URL=https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-ARM64.tar.gz; \ + DIGEST=17d079d07d5ec5a5e66fc1264a391dad3010662252563f4304bcbed796083206; \ fi && \ echo Downloading ${URL} && \ curl -s -L -o hugo.tar.gz "${URL}" && \ + echo "$DIGEST hugo.tar.gz" | sha256sum -c && \ tar xzvf hugo.tar.gz -C /usr/bin && \ rm hugo.tar.gz && \ chmod +x /usr/bin/hugo ENV SHFMT_VERSION=3.2.4 -RUN curl -fsSLo shfmt https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_$(go env GOARCH) && \ +RUN GOARCH=$(go env GOARCH) && \ + if [ "$GOARCH" = "amd64" ]; then \ + DIGEST=3f5a47f8fec27fae3e06d611559a2063f5d27e4b9501171dde9959b8c60a3538; \ + elif [ "$GOARCH" = "arm64" ]; then \ + DIGEST=6474d9cc08a1c9fe2ef4be7a004951998e3067d46cf55a011ddd5ff7bfab3de6; \ + fi && \ + URL=https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_${GOARCH}; \ + curl -fsSLo shfmt "${URL}" && \ + echo "$DIGEST shfmt" | sha256sum -c && \ chmod +x shfmt && \ mv shfmt /usr/bin From a80cff63c0464a52bedaad72c74c463723e94d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Fri, 21 May 2021 15:42:53 +0200 Subject: [PATCH 06/13] Build hugo from scratch again. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need 'extended' version, and binaries for this version are not available for our archs. Signed-off-by: Peter Štibraný --- build-image/Dockerfile | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/build-image/Dockerfile b/build-image/Dockerfile index bf60d3845b4..e54e8a7c904 100644 --- a/build-image/Dockerfile +++ b/build-image/Dockerfile @@ -10,21 +10,10 @@ RUN apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # and viceversa. RUN npm install -g postcss-cli@5.0.1 autoprefixer@9.8.5 -ENV HUGO_VERSION=0.72.0 -RUN GOARCH=$(go env GOARCH) && \ - if [ "$GOARCH" = "amd64" ]; then \ - URL=https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz; \ - DIGEST=28353611210d48c681f1f83a64ce36972d010e751f2794122db80f5060fe933d; \ - elif [ "$GOARCH" = "arm64" ]; then \ - URL=https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-ARM64.tar.gz; \ - DIGEST=17d079d07d5ec5a5e66fc1264a391dad3010662252563f4304bcbed796083206; \ - fi && \ - echo Downloading ${URL} && \ - curl -s -L -o hugo.tar.gz "${URL}" && \ - echo "$DIGEST hugo.tar.gz" | sha256sum -c && \ - tar xzvf hugo.tar.gz -C /usr/bin && \ - rm hugo.tar.gz && \ - chmod +x /usr/bin/hugo +ENV HUGO_VERSION=v0.72.0 +RUN git clone https://github.com/gohugoio/hugo.git --branch ${HUGO_VERSION} --depth 1 && \ + cd hugo && go install --tags extended && cd ../ && \ + rm -rf hugo/ && rm -rf /go/pkg /go/src ENV SHFMT_VERSION=3.2.4 RUN GOARCH=$(go env GOARCH) && \ From 39b350dab50b5dd217719f4127810fd56a5c1a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Fri, 21 May 2021 15:51:52 +0200 Subject: [PATCH 07/13] Cleanup /root/.cache as well, to reduce image size. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- build-image/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build-image/Dockerfile b/build-image/Dockerfile index e54e8a7c904..7fe3822d4b0 100644 --- a/build-image/Dockerfile +++ b/build-image/Dockerfile @@ -13,7 +13,7 @@ RUN npm install -g postcss-cli@5.0.1 autoprefixer@9.8.5 ENV HUGO_VERSION=v0.72.0 RUN git clone https://github.com/gohugoio/hugo.git --branch ${HUGO_VERSION} --depth 1 && \ cd hugo && go install --tags extended && cd ../ && \ - rm -rf hugo/ && rm -rf /go/pkg /go/src + rm -rf hugo/ && rm -rf /go/pkg /go/src /root/.cache ENV SHFMT_VERSION=3.2.4 RUN GOARCH=$(go env GOARCH) && \ @@ -38,12 +38,12 @@ RUN GO111MODULE=on go get \ github.com/weaveworks/tools/cover@bdd647e92546027e12cdde3ae0714bb495e43013 \ github.com/fatih/faillint@v1.5.0 \ github.com/campoy/embedmd@v1.0.0 \ - && rm -rf /go/pkg /go/src + && rm -rf /go/pkg /go/src /root/.cache # Cannot get it to run together in above go get. RUN GO111MODULE=on go get \ github.com/instrumenta/kubeval@v0.16.1 \ - && rm -rf /go/pkg /go/src + && rm -rf /go/pkg /go/src /root/.cache ENV NODE_PATH=/usr/lib/node_modules COPY build.sh / From 1d2497ff6a09c5159d0011c65ab8c015ed054414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Fri, 21 May 2021 16:29:53 +0200 Subject: [PATCH 08/13] Build images for individual platforms separately. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 724d5361739..6ac53d98892 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,11 @@ SED ?= $(shell which gsed 2>/dev/null || which sed) push-multiarch-build-image: @echo + # Build image for each platform separately... it tends to generate fewer errors. + $(SUDO) docker buildx build --platform linux/amd64 --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) build-image/ + $(SUDO) docker buildx build --platform linux/arm64 --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) build-image/ + # This command will run the same build as above, but it will reuse existing platform-specific images, + # put them together and push to registry. $(SUDO) docker buildx build -o type=registry --platform linux/amd64,linux/arm64 --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)build-image:$(IMAGE_TAG) build-image/ # We don't want find to scan inside a bunch of directories, to accelerate the From edea0c866d1b50e06f71e55c17ad6952b7bbedaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Fri, 21 May 2021 17:11:04 +0200 Subject: [PATCH 09/13] Use new image. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- .github/workflows/test-build-deploy.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-build-deploy.yml b/.github/workflows/test-build-deploy.yml index 1531f0ff4b6..e7af3e597cd 100644 --- a/.github/workflows/test-build-deploy.yml +++ b/.github/workflows/test-build-deploy.yml @@ -10,7 +10,7 @@ jobs: lint: runs-on: ubuntu-latest container: - image: quay.io/cortexproject/build-image:2021w14_go1.16-afe06f021 + image: quay.io/cortexproject/build-image:build-image-multiarch-1d2497ff6 steps: - name: Checkout Repo uses: actions/checkout@v2 @@ -34,7 +34,7 @@ jobs: test: runs-on: ubuntu-latest container: - image: quay.io/cortexproject/build-image:2021w14_go1.16-afe06f021 + image: quay.io/cortexproject/build-image:build-image-multiarch-1d2497ff6 services: cassandra: image: cassandra:3.11 @@ -55,7 +55,7 @@ jobs: build: runs-on: ubuntu-latest container: - image: quay.io/cortexproject/build-image:2021w14_go1.16-afe06f021 + image: quay.io/cortexproject/build-image:build-image-multiarch-1d2497ff6 steps: - name: Checkout Repo uses: actions/checkout@v2 @@ -173,14 +173,14 @@ jobs: run: | touch build-image/.uptodate MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations - make BUILD_IMAGE=quay.io/cortexproject/build-image:2021w14_go1.16-afe06f021 TTY='' configs-integration-test + make BUILD_IMAGE=quay.io/cortexproject/build-image:build-image-multiarch-1d2497ff6 TTY='' configs-integration-test deploy_website: needs: [build, test] if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex' runs-on: ubuntu-latest container: - image: quay.io/cortexproject/build-image:2021w14_go1.16-afe06f021 + image: quay.io/cortexproject/build-image:build-image-multiarch-1d2497ff6 steps: - name: Checkout Repo uses: actions/checkout@v2 @@ -217,7 +217,7 @@ jobs: if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex' runs-on: ubuntu-latest container: - image: quay.io/cortexproject/build-image:2021w14_go1.16-afe06f021 + image: quay.io/cortexproject/build-image:build-image-multiarch-1d2497ff6 steps: - name: Checkout Repo uses: actions/checkout@v2 From 67de5a024519d040e6851a7cc98837c0ce22ade0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Fri, 21 May 2021 19:51:50 +0200 Subject: [PATCH 10/13] Split tagging again. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6ac53d98892..c3cab4c8198 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,8 @@ SED ?= $(shell which gsed 2>/dev/null || which sed) # declared. %/$(UPTODATE): %/Dockerfile @echo - $(SUDO) docker build --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)$(shell basename $(@D)) -t $(IMAGE_PREFIX)$(shell basename $(@D)):$(IMAGE_TAG) $(@D)/ + $(SUDO) docker build --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)$(shell basename $(@D)) $(@D)/ + $(SUDO) docker tag $(IMAGE_PREFIX)$(shell basename $(@D)) $(IMAGE_PREFIX)$(shell basename $(@D)):$(IMAGE_TAG) @echo @echo Please use push-multiarch-build-image to build and push build image for all supported architectures. touch $@ From f13ee4c9f9e96fa8ec71180d814c3ff9ebc6a822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Mon, 24 May 2021 17:04:56 +0200 Subject: [PATCH 11/13] Update how-to-update-the-build-image.md doc. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- docs/contributing/how-to-update-the-build-image.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/contributing/how-to-update-the-build-image.md b/docs/contributing/how-to-update-the-build-image.md index 7c807676ad2..23c23bbe54d 100644 --- a/docs/contributing/how-to-update-the-build-image.md +++ b/docs/contributing/how-to-update-the-build-image.md @@ -7,8 +7,7 @@ slug: how-to-update-the-build-image The build image currently can only be updated by a Cortex maintainer. If you're not a maintainer you can still open a PR with the changes, asking a maintainer to assist you publishing the updated image. The procedure is: -1. Update `build-image/Docker` -2. Build the image running `make build-image/.uptodate` -3. Publish the image to the repository running `docker push quay.io/cortexproject/build-image:TAG` (this can only be done by a maintainer) -4. Replace the image tag in `.github/workflows/*` (_there may be multiple references_) -5. Open a PR and make sure the CI with new build-image passes +1. Update `build-image/Docker`. +2. Build the and publish the image by using `make push-multiarch-build-image`. This will build and push multiplatform docker image (for linux/amd64 and linux/arm64). Pushing to `quay.io/cortexproject/build-image` repository can only be done by a maintainer. +3. Replace the image tag in `.github/workflows/*` (_there may be multiple references_) +4. Open a PR and make sure the CI with new build-image passes From 94266b753fa0342de6c038c39c06a3c56c69f94e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Mon, 24 May 2021 17:12:06 +0200 Subject: [PATCH 12/13] Add comment about BuildKit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- docs/contributing/how-to-update-the-build-image.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing/how-to-update-the-build-image.md b/docs/contributing/how-to-update-the-build-image.md index 23c23bbe54d..aea24de0e7f 100644 --- a/docs/contributing/how-to-update-the-build-image.md +++ b/docs/contributing/how-to-update-the-build-image.md @@ -8,6 +8,6 @@ slug: how-to-update-the-build-image The build image currently can only be updated by a Cortex maintainer. If you're not a maintainer you can still open a PR with the changes, asking a maintainer to assist you publishing the updated image. The procedure is: 1. Update `build-image/Docker`. -2. Build the and publish the image by using `make push-multiarch-build-image`. This will build and push multiplatform docker image (for linux/amd64 and linux/arm64). Pushing to `quay.io/cortexproject/build-image` repository can only be done by a maintainer. +2. Build the and publish the image by using `make push-multiarch-build-image`. This will build and push multiplatform docker image (for linux/amd64 and linux/arm64). Pushing to `quay.io/cortexproject/build-image` repository can only be done by a maintainer. Running this step successfully requires [BuildKit to be enabled in Docker features](https://docs.docker.com/develop/develop-images/build_enhancements/#to-enable-buildkit-builds), but does not require a specific platform. 3. Replace the image tag in `.github/workflows/*` (_there may be multiple references_) 4. Open a PR and make sure the CI with new build-image passes From eeabcf14d93c4e78798695ec6bd35d9df1b83315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Mon, 24 May 2021 17:16:52 +0200 Subject: [PATCH 13/13] Add comment about Buildx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- docs/contributing/how-to-update-the-build-image.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing/how-to-update-the-build-image.md b/docs/contributing/how-to-update-the-build-image.md index aea24de0e7f..85aa939501c 100644 --- a/docs/contributing/how-to-update-the-build-image.md +++ b/docs/contributing/how-to-update-the-build-image.md @@ -8,6 +8,6 @@ slug: how-to-update-the-build-image The build image currently can only be updated by a Cortex maintainer. If you're not a maintainer you can still open a PR with the changes, asking a maintainer to assist you publishing the updated image. The procedure is: 1. Update `build-image/Docker`. -2. Build the and publish the image by using `make push-multiarch-build-image`. This will build and push multiplatform docker image (for linux/amd64 and linux/arm64). Pushing to `quay.io/cortexproject/build-image` repository can only be done by a maintainer. Running this step successfully requires [BuildKit to be enabled in Docker features](https://docs.docker.com/develop/develop-images/build_enhancements/#to-enable-buildkit-builds), but does not require a specific platform. +2. Build the and publish the image by using `make push-multiarch-build-image`. This will build and push multiplatform docker image (for linux/amd64 and linux/arm64). Pushing to `quay.io/cortexproject/build-image` repository can only be done by a maintainer. Running this step successfully requires [Docker Buildx](https://docs.docker.com/buildx/working-with-buildx/), but does not require a specific platform. 3. Replace the image tag in `.github/workflows/*` (_there may be multiple references_) 4. Open a PR and make sure the CI with new build-image passes