From 3207eb794741e42c75c60d58b440426156973f40 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 09:18:41 +0200 Subject: [PATCH 01/26] add provider images --- Dockerfile | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 7 +++--- 2 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..6113fcf7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,66 @@ +# syntax=docker/dockerfile:1.4 + +# Copyright 2018 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Build the manager binary +# Run this with docker build --build-arg builder_image= +ARG builder_image + +# Build architecture +ARG ARCH + +# Ignore Hadolint rule "Always tag the version of an image explicitly." +# It's an invalid finding since the image is explicitly set in the Makefile. +# https://github.com/hadolint/hadolint/wiki/DL3006 +# hadolint ignore=DL3006 +FROM ${builder_image} as builder +WORKDIR /workspace + +# Run this with docker build --build-arg goproxy=$(go env GOPROXY) to override the goproxy +ARG goproxy=off +# Run this with docker build --build-arg package=./controlplane/kubeadm or --build-arg package=./bootstrap/kubeadm +ENV GOPROXY=$goproxy + +# Copy the Go Modules manifests +COPY go.mod go.mod +COPY go.sum go.sum + +# Cache deps before building and copying source so that we don't need to re-download as much +# and so that source changes don't invalidate our downloaded layer +RUN --mount=type=cache,target=/go/pkg/mod \ + go mod download + +# Copy the sources +COPY ./ ./ + +# Build +ARG package=. +ARG ARCH +ARG ldflags + +# Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/go/pkg/mod \ + CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \ + go build -trimpath -ldflags "${ldflags} -extldflags '-static'" \ + -o manager ${package} + +# Production image +FROM gcr.io/distroless/static:nonroot +WORKDIR / +COPY --from=builder /workspace/manager . +# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies +USER 65532 +ENTRYPOINT ["/manager"] diff --git a/Makefile b/Makefile index 780f1e1a..ea3da199 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,8 @@ dev-controlplane: ##@ release: ## latest git tag for the commit, e.g., v0.3.10 -RELEASE_TAG ?= $(shell git describe --abbrev=0 --tags 2>/dev/null) +## set to v0.0.0 if no tag is found +RELEASE_TAG ?= $(shell git describe --abbrev=0 --tags 2>/dev/null || echo v0.0.0) ifneq (,$(findstring -,$(RELEASE_TAG))) PRE_RELEASE=true endif @@ -238,7 +239,7 @@ generate-bootstrap-conversions: $(CONVERSION_GEN) # Build the docker image docker-build-bootstrap: manager-bootstrap ## Build bootstrap - DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg TARGETARCH=$(ARCH) --build-arg package=./bootstrap/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${BOOTSTRAP_IMG}:${BOOTSTRAP_IMG_TAG} + DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg package=./bootstrap/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${BOOTSTRAP_IMG}:${BOOTSTRAP_IMG_TAG} # Push the docker image docker-push-bootstrap: ## Push bootstrap @@ -310,7 +311,7 @@ generate-controlplane-conversions: $(CONVERSION_GEN) --go-header-file=./hack/boilerplate.go.txt docker-build-controlplane: manager-controlplane ## Build control-plane - DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg TARGETARCH=$(ARCH) --build-arg package=./controlplane/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) + DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg package=./controlplane/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) docker-push-controlplane: ## Push control-plane docker push ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) From 07083131f32d821112d0c71d629b93e0a712856e Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 09:51:10 +0200 Subject: [PATCH 02/26] add publish CI --- .github/workflows/publish-images.yaml | 55 +++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/publish-images.yaml diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml new file mode 100644 index 00000000..7a834de7 --- /dev/null +++ b/.github/workflows/publish-images.yaml @@ -0,0 +1,55 @@ +name: Publish Images + +on: + push: + branches: + - main + - 'release-[0-9]+.[0-9]+' + # TODO: remove before merge + pull_request: + +permissions: + contents: read + +jobs: + test: + permissions: + contents: read # for actions/checkout to fetch code + name: Unit Tests & Code Quality + runs-on: ubuntu-latest + + steps: + - name: Harden Runner + uses: step-security/harden-runner@v2 + with: + egress-policy: audit + - name: Determine branch + id: determine + env: + BRANCH: ${{ github.ref }} + run: | + BRANCH=${BRANCH#refs/heads/} # strip off refs/heads/ if it exists + if [[ "${BRANCH}" == "main" ]]; then + echo "version=latest" >> "$GITHUB_OUTPUT" + elif [[ "${BRANCH}" =~ ^release-[0-9]+\.[0-9]+$ ]]; then + echo "version=v${BRANCH#release-}" >> "$GITHUB_OUTPUT" + else + # TODO: Remove before merge, only for testing + echo "Use Branch ${BRANCH} only for testing." + echo "version=latest" >> "$GITHUB_OUTPUT" + exit 1 + fi + - name: Check out code + uses: actions/checkout@v4 + + - name: Build bootstrap provider image + run: BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap + + - name: Build controlplane provider image + run: CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap + + - name: Publish bootstrap provider image + run: BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-publish-bootstrap + + - name: Publish controlplane provider image + run: CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-publish-controlplane From bd24762427ca6dc00bacf9eba361cbd8a59bec90 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 11:02:37 +0200 Subject: [PATCH 03/26] remove exit 1 --- .github/workflows/publish-images.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index 7a834de7..b63b104d 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -37,7 +37,7 @@ jobs: # TODO: Remove before merge, only for testing echo "Use Branch ${BRANCH} only for testing." echo "version=latest" >> "$GITHUB_OUTPUT" - exit 1 + # exit 1 fi - name: Check out code uses: actions/checkout@v4 From 4b992e0a44ae84f43a6a7f1fae88f43b85a08200 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 11:04:38 +0200 Subject: [PATCH 04/26] add make command --- .github/workflows/publish-images.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index b63b104d..757712ad 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -43,13 +43,13 @@ jobs: uses: actions/checkout@v4 - name: Build bootstrap provider image - run: BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap + run: make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap - name: Build controlplane provider image - run: CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap + run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap - name: Publish bootstrap provider image - run: BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-publish-bootstrap + run: make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-publish-bootstrap - name: Publish controlplane provider image - run: CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-publish-controlplane + run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-publish-controlplane From ea1a23408635bc801753d157e8c456dffe70e5d1 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 11:12:34 +0200 Subject: [PATCH 05/26] fix command typo --- .github/workflows/publish-images.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index 757712ad..f284e5e2 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -15,7 +15,7 @@ jobs: test: permissions: contents: read # for actions/checkout to fetch code - name: Unit Tests & Code Quality + name: Build and Publish Images runs-on: ubuntu-latest steps: @@ -49,7 +49,7 @@ jobs: run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap - name: Publish bootstrap provider image - run: make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-publish-bootstrap + run: make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-push-bootstrap - name: Publish controlplane provider image - run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-publish-controlplane + run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-push-controlplane From d30d8a70bd97b8b948fcc4a7109c24102c16ccc5 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 11:28:09 +0200 Subject: [PATCH 06/26] add docker login --- .github/workflows/publish-images.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index f284e5e2..4489be80 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -15,6 +15,7 @@ jobs: test: permissions: contents: read # for actions/checkout to fetch code + packages: write # for publishing docker images name: Build and Publish Images runs-on: ubuntu-latest @@ -42,6 +43,13 @@ jobs: - name: Check out code uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@v3.2.0 + with: + registry: https://ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build bootstrap provider image run: make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap From d5da320e6a553299a3f99b2c18b6b1b94f1508dd Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 11:36:43 +0200 Subject: [PATCH 07/26] debug --- .github/workflows/publish-images.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index 4489be80..1b5179cc 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -31,7 +31,7 @@ jobs: run: | BRANCH=${BRANCH#refs/heads/} # strip off refs/heads/ if it exists if [[ "${BRANCH}" == "main" ]]; then - echo "version=latest" >> "$GITHUB_OUTPUT" + echo "version=main" >> "$GITHUB_OUTPUT" elif [[ "${BRANCH}" =~ ^release-[0-9]+\.[0-9]+$ ]]; then echo "version=v${BRANCH#release-}" >> "$GITHUB_OUTPUT" else @@ -51,10 +51,12 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build bootstrap provider image - run: make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap + run: | + echo ${{ steps.determine.outputs.version }} + make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap - name: Build controlplane provider image - run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap + run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-controlplane - name: Publish bootstrap provider image run: make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-push-bootstrap From 5bcda577d93e9a9419a9054529f389948f020a03 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 11:39:22 +0200 Subject: [PATCH 08/26] fix env name --- .github/workflows/publish-images.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index 1b5179cc..a10f10c3 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -51,15 +51,13 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build bootstrap provider image - run: | - echo ${{ steps.determine.outputs.version }} - make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap + run: make BOOTSTRAP_IMG_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap - name: Build controlplane provider image - run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-controlplane + run: make CONTROLPLANE_IMG_TAG=${{ steps.determine.outputs.version }} docker-build-controlplane - name: Publish bootstrap provider image - run: make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-push-bootstrap + run: make BOOTSTRAP_IMG_TAG=${{ steps.determine.outputs.version }} docker-push-bootstrap - name: Publish controlplane provider image - run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-push-controlplane + run: make CONTROLPLANE_IMG_TAG=${{ steps.determine.outputs.version }} docker-push-controlplane From dc9ac4a51893ec5b17586a52c26e11861d05738b Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 11:47:40 +0200 Subject: [PATCH 09/26] update tag name --- .github/workflows/publish-images.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index a10f10c3..9e134f95 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -31,7 +31,7 @@ jobs: run: | BRANCH=${BRANCH#refs/heads/} # strip off refs/heads/ if it exists if [[ "${BRANCH}" == "main" ]]; then - echo "version=main" >> "$GITHUB_OUTPUT" + echo "version=latest" >> "$GITHUB_OUTPUT" elif [[ "${BRANCH}" =~ ^release-[0-9]+\.[0-9]+$ ]]; then echo "version=v${BRANCH#release-}" >> "$GITHUB_OUTPUT" else From ef38d2eef8eef9bc935e429a51564e7160ed138b Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 13:12:05 +0200 Subject: [PATCH 10/26] make release --- .github/workflows/publish-images.yaml | 63 ------------------ .github/workflows/release.yaml | 64 +++++++++++++++++++ Makefile | 48 ++++++++++---- bootstrap/config/manager/kustomization.yaml | 1 + .../config/manager/kustomization.yaml | 1 + 5 files changed, 102 insertions(+), 75 deletions(-) delete mode 100644 .github/workflows/publish-images.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml deleted file mode 100644 index 9e134f95..00000000 --- a/.github/workflows/publish-images.yaml +++ /dev/null @@ -1,63 +0,0 @@ -name: Publish Images - -on: - push: - branches: - - main - - 'release-[0-9]+.[0-9]+' - # TODO: remove before merge - pull_request: - -permissions: - contents: read - -jobs: - test: - permissions: - contents: read # for actions/checkout to fetch code - packages: write # for publishing docker images - name: Build and Publish Images - runs-on: ubuntu-latest - - steps: - - name: Harden Runner - uses: step-security/harden-runner@v2 - with: - egress-policy: audit - - name: Determine branch - id: determine - env: - BRANCH: ${{ github.ref }} - run: | - BRANCH=${BRANCH#refs/heads/} # strip off refs/heads/ if it exists - if [[ "${BRANCH}" == "main" ]]; then - echo "version=latest" >> "$GITHUB_OUTPUT" - elif [[ "${BRANCH}" =~ ^release-[0-9]+\.[0-9]+$ ]]; then - echo "version=v${BRANCH#release-}" >> "$GITHUB_OUTPUT" - else - # TODO: Remove before merge, only for testing - echo "Use Branch ${BRANCH} only for testing." - echo "version=latest" >> "$GITHUB_OUTPUT" - # exit 1 - fi - - name: Check out code - uses: actions/checkout@v4 - - - name: Log in to the Container registry - uses: docker/login-action@v3.2.0 - with: - registry: https://ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build bootstrap provider image - run: make BOOTSTRAP_IMG_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap - - - name: Build controlplane provider image - run: make CONTROLPLANE_IMG_TAG=${{ steps.determine.outputs.version }} docker-build-controlplane - - - name: Publish bootstrap provider image - run: make BOOTSTRAP_IMG_TAG=${{ steps.determine.outputs.version }} docker-push-bootstrap - - - name: Publish controlplane provider image - run: make CONTROLPLANE_IMG_TAG=${{ steps.determine.outputs.version }} docker-push-controlplane diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..1a07f8a0 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,64 @@ +name: Release + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' + +jobs: + release: + permissions: + contents: read # for actions/checkout to fetch code + packages: write # for publishing docker images + name: Release + runs-on: ubuntu-latest + + steps: + - name: Harden Runner + uses: step-security/harden-runner@v2 + with: + egress-policy: audit + - name: Retrieve build information + id: build + run: | + VERSION="${GITHUB_REF#refs/tags/}" + echo "Releasing ${VERSION}" + echo "VERSION=${VERSION}" >> $GITHUB_ENV + + - name: Log in to the Container registry + uses: docker/login-action@v3.2.0 + with: + registry: https://ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build bootstrap provider image + run: make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-build-bootstrap + + - name: Build controlplane provider image + run: make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-build-controlplane + + - name: Publish bootstrap provider image + run: make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-push-bootstrap + + - name: Publish controlplane provider image + run: make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-push-controlplane + + - name: Build manifests + run: | + make release + sed -i "s,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:latest,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:${VERSION//v}," out/bootstrap-components.yaml + sed -i "s,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:latest,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:${VERSION//v}," out/control-plane-components.yaml + + - name: Create GitHub Release + uses: softprops/action-gh-release@v0.1.14 + with: + name: 'Release ${{ env.VERSION }}' + files: | + out/bootstrap-components.yaml + out/control-plane-components.yaml + out/metadata.yaml + generate_release_notes: true + draft: false + prerelease: ${{ contains(env.VERSION, 'rc') }} diff --git a/Makefile b/Makefile index ea3da199..677ff3e3 100644 --- a/Makefile +++ b/Makefile @@ -237,13 +237,24 @@ generate-bootstrap-conversions: $(CONVERSION_GEN) --output-base=./ \ --go-header-file=./hack/boilerplate.go.txt -# Build the docker image -docker-build-bootstrap: manager-bootstrap ## Build bootstrap - DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg package=./bootstrap/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${BOOTSTRAP_IMG}:${BOOTSTRAP_IMG_TAG} - -# Push the docker image -docker-push-bootstrap: ## Push bootstrap - docker push ${BOOTSTRAP_IMG}:${BOOTSTRAP_IMG_TAG} +.PHONY: docker-build-bootstrap +docker-build-bootstrap-%: + DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$* --build-arg package=./bootstrap/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${BOOTSTRAP_IMG}-$*:${BOOTSTRAP_IMG_TAG} +docker-build-bootstrap: manager-bootstrap docker-build-bootstrap-amd64 docker-build-bootstrap-arm64 + +# Push the bootstrap multiarch image +.PHONY: docker-push +docker-push-bootstrap-%: docker-build-bootstrap-% + docker push ${BOOTSTRAP_IMG}-$*:$(BOOTSTRAP_IMG_TAG) +docker-push-bootstrap: docker-push-bootstrap-amd64 docker-push-bootstrap-arm64 + +.PHONY: docker-manifest-bootstrap +docker-manifest-bootstrap: docker-push-bootstrap + docker manifest rm ${BOOTSTRAP_IMG} || true + docker manifest create ${BOOTSTRAP_IMG} --amend ${BOOTSTRAP_IMG}-amd64 --amend ${BOOTSTRAP_IMG}-arm64 + docker manifest annotate ${BOOTSTRAP_IMG} ${BOOTSTRAP_IMG}-amd64 --arch=amd64 + docker manifest annotate ${BOOTSTRAP_IMG} ${BOOTSTRAP_IMG}-arm64 --arch=arm64 + docker manifest push ${BOOTSTRAP_IMG} all-controlplane: manager-controlplane @@ -310,11 +321,24 @@ generate-controlplane-conversions: $(CONVERSION_GEN) --output-base=./ \ --go-header-file=./hack/boilerplate.go.txt -docker-build-controlplane: manager-controlplane ## Build control-plane - DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg package=./controlplane/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) - -docker-push-controlplane: ## Push control-plane - docker push ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) +.PHONY: docker-build-controlplane +docker-build-controlplane-%: + DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$* --build-arg package=./controlplane/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${CONTROLPLANE_IMG}-$*:${CONTROLPLANE_IMG_TAG} +docker-build-controlplane: manager-controlplane docker-build-controlplane-amd64 docker-build-controlplane-arm64 + +# Push the controlplane multiarch image +.PHONY: docker-push +docker-push-controlplane-%: docker-build-controlplane-% + docker push ${CONTROLPLANE_IMG}-$*:$(CONTROLPLANE_IMG_TAG) +docker-push-controlplane: docker-push-controlplane-amd64 docker-push-controlplane-arm64 + +.PHONY: docker-manifest-controlplane +docker-manifest-controlplane: docker-push-controlplane + docker manifest rm ${CONTROLPLANE_IMG} || true + docker manifest create ${CONTROLPLANE_IMG} --amend ${CONTROLPLANE_IMG}-amd64 --amend ${CONTROLPLANE_IMG}-arm64 + docker manifest annotate ${CONTROLPLANE_IMG} ${CONTROLPLANE_IMG}-amd64 --arch=amd64 + docker manifest annotate ${CONTROLPLANE_IMG} ${CONTROLPLANE_IMG}-arm64 --arch=arm64 + docker manifest push ${CONTROLPLANE_IMG} release: release-bootstrap release-controlplane cp metadata.yaml $(RELEASE_DIR)/metadata.yaml diff --git a/bootstrap/config/manager/kustomization.yaml b/bootstrap/config/manager/kustomization.yaml index 2d5090e8..44a8f4eb 100644 --- a/bootstrap/config/manager/kustomization.yaml +++ b/bootstrap/config/manager/kustomization.yaml @@ -5,3 +5,4 @@ kind: Kustomization images: - name: controller newName: ghcr.io/canonical/cluster-api-k8s/bootstrap-controller + newTag: v0.0.0 diff --git a/controlplane/config/manager/kustomization.yaml b/controlplane/config/manager/kustomization.yaml index be27d956..5fa5c2ff 100644 --- a/controlplane/config/manager/kustomization.yaml +++ b/controlplane/config/manager/kustomization.yaml @@ -5,3 +5,4 @@ kind: Kustomization images: - name: controller newName: ghcr.io/canonical/cluster-api-k8s/controlplane-controller + newTag: v0.0.0 From 343982ff21a2e9e67533ad8979a1d6de5b2575b8 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 13:17:29 +0200 Subject: [PATCH 11/26] test CI --- .github/workflows/release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1a07f8a0..0c9b1b58 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,6 +5,7 @@ on: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' + pull_request: jobs: release: @@ -22,7 +23,7 @@ jobs: - name: Retrieve build information id: build run: | - VERSION="${GITHUB_REF#refs/tags/}" + VERSION=v0.0.1-rcX #"${GITHUB_REF#refs/tags/}" echo "Releasing ${VERSION}" echo "VERSION=${VERSION}" >> $GITHUB_ENV From 752f1b5765a0f5c2b4bceace4d2b8ef4aaca980b Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 13:23:48 +0200 Subject: [PATCH 12/26] update make rules --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 677ff3e3..7cf1a6ed 100644 --- a/Makefile +++ b/Makefile @@ -243,7 +243,7 @@ docker-build-bootstrap-%: docker-build-bootstrap: manager-bootstrap docker-build-bootstrap-amd64 docker-build-bootstrap-arm64 # Push the bootstrap multiarch image -.PHONY: docker-push +.PHONY: docker-push-bootstrap docker-push-bootstrap-%: docker-build-bootstrap-% docker push ${BOOTSTRAP_IMG}-$*:$(BOOTSTRAP_IMG_TAG) docker-push-bootstrap: docker-push-bootstrap-amd64 docker-push-bootstrap-arm64 @@ -327,7 +327,7 @@ docker-build-controlplane-%: docker-build-controlplane: manager-controlplane docker-build-controlplane-amd64 docker-build-controlplane-arm64 # Push the controlplane multiarch image -.PHONY: docker-push +.PHONY: docker-push-controlplane docker-push-controlplane-%: docker-build-controlplane-% docker push ${CONTROLPLANE_IMG}-$*:$(CONTROLPLANE_IMG_TAG) docker-push-controlplane: docker-push-controlplane-amd64 docker-push-controlplane-arm64 From 7f0b7b4147bb8bbd08ac274a39bd876cc5e09f73 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 13:25:31 +0200 Subject: [PATCH 13/26] print targets --- .github/workflows/release.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0c9b1b58..4610e2f9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,7 +35,11 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build bootstrap provider image - run: make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-build-bootstrap + run: | + make -qp | + awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' | + sort -u + make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-build-bootstrap - name: Build controlplane provider image run: make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-build-controlplane From 6dddf6d9a947077980d88724a4ff763413f9c71d Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 13:26:16 +0200 Subject: [PATCH 14/26] fix --- .github/workflows/release.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4610e2f9..cb131a8f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -36,9 +36,7 @@ jobs: - name: Build bootstrap provider image run: | - make -qp | - awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' | - sort -u + make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' | sort -u make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-build-bootstrap - name: Build controlplane provider image From 43986aedbd40882ca57d6d3d0d6ae80ee75a3e6c Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 13:34:18 +0200 Subject: [PATCH 15/26] checkout repo... --- .github/workflows/release.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index cb131a8f..8d2eb61f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -34,10 +34,11 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Check out code + uses: actions/checkout@v4 + - name: Build bootstrap provider image - run: | - make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' | sort -u - make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-build-bootstrap + run: make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-build-bootstrap - name: Build controlplane provider image run: make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-build-controlplane From 6646f555b11ce7e6224b7fc221cf92c115f88e7e Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 13:43:36 +0200 Subject: [PATCH 16/26] fix action --- .github/workflows/release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8d2eb61f..c97ba5ee 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,7 +10,7 @@ on: jobs: release: permissions: - contents: read # for actions/checkout to fetch code + contents: write # for release packages: write # for publishing docker images name: Release runs-on: ubuntu-latest @@ -59,6 +59,7 @@ jobs: uses: softprops/action-gh-release@v0.1.14 with: name: 'Release ${{ env.VERSION }}' + tag_name: ${{ env.VERSION }} files: | out/bootstrap-components.yaml out/control-plane-components.yaml From e730b92e58ed7bc32ab01091e128534f01dbd636 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 13:56:20 +0200 Subject: [PATCH 17/26] fix sed --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c97ba5ee..755a744e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -52,8 +52,8 @@ jobs: - name: Build manifests run: | make release - sed -i "s,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:latest,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:${VERSION//v}," out/bootstrap-components.yaml - sed -i "s,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:latest,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:${VERSION//v}," out/control-plane-components.yaml + sed -i "s,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:latest,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:${{ env.VERSION//v }}," out/bootstrap-components.yaml + sed -i "s,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:latest,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:${{ env.VERSION//v }}," out/control-plane-components.yaml - name: Create GitHub Release uses: softprops/action-gh-release@v0.1.14 From f56e2b55b18c47a92dd84cec0660c574a124c5c1 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 14:00:56 +0200 Subject: [PATCH 18/26] fix version tag --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 755a744e..d4c1dd4a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -52,8 +52,8 @@ jobs: - name: Build manifests run: | make release - sed -i "s,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:latest,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:${{ env.VERSION//v }}," out/bootstrap-components.yaml - sed -i "s,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:latest,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:${{ env.VERSION//v }}," out/control-plane-components.yaml + sed -i "s,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:latest,ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:${{ env.VERSION }}," out/bootstrap-components.yaml + sed -i "s,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:latest,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:${{ env.VERSION }}," out/control-plane-components.yaml - name: Create GitHub Release uses: softprops/action-gh-release@v0.1.14 From 201cba49cb4f0b71ef20b5be12bc2a77dcdd6f28 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 14:09:19 +0200 Subject: [PATCH 19/26] use latest gh release --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d4c1dd4a..ab26aa97 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -56,7 +56,7 @@ jobs: sed -i "s,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:latest,ghcr.io/canonical/cluster-api-k8s/controlplane-controller:${{ env.VERSION }}," out/control-plane-components.yaml - name: Create GitHub Release - uses: softprops/action-gh-release@v0.1.14 + uses: softprops/action-gh-release@v2.0.6 with: name: 'Release ${{ env.VERSION }}' tag_name: ${{ env.VERSION }} From 742835cf70312e9a613789df6f19200ec51230cc Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 14:17:18 +0200 Subject: [PATCH 20/26] remove newTag field --- bootstrap/config/manager/kustomization.yaml | 1 - controlplane/config/manager/kustomization.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/bootstrap/config/manager/kustomization.yaml b/bootstrap/config/manager/kustomization.yaml index 44a8f4eb..2d5090e8 100644 --- a/bootstrap/config/manager/kustomization.yaml +++ b/bootstrap/config/manager/kustomization.yaml @@ -5,4 +5,3 @@ kind: Kustomization images: - name: controller newName: ghcr.io/canonical/cluster-api-k8s/bootstrap-controller - newTag: v0.0.0 diff --git a/controlplane/config/manager/kustomization.yaml b/controlplane/config/manager/kustomization.yaml index 5fa5c2ff..be27d956 100644 --- a/controlplane/config/manager/kustomization.yaml +++ b/controlplane/config/manager/kustomization.yaml @@ -5,4 +5,3 @@ kind: Kustomization images: - name: controller newName: ghcr.io/canonical/cluster-api-k8s/controlplane-controller - newTag: v0.0.0 From 62ff7198fc7981544a0a78f332a4c88a0b9d4215 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 15:04:08 +0200 Subject: [PATCH 21/26] update docker manifest --- .github/workflows/release.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ab26aa97..1fe92a57 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -44,10 +44,14 @@ jobs: run: make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-build-controlplane - name: Publish bootstrap provider image - run: make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-push-bootstrap + run: | + make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-push-bootstrap + make docker-manifest-bootstrap - name: Publish controlplane provider image - run: make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-push-controlplane + run: | + make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-push-controlplane + make docker-manifest-controlplane - name: Build manifests run: | @@ -65,5 +69,5 @@ jobs: out/control-plane-components.yaml out/metadata.yaml generate_release_notes: true - draft: false + draft: ${{ contains(env.VERSION, 'rc') }} prerelease: ${{ contains(env.VERSION, 'rc') }} From 055e044468789568956e9e9054f498e06b2c60a9 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 15:24:16 +0200 Subject: [PATCH 22/26] fix version --- .github/workflows/release.yaml | 4 ++-- Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1fe92a57..11fa61a6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -46,12 +46,12 @@ jobs: - name: Publish bootstrap provider image run: | make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-push-bootstrap - make docker-manifest-bootstrap + make BOOTSTRAP_IMG_TAG=${{ env.VERSION }} docker-manifest-bootstrap - name: Publish controlplane provider image run: | make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-push-controlplane - make docker-manifest-controlplane + make CONTROLPLANE_IMG_TAG=${{ env.VERSION }} docker-manifest-controlplane - name: Build manifests run: | diff --git a/Makefile b/Makefile index 7cf1a6ed..424ea490 100644 --- a/Makefile +++ b/Makefile @@ -251,7 +251,7 @@ docker-push-bootstrap: docker-push-bootstrap-amd64 docker-push-bootstrap-arm64 .PHONY: docker-manifest-bootstrap docker-manifest-bootstrap: docker-push-bootstrap docker manifest rm ${BOOTSTRAP_IMG} || true - docker manifest create ${BOOTSTRAP_IMG} --amend ${BOOTSTRAP_IMG}-amd64 --amend ${BOOTSTRAP_IMG}-arm64 + docker manifest create ${BOOTSTRAP_IMG}--amend ${BOOTSTRAP_IMG}-amd64 --amend ${BOOTSTRAP_IMG}-arm64 docker manifest annotate ${BOOTSTRAP_IMG} ${BOOTSTRAP_IMG}-amd64 --arch=amd64 docker manifest annotate ${BOOTSTRAP_IMG} ${BOOTSTRAP_IMG}-arm64 --arch=arm64 docker manifest push ${BOOTSTRAP_IMG} From 1a669df805156bc2d96d733fd181403edd8a2d15 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 16:40:37 +0200 Subject: [PATCH 23/26] fix manifest --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 424ea490..8f359813 100644 --- a/Makefile +++ b/Makefile @@ -250,11 +250,11 @@ docker-push-bootstrap: docker-push-bootstrap-amd64 docker-push-bootstrap-arm64 .PHONY: docker-manifest-bootstrap docker-manifest-bootstrap: docker-push-bootstrap - docker manifest rm ${BOOTSTRAP_IMG} || true - docker manifest create ${BOOTSTRAP_IMG}--amend ${BOOTSTRAP_IMG}-amd64 --amend ${BOOTSTRAP_IMG}-arm64 - docker manifest annotate ${BOOTSTRAP_IMG} ${BOOTSTRAP_IMG}-amd64 --arch=amd64 - docker manifest annotate ${BOOTSTRAP_IMG} ${BOOTSTRAP_IMG}-arm64 --arch=arm64 - docker manifest push ${BOOTSTRAP_IMG} + docker manifest rm ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) || true + docker manifest create ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) --amend ${BOOTSTRAP_IMG}-amd64:$(BOOTSTRAP_IMG_TAG) --amend ${BOOTSTRAP_IMG}-arm64:$(BOOTSTRAP_IMG_TAG) + docker manifest annotate ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) ${BOOTSTRAP_IMG}-amd64:$(BOOTSTRAP_IMG_TAG) --arch=amd64 + docker manifest annotate ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) ${BOOTSTRAP_IMG}-arm64:$(BOOTSTRAP_IMG_TAG) --arch=arm64 + docker manifest push ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) all-controlplane: manager-controlplane @@ -334,11 +334,11 @@ docker-push-controlplane: docker-push-controlplane-amd64 docker-push-controlplan .PHONY: docker-manifest-controlplane docker-manifest-controlplane: docker-push-controlplane - docker manifest rm ${CONTROLPLANE_IMG} || true - docker manifest create ${CONTROLPLANE_IMG} --amend ${CONTROLPLANE_IMG}-amd64 --amend ${CONTROLPLANE_IMG}-arm64 - docker manifest annotate ${CONTROLPLANE_IMG} ${CONTROLPLANE_IMG}-amd64 --arch=amd64 - docker manifest annotate ${CONTROLPLANE_IMG} ${CONTROLPLANE_IMG}-arm64 --arch=arm64 - docker manifest push ${CONTROLPLANE_IMG} + docker manifest rm ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) || true + docker manifest create ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) --amend ${CONTROLPLANE_IMG}-amd64:$(CONTROLPLANE_IMG_TAG) --amend ${CONTROLPLANE_IMG}-arm64:$(CONTROLPLANE_IMG_TAG) + docker manifest annotate ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) ${CONTROLPLANE_IMG}-amd64:$(CONTROLPLANE_IMG_TAG) --arch=amd64 + docker manifest annotate ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) ${CONTROLPLANE_IMG}-arm64:$(CONTROLPLANE_IMG_TAG) --arch=arm64 + docker manifest push ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) release: release-bootstrap release-controlplane cp metadata.yaml $(RELEASE_DIR)/metadata.yaml From dc72f234296486a3dc43acfd3c886444dc09b059 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 17:02:20 +0200 Subject: [PATCH 24/26] fix multiarch manifests --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8f359813..ec4833df 100644 --- a/Makefile +++ b/Makefile @@ -245,15 +245,15 @@ docker-build-bootstrap: manager-bootstrap docker-build-bootstrap-amd64 docker-bu # Push the bootstrap multiarch image .PHONY: docker-push-bootstrap docker-push-bootstrap-%: docker-build-bootstrap-% - docker push ${BOOTSTRAP_IMG}-$*:$(BOOTSTRAP_IMG_TAG) + docker push ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG)-$* docker-push-bootstrap: docker-push-bootstrap-amd64 docker-push-bootstrap-arm64 .PHONY: docker-manifest-bootstrap docker-manifest-bootstrap: docker-push-bootstrap docker manifest rm ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) || true - docker manifest create ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) --amend ${BOOTSTRAP_IMG}-amd64:$(BOOTSTRAP_IMG_TAG) --amend ${BOOTSTRAP_IMG}-arm64:$(BOOTSTRAP_IMG_TAG) - docker manifest annotate ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) ${BOOTSTRAP_IMG}-amd64:$(BOOTSTRAP_IMG_TAG) --arch=amd64 - docker manifest annotate ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) ${BOOTSTRAP_IMG}-arm64:$(BOOTSTRAP_IMG_TAG) --arch=arm64 + docker manifest create ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) --amend ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG)-amd64 --amend ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG)-arm64 + docker manifest annotate ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG)-amd64 --arch=amd64 + docker manifest annotate ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG)-arm64 --arch=arm64 docker manifest push ${BOOTSTRAP_IMG}:$(BOOTSTRAP_IMG_TAG) all-controlplane: manager-controlplane @@ -329,15 +329,15 @@ docker-build-controlplane: manager-controlplane docker-build-controlplane-amd64 # Push the controlplane multiarch image .PHONY: docker-push-controlplane docker-push-controlplane-%: docker-build-controlplane-% - docker push ${CONTROLPLANE_IMG}-$*:$(CONTROLPLANE_IMG_TAG) + docker push ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG)-$* docker-push-controlplane: docker-push-controlplane-amd64 docker-push-controlplane-arm64 .PHONY: docker-manifest-controlplane docker-manifest-controlplane: docker-push-controlplane docker manifest rm ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) || true - docker manifest create ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) --amend ${CONTROLPLANE_IMG}-amd64:$(CONTROLPLANE_IMG_TAG) --amend ${CONTROLPLANE_IMG}-arm64:$(CONTROLPLANE_IMG_TAG) - docker manifest annotate ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) ${CONTROLPLANE_IMG}-amd64:$(CONTROLPLANE_IMG_TAG) --arch=amd64 - docker manifest annotate ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) ${CONTROLPLANE_IMG}-arm64:$(CONTROLPLANE_IMG_TAG) --arch=arm64 + docker manifest create ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) --amend ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG)-amd64 --amend ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG)-arm64 + docker manifest annotate ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG)-amd64 --arch=amd64 + docker manifest annotate ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG)-arm64 --arch=arm64 docker manifest push ${CONTROLPLANE_IMG}:$(CONTROLPLANE_IMG_TAG) release: release-bootstrap release-controlplane From 5fc25dd4b972475f80e8c33331d9ded7e21b863c Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Jul 2024 18:03:33 +0200 Subject: [PATCH 25/26] fix multiarch manifests --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ec4833df..b6b9d017 100644 --- a/Makefile +++ b/Makefile @@ -239,7 +239,7 @@ generate-bootstrap-conversions: $(CONVERSION_GEN) .PHONY: docker-build-bootstrap docker-build-bootstrap-%: - DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$* --build-arg package=./bootstrap/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${BOOTSTRAP_IMG}-$*:${BOOTSTRAP_IMG_TAG} + DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$* --build-arg package=./bootstrap/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${BOOTSTRAP_IMG}:${BOOTSTRAP_IMG_TAG}-$* docker-build-bootstrap: manager-bootstrap docker-build-bootstrap-amd64 docker-build-bootstrap-arm64 # Push the bootstrap multiarch image @@ -323,7 +323,7 @@ generate-controlplane-conversions: $(CONVERSION_GEN) .PHONY: docker-build-controlplane docker-build-controlplane-%: - DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$* --build-arg package=./controlplane/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${CONTROLPLANE_IMG}-$*:${CONTROLPLANE_IMG_TAG} + DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$* --build-arg package=./controlplane/main.go --build-arg ldflags="$(LDFLAGS)" . -t ${CONTROLPLANE_IMG}:${CONTROLPLANE_IMG_TAG}-$* docker-build-controlplane: manager-controlplane docker-build-controlplane-amd64 docker-build-controlplane-arm64 # Push the controlplane multiarch image From 61c37fbdbab66eaedaba5b6764a37b20ce47d9f5 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Wed, 3 Jul 2024 10:00:44 +0200 Subject: [PATCH 26/26] remove test gh triggers and tags --- .github/workflows/release.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 11fa61a6..e39cbfaa 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,7 +5,6 @@ on: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' - pull_request: jobs: release: @@ -23,7 +22,7 @@ jobs: - name: Retrieve build information id: build run: | - VERSION=v0.0.1-rcX #"${GITHUB_REF#refs/tags/}" + VERSION="${GITHUB_REF#refs/tags/}" echo "Releasing ${VERSION}" echo "VERSION=${VERSION}" >> $GITHUB_ENV