From 8651ae1663c8e0b3af62b8c539df011e45a85711 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 12:48:11 +0100 Subject: [PATCH 01/11] Switching to docker buildx to build multi arch image Signed-off-by: cmoulliard --- .github/workflows/build-push-image-commit.yaml | 16 ++++++++++------ .github/workflows/release.yml | 3 +++ Dockerfile | 4 +++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-push-image-commit.yaml b/.github/workflows/build-push-image-commit.yaml index 55308a7..74d0b87 100644 --- a/.github/workflows/build-push-image-commit.yaml +++ b/.github/workflows/build-push-image-commit.yaml @@ -4,7 +4,8 @@ on: branches: [ main ] push: branches: - - main + #- main + - 'issue-*' jobs: build_push_image: runs-on: ubuntu-latest @@ -12,10 +13,13 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install go 1.16 - uses: actions/setup-go@v2 - with: - go-version: 1.16 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + #- name: Install go 1.16 + # uses: actions/setup-go@v2 + # with: + # go-version: 1.16 - name: Login to Quay.io Hub uses: docker/login-action@v1 @@ -27,7 +31,7 @@ jobs: - name: Build the container image run: | VERSION=$(git rev-parse --short HEAD 2>/dev/null) - docker build -t cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . + docker buildx build --platform linux/amd64,linux/arm64 -t cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${VERSION}) docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3dea14..60f891e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,6 +20,9 @@ jobs: with: fetch-depth: 0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Configure Git run: | git config user.name "$GITHUB_ACTOR" diff --git a/Dockerfile b/Dockerfile index dfd26d6..eb5f6b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,9 @@ WORKDIR /go/src/webhook-app COPY . . RUN --mount=type=cache,target=$HOME/go/pkg/mod go mod download -RUN CGO_ENABLED=0 go build -o /webhook-app -ldflags '-w -extldflags "-static"' . +ARG TARGETOS +ARG TARGETARCH +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /webhook-app -ldflags '-w -extldflags "-static"' . FROM alpine:3 From 67c4cee7b60d02a960d0c5eea32c0b6e8a31e469 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 13:24:44 +0100 Subject: [PATCH 02/11] Swtch parameter from -t to --tag Signed-off-by: cmoulliard --- .github/workflows/build-push-image-commit.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-image-commit.yaml b/.github/workflows/build-push-image-commit.yaml index 74d0b87..9b83d04 100644 --- a/.github/workflows/build-push-image-commit.yaml +++ b/.github/workflows/build-push-image-commit.yaml @@ -31,7 +31,7 @@ jobs: - name: Build the container image run: | VERSION=$(git rev-parse --short HEAD 2>/dev/null) - docker buildx build --platform linux/amd64,linux/arm64 -t cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . + docker buildx build --platform linux/amd64,linux/arm64 --tag cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${VERSION}) docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} From 15805a1d7ce0c935e056e2184ae022b0ce8f1c11 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 13:54:59 +0100 Subject: [PATCH 03/11] Echo a message to try to understand why tagging fails Signed-off-by: cmoulliard --- .github/workflows/build-push-image-commit.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-push-image-commit.yaml b/.github/workflows/build-push-image-commit.yaml index 9b83d04..de520e0 100644 --- a/.github/workflows/build-push-image-commit.yaml +++ b/.github/workflows/build-push-image-commit.yaml @@ -34,6 +34,8 @@ jobs: docker buildx build --platform linux/amd64,linux/arm64 --tag cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${VERSION}) + echo "Tagging the images using as tag id: ${TAG_ID} and version: ${VERSION}" + docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:latest From 180d1cceec21df61814437d55aa130ebf1411011 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 14:17:52 +0100 Subject: [PATCH 04/11] Add the --load parameter to try to get the id of the image Signed-off-by: cmoulliard --- .github/workflows/build-push-image-commit.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-push-image-commit.yaml b/.github/workflows/build-push-image-commit.yaml index de520e0..c49d939 100644 --- a/.github/workflows/build-push-image-commit.yaml +++ b/.github/workflows/build-push-image-commit.yaml @@ -4,8 +4,8 @@ on: branches: [ main ] push: branches: - #- main - - 'issue-*' + - main + jobs: build_push_image: runs-on: ubuntu-latest @@ -31,7 +31,7 @@ jobs: - name: Build the container image run: | VERSION=$(git rev-parse --short HEAD 2>/dev/null) - docker buildx build --platform linux/amd64,linux/arm64 --tag cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . + docker buildx build --platform linux/amd64,linux/arm64 --load --tag cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${VERSION}) echo "Tagging the images using as tag id: ${TAG_ID} and version: ${VERSION}" From c4f0c7b39e3bca6e831f82b9af7e5a847033b4fb Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 14:55:23 +0100 Subject: [PATCH 05/11] Try to use mr-smithers-excellent/docker-build-push@v6 action Signed-off-by: cmoulliard --- .../workflows/build-push-image-commit.yaml | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-push-image-commit.yaml b/.github/workflows/build-push-image-commit.yaml index c49d939..053a83e 100644 --- a/.github/workflows/build-push-image-commit.yaml +++ b/.github/workflows/build-push-image-commit.yaml @@ -21,23 +21,28 @@ jobs: # with: # go-version: 1.16 - - name: Login to Quay.io Hub - uses: docker/login-action@v1 + - uses: mr-smithers-excellent/docker-build-push@v6 + name: Build & push Docker image with: + image: snowdrop/cert-manager-webhook-godaddy + platforms: 'amd64', 'arm64' + addLatest: true + multiPlatform: true + platform: linux/amd64,linux/arm64 registry: quay.io username: ${{ secrets.QUAY_ROBOT_USER }} password: ${{ secrets.QUAY_ROBOT_TOKEN }} - - name: Build the container image - run: | - VERSION=$(git rev-parse --short HEAD 2>/dev/null) - docker buildx build --platform linux/amd64,linux/arm64 --load --tag cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . - - TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${VERSION}) - echo "Tagging the images using as tag id: ${TAG_ID} and version: ${VERSION}" - - docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} - docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:latest - - docker push quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} - docker push quay.io/snowdrop/cert-manager-webhook-godaddy:latest \ No newline at end of file + #- name: Build the container image + # run: | + # VERSION=$(git rev-parse --short HEAD 2>/dev/null) + # docker buildx build --platform linux/${{ matrix.arch }} --load --tag cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . + # + # TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${VERSION}) + # echo "Tagging the images using as tag id: ${TAG_ID} and version: ${VERSION}" + # + # docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} + # docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:latest +# + # docker push quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} + # docker push quay.io/snowdrop/cert-manager-webhook-godaddy:latest \ No newline at end of file From 9eed013382ee95fd42e471ed3153384b36089a9e Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 15:09:56 +0100 Subject: [PATCH 06/11] Removing duplicated property Signed-off-by: cmoulliard --- .github/workflows/build-push-image-commit.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-push-image-commit.yaml b/.github/workflows/build-push-image-commit.yaml index 053a83e..b53f5f0 100644 --- a/.github/workflows/build-push-image-commit.yaml +++ b/.github/workflows/build-push-image-commit.yaml @@ -21,11 +21,10 @@ jobs: # with: # go-version: 1.16 - - uses: mr-smithers-excellent/docker-build-push@v6 - name: Build & push Docker image + - name: Build & push Docker image + uses: mr-smithers-excellent/docker-build-push@v6 with: image: snowdrop/cert-manager-webhook-godaddy - platforms: 'amd64', 'arm64' addLatest: true multiPlatform: true platform: linux/amd64,linux/arm64 From bd94b6a2dd0c14df81d5da2e381614bbce711e7b Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 15:20:52 +0100 Subject: [PATCH 07/11] Enable buildkit Signed-off-by: cmoulliard --- .github/workflows/build-push-image-commit.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-image-commit.yaml b/.github/workflows/build-push-image-commit.yaml index b53f5f0..a0fc52b 100644 --- a/.github/workflows/build-push-image-commit.yaml +++ b/.github/workflows/build-push-image-commit.yaml @@ -26,7 +26,7 @@ jobs: with: image: snowdrop/cert-manager-webhook-godaddy addLatest: true - multiPlatform: true + enableBuildKit: true # multiPlatform: true platform: linux/amd64,linux/arm64 registry: quay.io username: ${{ secrets.QUAY_ROBOT_USER }} From c25f608dd6d0e82ec18fe73512525ce44560dbf2 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 15:33:59 +0100 Subject: [PATCH 08/11] Enable buildkit and multiPlatform Signed-off-by: cmoulliard --- .github/workflows/build-push-image-commit.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-push-image-commit.yaml b/.github/workflows/build-push-image-commit.yaml index a0fc52b..7d2ef08 100644 --- a/.github/workflows/build-push-image-commit.yaml +++ b/.github/workflows/build-push-image-commit.yaml @@ -26,7 +26,8 @@ jobs: with: image: snowdrop/cert-manager-webhook-godaddy addLatest: true - enableBuildKit: true # multiPlatform: true + enableBuildKit: true + multiPlatform: true platform: linux/amd64,linux/arm64 registry: quay.io username: ${{ secrets.QUAY_ROBOT_USER }} From 114de842116aaee6e154964960ee515257ba19d0 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 15:53:18 +0100 Subject: [PATCH 09/11] Removing non needed comments Signed-off-by: cmoulliard --- .../workflows/build-push-image-commit.yaml | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/.github/workflows/build-push-image-commit.yaml b/.github/workflows/build-push-image-commit.yaml index 7d2ef08..33d251c 100644 --- a/.github/workflows/build-push-image-commit.yaml +++ b/.github/workflows/build-push-image-commit.yaml @@ -16,11 +16,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - #- name: Install go 1.16 - # uses: actions/setup-go@v2 - # with: - # go-version: 1.16 - - name: Build & push Docker image uses: mr-smithers-excellent/docker-build-push@v6 with: @@ -31,18 +26,4 @@ jobs: platform: linux/amd64,linux/arm64 registry: quay.io username: ${{ secrets.QUAY_ROBOT_USER }} - password: ${{ secrets.QUAY_ROBOT_TOKEN }} - - #- name: Build the container image - # run: | - # VERSION=$(git rev-parse --short HEAD 2>/dev/null) - # docker buildx build --platform linux/${{ matrix.arch }} --load --tag cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . - # - # TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${VERSION}) - # echo "Tagging the images using as tag id: ${TAG_ID} and version: ${VERSION}" - # - # docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} - # docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:latest -# - # docker push quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} - # docker push quay.io/snowdrop/cert-manager-webhook-godaddy:latest \ No newline at end of file + password: ${{ secrets.QUAY_ROBOT_TOKEN }} \ No newline at end of file From ad8b82c2ad433d2534d05c797c1612e21d403039 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 15:53:45 +0100 Subject: [PATCH 10/11] Updating the release workflow too Signed-off-by: cmoulliard --- .github/workflows/release.yml | 39 +++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 60f891e..bbb58d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,9 +20,6 @@ jobs: with: fetch-depth: 0 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Configure Git run: | git config user.name "$GITHUB_ACTOR" @@ -55,21 +52,37 @@ jobs: echo "TAG_VERSION=${TAG_VERSION}" >> "${GITHUB_OUTPUT}" - - name: Login to Quay.io Hub - uses: docker/login-action@v1 + # - name: Login to Quay.io Hub + # uses: docker/login-action@v1 + # with: + # registry: quay.io + # username: ${{ secrets.QUAY_ROBOT_USER }} + # password: ${{ secrets.QUAY_ROBOT_TOKEN }} + # + # - name: Build the container image + # run: | + # NEW_VERSION="${{ steps.tag-chart.outputs.TAG_VERSION }}" + # docker build -t cert-manager-webhook-godaddy:${NEW_VERSION} -f Dockerfile . + # + # TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${NEW_VERSION}) + # docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${NEW_VERSION} + # docker push quay.io/snowdrop/cert-manager-webhook-godaddy:${NEW_VERSION} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build & push Docker image + uses: mr-smithers-excellent/docker-build-push@v6 with: + image: snowdrop/cert-manager-webhook-godaddy + addLatest: true + enableBuildKit: true + multiPlatform: true + platform: linux/amd64,linux/arm64 registry: quay.io username: ${{ secrets.QUAY_ROBOT_USER }} password: ${{ secrets.QUAY_ROBOT_TOKEN }} - - name: Build the container image - run: | - NEW_VERSION="${{ steps.tag-chart.outputs.TAG_VERSION }}" - docker build -t cert-manager-webhook-godaddy:${NEW_VERSION} -f Dockerfile . - - TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${NEW_VERSION}) - docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${NEW_VERSION} - docker push quay.io/snowdrop/cert-manager-webhook-godaddy:${NEW_VERSION} - name: Run chart-releaser uses: helm/chart-releaser-action@v1.5.0 From 254d513162f95d7d7a192fdb152e1becc591715d Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Mon, 4 Dec 2023 15:55:37 +0100 Subject: [PATCH 11/11] Updating the releasing note Signed-off-by: cmoulliard --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index baf4fbd..f28c5b5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Table of Contents ================= * [Introduction](#introduction) + * [Paltform](#platform) * [Installation](#installation) * [Cert Manager](#cert-manager) * [The Godaddy webhook](#the-godaddy-webhook) @@ -30,6 +31,10 @@ This project supports the following versions of the certificate manager: **Remark**: The Helm chart `AppVersion` like the image `version` are tagged according to the version used to release this project: v0.1.0, v0.2.0. When using the main branch, the Helm chart will install the latest image pushed on [quay.io](https://quay.io/repository/snowdrop/cert-manager-webhook-godaddy) +## Platform + +The image built supports as Arch: am64 and arm64 since release `>= 0.2.0` + ## Installation ### Cert Manager