mirror of
https://github.com/ipedrazas/drone-helm.git
synced 2026-06-14 22:11:57 +08:00
Revert "support for multiple pre-baked kube/helm versions"
This commit is contained in:
+20
-8
@@ -6,7 +6,7 @@ FROM golang:1.12-alpine3.9 as builder
|
|||||||
RUN apk update
|
RUN apk update
|
||||||
RUN apk add dep git
|
RUN apk add dep git
|
||||||
|
|
||||||
ENV GOOS=linux
|
ENV GOOS linux
|
||||||
ENV GOARCH=386
|
ENV GOARCH=386
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/ipedrazas/drone-helm
|
WORKDIR /go/src/github.com/ipedrazas/drone-helm
|
||||||
@@ -22,18 +22,30 @@ FROM alpine:3.9 as final
|
|||||||
MAINTAINER Ivan Pedrazas <ipedrazas@gmail.com>
|
MAINTAINER Ivan Pedrazas <ipedrazas@gmail.com>
|
||||||
|
|
||||||
COPY --from=builder /go/src/github.com/ipedrazas/drone-helm/drone-helm /bin/
|
COPY --from=builder /go/src/github.com/ipedrazas/drone-helm/drone-helm /bin/
|
||||||
COPY *.sh /bin/
|
|
||||||
COPY kubeconfig /root/.kube/kubeconfig
|
# Helm version: can be passed at build time
|
||||||
|
ARG VERSION
|
||||||
|
ENV VERSION ${VERSION:-v2.14.1}
|
||||||
|
ENV FILENAME helm-${VERSION}-linux-amd64.tar.gz
|
||||||
|
|
||||||
|
ARG KUBECTL
|
||||||
|
ENV KUBECTL ${KUBECTL:-v1.14.3}
|
||||||
|
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
&& apk add --no-cache curl ca-certificates bash \
|
&& apk add --no-cache curl ca-certificates \
|
||||||
|
&& curl -o /tmp/${FILENAME} http://storage.googleapis.com/kubernetes-helm/${FILENAME} \
|
||||||
|
&& curl -o /tmp/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl \
|
||||||
&& curl -o /tmp/aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator \
|
&& curl -o /tmp/aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator \
|
||||||
|
&& tar -zxvf /tmp/${FILENAME} -C /tmp \
|
||||||
|
&& mv /tmp/linux-amd64/helm /bin/helm \
|
||||||
|
&& chmod +x /tmp/kubectl \
|
||||||
|
&& mv /tmp/kubectl /bin/kubectl \
|
||||||
&& chmod +x /tmp/aws-iam-authenticator \
|
&& chmod +x /tmp/aws-iam-authenticator \
|
||||||
&& mv /tmp/aws-iam-authenticator /bin/aws-iam-authenticator
|
&& mv /tmp/aws-iam-authenticator /bin/aws-iam-authenticator \
|
||||||
RUN /bin/setup-environments.sh
|
&& rm -rf /tmp/*
|
||||||
RUN rm -rf /tmp/*
|
|
||||||
|
|
||||||
LABEL description="Kubectl and Helm."
|
LABEL description="Kubectl and Helm."
|
||||||
LABEL base="alpine"
|
LABEL base="alpine"
|
||||||
|
COPY kubeconfig /root/.kube/kubeconfig
|
||||||
|
|
||||||
ENTRYPOINT [ "/bin/entrypoint.sh" ]
|
ENTRYPOINT [ "/bin/drone-helm" ]
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
function error {
|
|
||||||
echo "$1"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Will symlink `helm` and `kubectl` binaries based on the `$HELM_VERSION` and
|
|
||||||
# `$KUBECTL_VERSION` env variables into `$PREFIX/bin`, add `$PREFIX/bin` to
|
|
||||||
# the `$PATH` and delegate further execution to `/bin/drone-helm`
|
|
||||||
# See `set-environments.sh` for baked in versions.
|
|
||||||
|
|
||||||
HELM_VERSION="${HELM_VERSION:-v2.14.1}"
|
|
||||||
KUBECTL_VERSION="${KUBECTL_VERSION:-v1.14.3}"
|
|
||||||
|
|
||||||
mkdir -p ~/.local/bin
|
|
||||||
ln -s -f ~/.local/lib/helm-${HELM_VERSION}/helm ~/.local/bin
|
|
||||||
ln -s -f ~/.local/lib/kubectl-${KUBECTL_VERSION}/kubectl ~/.local/bin
|
|
||||||
|
|
||||||
export PATH=~/.local/bin:$PATH
|
|
||||||
|
|
||||||
echo "Using helm Version: ${HELM_VERSION} installed into ~/.local/bin"
|
|
||||||
echo "Using kubectl Version: ${KUBECTL_VERSION} installed into ~/.local/bin"
|
|
||||||
|
|
||||||
helm version --client || error "Helm installation is not functional"
|
|
||||||
kubectl version --client || error "Kubectl installation is not functional"
|
|
||||||
|
|
||||||
/bin/drone-helm "$@"
|
|
||||||
+1
-3
@@ -12,9 +12,7 @@ import (
|
|||||||
"text/template"
|
"text/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
// use $PATH to locate the currently activated helm binary
|
var HELM_BIN = "/bin/helm"
|
||||||
// do not harcode the full binary path
|
|
||||||
var HELM_BIN = "helm"
|
|
||||||
var KUBECONFIG = "/root/.kube/kubeconfig"
|
var KUBECONFIG = "/root/.kube/kubeconfig"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# will populate ~/.local/lib/helm-$version/ with helm and tiller binaries
|
|
||||||
helm_arch="linux-amd64"
|
|
||||||
helm_versions=(v2.14.1 v2.13.1 v2.12.3)
|
|
||||||
|
|
||||||
for version in "${helm_versions[@]}"
|
|
||||||
do
|
|
||||||
curl http://storage.googleapis.com/kubernetes-helm/helm-${version}-${helm_arch}.tar.gz > /tmp/${version}.tar.gz
|
|
||||||
mkdir -p ~/.local/lib/helm-${version}/
|
|
||||||
tar -C ~/.local/lib/helm-${version}/ -xvf /tmp/${version}.tar.gz --strip 1
|
|
||||||
done
|
|
||||||
|
|
||||||
# will populate ~/.local/lib/kubectl-$version/ with kubectl binaries
|
|
||||||
kubectl_arch="linux/amd64"
|
|
||||||
kubectl_versions=(v1.14.3 v1.13.7 v1.12.9)
|
|
||||||
|
|
||||||
for version in "${kubectl_versions[@]}"
|
|
||||||
do
|
|
||||||
mkdir -p ~/.local/lib/kubectl-${version}/
|
|
||||||
curl https://storage.googleapis.com/kubernetes-release/release/${version}/bin/${kubectl_arch}/kubectl > ~/.local/lib/kubectl-${version}/kubectl
|
|
||||||
chmod +x ~/.local/lib/kubectl-${version}/kubectl
|
|
||||||
done
|
|
||||||
Reference in New Issue
Block a user