mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-09 10:02:56 +01:00
Add a way to install Helm
Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
345189653e
commit
ec7e89bd00
5 changed files with 45 additions and 42 deletions
|
|
@ -99,6 +99,12 @@ ARG KUBECTL_DOWNLOAD_SHA256
|
|||
|
||||
RUN if [ -n "$KUBECTL_VERSION" ] ; then /scripts/install-kubectl $KUBECTL_VERSION $KUBECTL_DOWNLOAD_SHA256; fi
|
||||
|
||||
# Helm
|
||||
ARG HELM_VERSION
|
||||
ARG HELM_DOWNLOAD_SHA256
|
||||
|
||||
RUN if [ -n "$HELM_VERSION" ] ; then /scripts/install-helm $HELM_VERSION $HELM_DOWNLOAD_SHA256; fi
|
||||
|
||||
RUN locale-gen C.UTF-8
|
||||
ENV LANG=C.UTF-8 \
|
||||
LANGUAGE=C \
|
||||
|
|
@ -122,4 +128,5 @@ ENV RUBY_VERSION=${RUBY_VERSION} \
|
|||
BAZELISK_VERSION=${BAZELISK_VERSION} \
|
||||
GCLOUD_VERSION=${GCLOUD_VERSION} \
|
||||
KUBECTL_VERSION=${KUBECTL_VERSION} \
|
||||
DEBIAN_VERSION=${DEBIAN_VERSION}
|
||||
CUSTOM_IMAGE_NAME=${CUSTOM_IMAGE_NAME} \
|
||||
CUSTOM_IMAGE_VERSION=${CUSTOM_IMAGE_VERSION}
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
FROM ruby:3.0.0-alpine
|
||||
MAINTAINER GitLab Engineering Productivity Team
|
||||
|
||||
ENV GCLOUD_VERSION=354.0.0
|
||||
ENV GCLOUD_URL=https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz
|
||||
|
||||
ENV KUBECTL_VERSION=1.17.17
|
||||
|
||||
ENV HELM_VERSION=3.5.3
|
||||
ENV HELM_URL=https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz
|
||||
ENV HELM_HOME=/root/.helm
|
||||
|
||||
# Install dependencies
|
||||
RUN apk --no-cache -U add openssl curl tar gzip bash ca-certificates git \
|
||||
&& mkdir -p /opt
|
||||
|
||||
# Install Google Cloud SDK
|
||||
RUN curl ${GCLOUD_URL} > /tmp/google-cloud-sdk.tar.gz
|
||||
RUN mkdir -p /usr/local/gcloud \
|
||||
&& tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz \
|
||||
&& /usr/local/gcloud/google-cloud-sdk/install.sh
|
||||
ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin
|
||||
|
||||
RUN gcloud version
|
||||
|
||||
# Install kubectl
|
||||
RUN wget https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl \
|
||||
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \
|
||||
&& rm -f kubectl
|
||||
|
||||
# Install Helm
|
||||
RUN wget -q -O - ${HELM_URL} | tar zxf - \
|
||||
&& mv linux-amd64/helm /usr/bin/ \
|
||||
&& chmod +x /usr/bin/helm \
|
||||
&& helm version --client
|
||||
|
||||
# Install kubeval
|
||||
RUN mkdir -p $HELM_HOME/plugins \
|
||||
&& helm plugin install https://github.com/instrumenta/helm-kubeval
|
||||
19
scripts/install-helm
Executable file
19
scripts/install-helm
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -xeou pipefail
|
||||
|
||||
HELM_VERSION=${1}
|
||||
HELM_DOWNLOAD_SHA256=${2}
|
||||
HELM_DOWNLOAD_URL="https://get.helm.sh/helm-v${HELM_VERSION}-linux-$(dpkg --print-architecture).tar.gz"
|
||||
|
||||
curl -fsSL "${HELM_DOWNLOAD_URL}" -o helm.tar.gz
|
||||
echo "${HELM_DOWNLOAD_SHA256} helm.tar.gz" | sha256sum -c -
|
||||
|
||||
|
||||
tar -xzf helm.tar.gz --strip-components=1
|
||||
rm helm.tar.gz
|
||||
|
||||
chmod +x helm
|
||||
mv helm /usr/bin/
|
||||
|
||||
helm version --client
|
||||
|
|
@ -284,6 +284,22 @@ function print_kubectl_args() {
|
|||
printf -- "--build-arg KUBECTL_DOWNLOAD_SHA256=%s " "${KUBECTL_DOWNLOAD_SHA256[$CUSTOM_DOCKER_ARCH]}"
|
||||
}
|
||||
|
||||
function print_helm_args() {
|
||||
declare -A HELM_DOWNLOAD_SHA256
|
||||
|
||||
case "$1" in
|
||||
3.5)
|
||||
HELM_VERSION=3.5.3
|
||||
HELM_DOWNLOAD_SHA256[amd64]=2170a1a644a9e0b863f00c17b761ce33d4323da64fc74562a3a6df2abbf6cd70
|
||||
HELM_DOWNLOAD_SHA256[arm64]=e1348d94ce4caace43689ee2dfa5f8bcd8687c12053d9c13d79875b65d6b72aa
|
||||
;;
|
||||
*) echo "Unknown helm version $1"; exit 1;
|
||||
esac
|
||||
|
||||
printf -- "--build-arg HELM_VERSION=%s " "$HELM_VERSION"
|
||||
printf -- "--build-arg HELM_DOWNLOAD_SHA256=%s " "${HELM_DOWNLOAD_SHA256[$CUSTOM_DOCKER_ARCH]}"
|
||||
}
|
||||
|
||||
function parse_arguments() {
|
||||
printf -- "-f Dockerfile.custom "
|
||||
|
||||
|
|
@ -331,6 +347,7 @@ function parse_arguments() {
|
|||
BAZELISK) print_bazelisk_args $version ;;
|
||||
GCLOUD) print_gcloud_args $version ;;
|
||||
KUBECTL) print_kubectl_args $version ;;
|
||||
HELM) print_helm_args $version ;;
|
||||
*) echo "unknown tool $tool"; exit 1;;
|
||||
esac
|
||||
fi
|
||||
|
|
@ -340,7 +357,6 @@ function parse_arguments() {
|
|||
|
||||
printf -- "--build-arg CUSTOM_IMAGE_NAME=%s " "$CUSTOM_IMAGE_NAME"
|
||||
printf -- "--build-arg CUSTOM_IMAGE_VERSION=%s " "$CUSTOM_IMAGE_VERSION"
|
||||
printf -- "--build-arg DEBIAN_VERSION=%s " "$CUSTOM_IMAGE_VERSION"
|
||||
}
|
||||
|
||||
function generate_command() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
PATH_TOOLS=(DEBIAN RUBY GOLANG NODE POSTGRESQL)
|
||||
TAG_TOOLS=(BUNDLER RUBYGEMS GIT LFS CHROME YARN GRAPHICSMAGICK PGBOUNCER BAZELISK DOCKER BUILDX GCLOUD KUBECTL)
|
||||
TAG_TOOLS=(BUNDLER RUBYGEMS GIT LFS CHROME YARN GRAPHICSMAGICK PGBOUNCER BAZELISK DOCKER BUILDX GCLOUD KUBECTL HELM)
|
||||
|
||||
function get_image_path() {
|
||||
local path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue