diff --git a/Makefile b/Makefile index cfafdbb..0fab058 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ test: test-build ## test the build against all target platforms. $(MAKE) build-image IMAGE=$(IMAGE) \ KUBECTL_VERSION=$(KUBECTL_VERSION) HELM_VERSION=$(HELM_VERSION) \ - KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) K9S_VERSION=$(K9S_VERSION) \ + KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) \ ./hack/test test-build: diff --git a/hack/make/deps.mk b/hack/make/deps.mk index 1480a36..0e8d613 100644 --- a/hack/make/deps.mk +++ b/hack/make/deps.mk @@ -15,17 +15,7 @@ KUSTOMIZE_SUM_amd64 := 6703a3a70a0c47cf0b37694030b54f1175a9dfeb17b3818b623ed58b9 # renovate: datasource=github-release-attachments depName=kubernetes-sigs/kustomize versioning=regex:^kustomize/v(?\d+)\.(?\d+)\.(?\d+)$ digestVersion=kustomize/v5.5.0 KUSTOMIZE_SUM_s390x := 37dcd2429ef93886319b39671071b2e1c5307993cdb6a5c097cfefc97177d296 -# renovate: datasource=github-release-attachments depName=derailed/k9s -K9S_VERSION := v0.32.6 -# renovate: datasource=github-release-attachments depName=derailed/k9s digestVersion=v0.32.6 -K9S_SUM_arm64 := dfe0bb78e17a4b72ff151e18e548467b6073608e1af4e2efb30a884eed772ea0 -# renovate: datasource=github-release-attachments depName=derailed/k9s digestVersion=v0.32.6 -K9S_SUM_amd64 := 3f5fa5b3563cf2962ecd78381df59a72a01d824d87f3c70493f7748807243755 -# renovate: datasource=github-release-attachments depName=derailed/k9s digestVersion=v0.32.6 -K9S_SUM_s390x := 261074c92d1d2e9b181700b2cf8d7166acff30d2bb425437c9f5027815de44b6 - # Reduces the code duplication on Makefile by keeping all args into a single variable. IMAGE_ARGS := --build-arg HELM_VERSION=$(HELM_VERSION) \ --build-arg KUBECTL_VERSION=$(KUBECTL_VERSION) --build-arg KUBECTL_SUM_arm64=$(KUBECTL_SUM_arm64) --build-arg KUBECTL_SUM_amd64=$(KUBECTL_SUM_amd64) --build-arg KUBECTL_SUM_s390x=$(KUBECTL_SUM_s390x) \ - --build-arg KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) --build-arg KUSTOMIZE_SUM_arm64=$(KUSTOMIZE_SUM_arm64) --build-arg KUSTOMIZE_SUM_amd64=$(KUSTOMIZE_SUM_amd64) --build-arg KUSTOMIZE_SUM_s390x=$(KUSTOMIZE_SUM_s390x) \ - --build-arg K9S_VERSION=$(K9S_VERSION) --build-arg K9S_SUM_arm64=$(K9S_SUM_arm64) --build-arg K9S_SUM_amd64=$(K9S_SUM_amd64) --build-arg K9S_SUM_s390x=$(K9S_SUM_s390x) + --build-arg KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) --build-arg KUSTOMIZE_SUM_arm64=$(KUSTOMIZE_SUM_arm64) --build-arg KUSTOMIZE_SUM_amd64=$(KUSTOMIZE_SUM_amd64) --build-arg KUSTOMIZE_SUM_s390x=$(KUSTOMIZE_SUM_s390x) diff --git a/hack/test b/hack/test index fc40c58..0c43917 100755 --- a/hack/test +++ b/hack/test @@ -31,9 +31,9 @@ function expected_file(){ function check_files(){ echo "checking expected binaries:" + expected_file "/usr/bin/k9s" "0:0" "755" expected_file "/usr/local/bin/helm" "0:0" "755" expected_file "/usr/local/bin/helm-cmd" "0:0" "755" - expected_file "/usr/local/bin/k9s" "0:0" "755" expected_file "/usr/local/bin/kubectl" "0:0" "755" expected_file "/usr/local/bin/kustomize" "0:0" "755" expected_file "/usr/local/bin/welcome" "0:0" "755" @@ -63,7 +63,6 @@ function check_versions(){ echo "checking command versions:" expected_version "helm" "${HELM_VERSION}" expected_version "kustomize" "${KUSTOMIZE_VERSION}" - expected_version "k9s" "${K9S_VERSION}" # --client=true is used so that it does not fail trying to # identify the server version. expected_version "kubectl --client=true" "${KUBECTL_VERSION}" diff --git a/package/Dockerfile b/package/Dockerfile index 4a0993a..35ced8c 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -43,27 +43,31 @@ RUN curl --output /tmp/kustomize.tar.gz -sLf "https://github.com/kubernetes-sigs echo "${!KUSTOMIZE_SUM} /tmp/kustomize.tar.gz" | sha256sum -c - && \ tar -xvzf /tmp/kustomize.tar.gz -C / kustomize -# Stage k9s into build -ENV K9S_SUM="K9S_SUM_${TARGETARCH}" -RUN curl --output /tmp/k9s.tar.gz -sLf "https://github.com/derailed/k9s/releases/download/${K9S_VERSION}/k9s_Linux_${TARGETARCH}.tar.gz" && \ - echo "${!K9S_SUM} /tmp/k9s.tar.gz" | sha256sum -c - && \ - tar -xvzf /tmp/k9s.tar.gz -C / k9s - FROM registry.suse.com/bci/bci-base:${BCI_VERSION} AS zypper +ARG BCI_VERSION=15.6 +ENV BCI_VERSION=${BCI_VERSION} + # Creates the based dir for the target image, and hydrates it with the # original contents of the final image. RUN mkdir /chroot COPY --from=final / /chroot/ +# Setup repo needed to install k9s package +RUN zypper --non-interactive ar https://download.opensuse.org/repositories/devel:kubic/${BCI_VERSION}/devel:kubic.repo \ + && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_ARM/ devel_kubic_arm \ + && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_zSystems/ devel_kubic_zed \ + && rpm --import https://download.opensuse.org/repositories/devel:/kubic/${BCI_VERSION}/repodata/repomd.xml.key \ + --import https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_ARM/repodata/repomd.xml.key \ + --import https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_zSystems/repodata/repomd.xml.key \ + && zypper --non-interactive refresh + # The final image does not contain zypper, --installroot is used to # install all artefacts within a dir (/chroot) that can then be copied # over to a scratch image. RUN zypper --non-interactive refresh && \ zypper --installroot /chroot -n rm busybox-vi busybox-links && \ - zypper --installroot /chroot -n in bash-completion jq vim curl && \ - zypper --installroot /chroot clean -a && \ - rm -rf /chroot/var/cache/zypp/* /chroot/var/log/zypp/* /chroot/etc/zypp/ + zypper --installroot /chroot -n in bash-completion jq vim curl k9s RUN echo 'shell:x:1000:1000:shell,,,:/home/shell:/bin/bash' > /chroot/etc/passwd && \ @@ -84,7 +88,7 @@ FROM scratch COPY --from=zypper /chroot / COPY --chown=root:root --chmod=0755 --from=helm /helm/bin/helm /usr/local/bin/ -COPY --chown=root:root --chmod=0755 --from=build /kubectl /k9s /kustomize* /usr/local/bin/ +COPY --chown=root:root --chmod=0755 --from=build /kubectl /kustomize* /usr/local/bin/ COPY --chown=root:root --chmod=0755 package/helm-cmd package/welcome /usr/local/bin/ COPY --chown=1000:1000 --chmod=0755 package/kustomize.sh /home/shell/