From 87b72966184491c024aad202a469f54818523e8a Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Wed, 2 Feb 2022 21:32:53 +0100 Subject: [PATCH 1/4] fix(ci): enable force push --- .drone.yml | 72 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/.drone.yml b/.drone.yml index 46ef6f1..f6a379a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -54,16 +54,18 @@ steps: - name: build image: plugins/docker settings: - dockerfile: Dockerfile auto_tag: false + dockerfile: Dockerfile dry_run: true - tags: latest-amd64 + force_tag: true + no_cache: true + purge: true repo: volkerraschek/helm + tags: latest-amd64 username: from_secret: container_image_registry_user password: from_secret: container_image_registry_password - no_cache: true volumes: - name: docker_socket path: /var/run/docker.sock @@ -115,16 +117,18 @@ steps: - name: build image: plugins/docker settings: - dockerfile: Dockerfile auto_tag: false + dockerfile: Dockerfile dry_run: true - tags: latest-arm-v7 + force_tag: true + no_cache: true + purge: true repo: volkerraschek/helm + tags: latest-arm-v7 username: from_secret: container_image_registry_user password: from_secret: container_image_registry_password - no_cache: true - name: notify image: drillster/drone-email @@ -176,16 +180,18 @@ steps: - name: build image: plugins/docker settings: - dockerfile: Dockerfile auto_tag: false + dockerfile: Dockerfile dry_run: true - tags: latest-arm64-v8 + force_tag: true + no_cache: true + purge: true repo: volkerraschek/helm + tags: latest-arm64-v8 username: from_secret: container_image_registry_user password: from_secret: container_image_registry_password - no_cache: true - name: notify image: drillster/drone-email @@ -237,15 +243,17 @@ steps: - name: build image: plugins/docker settings: - dockerfile: Dockerfile auto_tag: false - tags: latest-amd64 + dockerfile: Dockerfile + force_tag: true + no_cache: true + purge: true repo: volkerraschek/helm + tags: latest-amd64 username: from_secret: container_image_registry_user password: from_secret: container_image_registry_password - no_cache: true volumes: - name: docker_socket path: /var/run/docker.sock @@ -296,15 +304,17 @@ steps: - name: build image: plugins/docker settings: - dockerfile: Dockerfile auto_tag: false - tags: latest-arm-v7 + dockerfile: Dockerfile + force_tag: true + no_cache: true + purge: true repo: volkerraschek/helm + tags: latest-arm-v7 username: from_secret: container_image_registry_user password: from_secret: container_image_registry_password - no_cache: true - name: notify image: drillster/drone-email @@ -355,15 +365,17 @@ steps: - name: build image: plugins/docker settings: - dockerfile: Dockerfile auto_tag: false - tags: latest-arm64-v8 + dockerfile: Dockerfile + force_tag: true + no_cache: true + purge: true repo: volkerraschek/helm + tags: latest-arm64-v8 username: from_secret: container_image_registry_user password: from_secret: container_image_registry_password - no_cache: true - name: notify image: drillster/drone-email @@ -465,9 +477,12 @@ steps: - name: build image: plugins/docker settings: - dockerfile: Dockerfile - auto_tag: true auto_tag_suffix: amd64 + auto_tag: true + dockerfile: Dockerfile + force_tag: true + no_cache: true + purge: true repo: volkerraschek/helm username: from_secret: container_image_registry_user @@ -475,7 +490,6 @@ steps: from_secret: container_image_registry_password build_args: - HELM_VERSION=${DRONE_TAG} - no_cache: true volumes: - name: docker_socket path: /var/run/docker.sock @@ -520,9 +534,12 @@ steps: - name: build image: plugins/docker settings: - dockerfile: Dockerfile - auto_tag: true auto_tag_suffix: arm-v7 + auto_tag: true + dockerfile: Dockerfile + force_tag: true + no_cache: true + purge: true repo: volkerraschek/helm username: from_secret: container_image_registry_user @@ -530,7 +547,6 @@ steps: from_secret: container_image_registry_password build_args: - HELM_VERSION=${DRONE_TAG} - no_cache: true volumes: - name: docker_socket path: /var/run/docker.sock @@ -575,9 +591,12 @@ steps: - name: build image: plugins/docker settings: - dockerfile: Dockerfile - auto_tag: true auto_tag_suffix: arm64-v8 + auto_tag: true + dockerfile: Dockerfile + force_tag: true + no_cache: true + purge: true repo: volkerraschek/helm username: from_secret: container_image_registry_user @@ -585,7 +604,6 @@ steps: from_secret: container_image_registry_password build_args: - HELM_VERSION=${DRONE_TAG} - no_cache: true volumes: - name: docker_socket path: /var/run/docker.sock From 7408a66044b7d84942ee90e7b6093b11d7b4ae26 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Thu, 3 Feb 2022 17:59:25 +0100 Subject: [PATCH 2/4] fix: compile helm cm-push plugin via build step --- Dockerfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Dockerfile b/Dockerfile index fecf1a7..55082f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,13 @@ +FROM docker.io/library/golang:1.17.6-alpine AS helm-push-plugin + +RUN apk update && \ + apk upgrade && \ + apk add make git + +RUN git clone https://github.com/volker-raschek/helm-push && \ + make --directory /go/helm-push build_linux && \ + cp /go/helm-push/bin/linux/$(go env GOARCH)/helm-cm-push /go/helm-push/helm-cm-push + FROM docker.io/library/alpine:3.14 ARG HELM_VERSION @@ -5,4 +15,10 @@ ARG HELM_VERSION COPY install.sh /install.sh RUN VERSION=${HELM_VERSION} /install.sh +# TODO: Until the following issue is not fixed, it is not possible to install +# cm-push on other target architectures instead of amd64. Use instead the +# precompiled binary. +# https://github.com/chartmuseum/helm-push/issues/128 +COPY --from=helm-push-plugin /go/helm-push/helm-cm-push /usr/bin/helm-cm-push + ENTRYPOINT [ "/usr/bin/helm" ] From 46a766bbfb7b6de5f4c0c22af305c816079c109d Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Thu, 3 Feb 2022 21:19:06 +0100 Subject: [PATCH 3/4] fix: install helm cm-push plugin from upstream --- Dockerfile | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 55082f6..eb3e685 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,3 @@ -FROM docker.io/library/golang:1.17.6-alpine AS helm-push-plugin - -RUN apk update && \ - apk upgrade && \ - apk add make git - -RUN git clone https://github.com/volker-raschek/helm-push && \ - make --directory /go/helm-push build_linux && \ - cp /go/helm-push/bin/linux/$(go env GOARCH)/helm-cm-push /go/helm-push/helm-cm-push - FROM docker.io/library/alpine:3.14 ARG HELM_VERSION @@ -15,10 +5,7 @@ ARG HELM_VERSION COPY install.sh /install.sh RUN VERSION=${HELM_VERSION} /install.sh -# TODO: Until the following issue is not fixed, it is not possible to install -# cm-push on other target architectures instead of amd64. Use instead the -# precompiled binary. -# https://github.com/chartmuseum/helm-push/issues/128 -COPY --from=helm-push-plugin /go/helm-push/helm-cm-push /usr/bin/helm-cm-push +# Install additionally cm-push plugin +RUN helm plugin install https://github.com/chartmuseum/helm-push.git ENTRYPOINT [ "/usr/bin/helm" ] From e2eb729cec7c8d5a02ff1004ca88768114348722 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Wed, 9 Feb 2022 22:05:48 +0100 Subject: [PATCH 4/4] fix: install helm via installation script --- Dockerfile | 11 ++++++++--- Makefile | 2 +- install.sh | 38 -------------------------------------- 3 files changed, 9 insertions(+), 42 deletions(-) delete mode 100755 install.sh diff --git a/Dockerfile b/Dockerfile index eb3e685..c49a143 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,15 @@ FROM docker.io/library/alpine:3.14 ARG HELM_VERSION -COPY install.sh /install.sh -RUN VERSION=${HELM_VERSION} /install.sh +RUN apk add bash curl git openssl && \ + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 --output /tmp/install.sh + +RUN [[ ${HELM_VERSION} == "" ]]; bash /tmp/install.sh +RUN [[ ${HELM_VERSION} != "" ]]; bash /tmp/install.sh --version ${HELM_VERSION} + +RUN rm /tmp/install.sh # Install additionally cm-push plugin RUN helm plugin install https://github.com/chartmuseum/helm-push.git -ENTRYPOINT [ "/usr/bin/helm" ] +ENTRYPOINT [ "/usr/local/bin/helm" ] diff --git a/Makefile b/Makefile index 82a63b8..0d6f283 100644 --- a/Makefile +++ b/Makefile @@ -49,4 +49,4 @@ container-image/push: # ============================================================================== # Declare the contents of the PHONY variable as phony. We keep that information # in a variable so we can use it in if_changed. -.PHONY: ${PHONY} \ No newline at end of file +.PHONY: ${PHONY} diff --git a/install.sh b/install.sh deleted file mode 100755 index 54e5067..0000000 --- a/install.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -set -xe - -BASE_URL=https://get.helm.sh - -if [ -z ${VERSION+x} ]; then - echo ${VERSION} not defined - exit 1 -fi - -case `uname -m` in - x86_64) - ARCH=amd64 - ;; - armv7l) - ARCH=arm - ;; - aarch64) - ARCH=arm64 - ;; - ppc64le) - ARCH=ppc64le - ;; - s390x) - ARCH=s390x - ;; - *) - echo "un-supported arch, exit ..." - exit 1 - ;; -esac - -apk add --update --no-cache wget git -wget ${BASE_URL}/helm-${VERSION}-linux-${ARCH}.tar.gz -O - | tar -xz -mv linux-${ARCH}/helm /usr/bin/helm -chmod +x /usr/bin/helm -rm -rf linux-${ARCH} \ No newline at end of file