$PATH related fixes

This commit is contained in:
Paul Rogalinski-Pinter
2019-06-14 10:59:06 +02:00
parent ffb57969be
commit 31581aeeb4
4 changed files with 26 additions and 20 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ RUN set -ex \
&& 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 \
&& chmod +x /tmp/aws-iam-authenticator \
&& mv /tmp/aws-iam-authenticator /bin/aws-iam-authenticator
RUN PREFIX=/ /bin/setup-environments.sh
RUN /bin/setup-environments.sh
RUN rm -rf /tmp/*
LABEL description="Kubectl and Helm."
+15 -8
View File
@@ -1,21 +1,28 @@
#!/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.
PREFIX=~/.local
HELM_VERSION="${HELM_VERSION:-v2.14.1}"
KUBECTL_VERSION="${KUBECTL_VERSION:-v1.14.3}"
mkdir -p ${PREFIX}/bin
ln -s -f ${PREFIX}/lib/helm-${HELM_VERSION}/helm ${PREFIX}/bin
ln -s -f ${PREFIX}/lib/kubectl-${KUBECTL_VERSION}/kubectl ${PREFIX}/bin
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=${PREFIX}/bin:$PATH
export PATH=~/.local/bin:$PATH
echo "Using helm Version: ${HELM_VERSION}"
echo "Using kubectl Version: ${KUBECTL_VERSION}"
echo "Using helm Version: ${HELM_VERSION} installed into ~/.local/bin"
echo "Using kubectl Version: ${KUBECTL_VERSION} installed into ~/.local/bin"
/bin/drone-helm "$@"
helm version --client || error "Helm installation is not functional"
kubectl version --client || error "Kubectl installation is not functional"
/bin/drone-helm "$@"
+3 -1
View File
@@ -12,7 +12,9 @@ import (
"text/template"
)
var HELM_BIN = "/bin/helm"
// use $PATH to locate the currently activated helm binary
// do not harcode the full binary path
var HELM_BIN = "helm"
var KUBECONFIG = "/root/.kube/kubeconfig"
type (
+7 -10
View File
@@ -1,26 +1,23 @@
#!/bin/bash
PREFIX=~/.local
# will populate $PREFIX/lib/helm-$version/ with helm and tiller binaries
# 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 $PREFIX/lib/helm-${version}/
tar -C $PREFIX/lib/helm-${version}/ -xvf /tmp/${version}.tar.gz --strip 1
mkdir -p ~/.local/lib/helm-${version}/
tar -C ~/.local/lib/helm-${version}/ -xvf /tmp/${version}.tar.gz --strip 1
done
# will populate $PREFIX/lib/kubectl-$version/ with kubectl binaries
# 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 $PREFIX/lib/kubectl-${version}/
curl https://storage.googleapis.com/kubernetes-release/release/${version}/bin/${kubectl_arch}/kubectl > $PREFIX/lib/kubectl-${version}/kubectl
chmod +x $PREFIX/lib/kubectl-${version}/kubectl
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