Last active
January 31, 2025 21:36
-
-
Save hegerdes/c3b096ef26edfa3d6d85f109f1bc3d06 to your computer and use it in GitHub Desktop.
List of snippet to install common cli tools. Helpful for CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Installing core tools | |
if command -v apk > /dev/null; then | |
apk add --no-cache curl jq unzip tar gzip gcompat > /dev/null | |
else | |
echo "The apk package manager does not exist. Skipping core tool install." | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if argo-cli is installed | |
if ! command -v argo > /dev/null; then | |
echo "Installing argo-cli" | |
echo "You can set the desired version via ARGO_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
ARGO_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/argoproj/argo-cd/releases/latest | jq -r .tag_name) | |
curl -sL --fail --output /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/${ARGO_VERSION-$ARGO_DEFAULT_VERSION}/argocd-linux-${ARCH-amd64} | |
chmod +x /usr/local/bin/argocd | |
fi | |
argocd version --client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if aws cli is installed | |
if ! command -v aws > /dev/null; then | |
echo "Installing aws-cli" | |
if command -v apk > /dev/null; then | |
apk add --no-cache aws-cli > /dev/null | |
else | |
curl -sL "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "/tmp/awscliv2.zip" | |
unzip /tmp/awscliv2.zip -d /tmp > /dev/null | |
/tmp/aws/install > /dev/null | |
fi | |
fi | |
aws --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if azcopy is installed | |
if ! command -v azcopy > /dev/null; then | |
echo "Installing azcopy" | |
if [ "$(uname -m)" = "aarch64" ]; then | |
ARCH="-arm64" | |
fi | |
if command -v apk > /dev/null; then | |
apk add --no-cache libc6-compat > /dev/null | |
fi | |
curl -sL https://aka.ms/downloadazcopy-v10-linux${ARCH} -o az-copy.tar | |
tar -xf az-copy.tar --strip-components=1 -C /usr/local/bin/ | |
fi | |
azcopy --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if az cli is installed | |
if ! command -v az > /dev/null; then | |
if command -v apt-get > /dev/null; then | |
echo "Installing azure-cli" | |
mkdir -p /etc/apt/keyrings | |
apt-get update -qq > /dev/null | |
apt-get install -y -qq --no-install-recommends \ | |
apt-transport-https ca-certificates curl gnupg lsb-release > /dev/null | |
curl -sLS https://packages.microsoft.com/keys/microsoft.asc | | |
gpg --dearmor -o /etc/apt/keyrings/microsoft.gpg | |
chmod go+r /etc/apt/keyrings/microsoft.gpg | |
echo "Types: deb | |
URIs: https://packages.microsoft.com/repos/azure-cli/ | |
Suites: $(lsb_release -cs) | |
Components: main | |
Architectures: $(dpkg --print-architecture) | |
Signed-by: /etc/apt/keyrings/microsoft.gpg" > /etc/apt/sources.list.d/azure-cli.sources | |
sed -i 's/^[ \t]*//' /etc/apt/sources.list.d/azure-cli.sources | |
apt-get update -qq > /dev/null | |
apt-get install -y -qq azure-cli --no-install-recommends > /dev/null | |
az version | |
else | |
echo "Azure CLI install is currently only supported in debian based images. Skipping install!" | |
fi | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if cosign is installed | |
if ! command -v cosign > /dev/null; then | |
echo "Installing cosign!" | |
echo "You can set the desired version via COSIGN_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
COSIGN_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r .name) | |
COSIGN_VERSION="${COSIGN_VERSION-$COSIGN_DEFAULT_VERSION}" | |
curl -sL --fail --output /usr/local/bin/cosign "https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-linux-${ARCH-amd64}" | |
chmod +x /usr/local/bin/cosign | |
fi | |
cosign version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Installing core tools | |
if command -v apt-get > /dev/null; then | |
if [ ! -z ${HTTP_PROXY+x} ]; then | |
echo "Acquire::http::Proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf | |
fi | |
if [ ! -z ${HTTPS_PROXY+x} ]; then | |
echo "Acquire::https::Proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf | |
fi | |
apt-get update -qq > /dev/null | |
apt-get install -y -qq --no-install-recommends \ | |
curl jq unzip ca-certificates tar gzip > /dev/null | |
else | |
echo "The apt package manager does not exist. Skipping core tool install." | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if git is installed | |
if ! command -v git > /dev/null; then | |
echo "Installing git" | |
if command -v apt-get > /dev/null; then | |
apt-get update -qq > /dev/null | |
apt-get install -y -qq --no-install-recommends git > /dev/null | |
elif command -v apk > /dev/null; then | |
apk add git > /dev/null | |
else | |
echo "Unsupported OS. Can not install git" | |
fi | |
fi | |
git version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if helm-docs is installed | |
if ! command -v helm-docs > /dev/null; then | |
echo "Installing helm-docs" | |
echo "You can set the desired version via HELM_DOCS_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=x86_64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
HELM_DOCS_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/norwoodj/helm-docs/releases/latest | jq -r .tag_name) | |
HELM_DOCS_VERSION=${HELM_DOCS_VERSION-$HELM_DOCS_DEFAULT_VERSION} | |
# Fix version beginning with "v" | |
if echo "${HELM_DOCS_VERSION}" | grep -q "v"; then | |
HELM_DOCS_VERSION="${HELM_DOCS_VERSION:1}" | |
fi | |
curl -sL --fail --output helm-docs.tar.gz https://github.com/norwoodj/helm-docs/releases/download/v${HELM_DOCS_VERSION}/helm-docs_${HELM_DOCS_VERSION}_Linux_${ARCH-amd64}.tar.gz | |
tar -xzf helm-docs.tar.gz -C /usr/local/bin --exclude={LICENSE,README.md,CHANGELOG.md} | |
rm helm-docs.tar.gz | |
fi | |
helm-docs --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if helm is installed | |
if ! command -v helm > /dev/null; then | |
echo "Installing helm" | |
echo "You can set the desired version via HELM_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
HELM_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/helm/helm/releases/latest | jq -r .tag_name) | |
curl -sL --fail --output /tmp/helm.tar.gz https://get.helm.sh/helm-${HELM_VERSION-$HELM_DEFAULT_VERSION}-linux-${ARCH-amd64}.tar.gz | |
tar -xzf /tmp/helm.tar.gz -C /usr/local/bin/ --strip-components=1 --exclude={LICENSE,README.md} | |
fi | |
helm version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if jq is installed | |
if ! command -v jq > /dev/null; then | |
echo "Installing jq" | |
echo "You can set the desired version via JQ_VERSION_TAG. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
JQ_DEFAULT_VERSION_TAG=$(curl -sL https://api.github.com/repos/jqlang/jq/releases/latest | grep tag_name | cut -d : -f 2 | sed 's/^ *//; s/ *$//; s/"//g; s/,//g') | |
curl -sL --fail --output /usr/local/bin/jq https://github.com/jqlang/jq/releases/download/${JQ_VERSION_TAG-$JQ_DEFAULT_VERSION_TAG}/jq-linux-${ARCH-amd64} | |
chmod +x /usr/local/bin/jq | |
fi | |
jq --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if kind is installed | |
if ! command -v kind > /dev/null; then | |
echo "Installing kind" | |
echo "You can set the desired version via KIND_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
KIND_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r .tag_name) | |
curl -sL --fail --output /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION-$KIND_DEFAULT_VERSION}/kind-linux-${ARCH-amd64} | |
chmod +x /usr/local/bin/kind | |
fi | |
kind version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if kubeconform is installed | |
if ! command -v kubeconform > /dev/null; then | |
echo "Installing kubeconform" | |
echo "You can set the desired version via KUBECONFORM_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
KUBECONFORM_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/yannh/kubeconform/releases/latest | jq -r .tag_name) | |
curl -sL --fail --output /tmp/kubeconform.tar.gz \ | |
https://github.com/yannh/kubeconform/releases/download/${KUBECONFORM_VERSION-$KUBECONFORM_DEFAULT_VERSION}/kubeconform-linux-${ARCH-amd64}.tar.gz | |
tar -xzf /tmp/kubeconform.tar.gz -C /usr/local/bin/ --exclude={LICENSE,README.md} | |
rm /tmp/kubeconform.tar.gz | |
chmod +x /usr/local/bin/kubeconform | |
fi | |
kubeconform -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if kubecontext should be configured | |
if [ "$CI_KUBERNETES_ACTIVE" = "true" ] || [ ! -z ${GL_K8S_AGENT_ID+x} ] || [ ! -z ${GL_K8S_PROXY_URL+x} ] ; then | |
if [ "$CI_SERVER_HOST" == "gitlab.com" ]; then | |
GL_K8S_AGENT_HOST_DEFAULT="kas.gitlab.com/k8s-proxy" | |
else | |
GL_K8S_AGENT_HOST_DEFAULT="$CI_SERVER_HOST/-/kubernetes-agent/k8s-proxy/" | |
fi | |
echo "Using ${GL_K8S_PROXY_URL:-https://$GL_K8S_AGENT_HOST_DEFAULT} as k8s proxy server" | |
kubectl config set-credentials agent:$GL_K8S_AGENT_ID --token="ci:${GL_K8S_AGENT_ID}:${CI_JOB_TOKEN}" | |
kubectl config set-cluster gitlab --server="${GL_K8S_PROXY_URL:-https://$GL_K8S_AGENT_HOST_DEFAULT}" | |
kubectl config set-context "$GL_K8S_CONTEXT" --cluster=gitlab --user="agent:${GL_K8S_AGENT_ID}" | |
kubectl config use-context "$GL_K8S_CONTEXT" | |
kubectl config set-context --current --namespace=default | |
export KUBE_CONFIG_PATH=$KUBECONFIG | |
mkdir -p ~/.kube | |
if [ ! -z "$KUBECONFIG" ] && [ -f "$KUBECONFIG" ]; then | |
cp $KUBECONFIG ~/.kube/config | |
fi | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if kubectl is installed | |
if ! command -v kubectl > /dev/null; then | |
echo "Installing kubectl" | |
echo "You can set the desired version via KUBECTL_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
KUBECTL_DEFAULT_VERSION=$(curl -sL https://dl.k8s.io/release/stable.txt) | |
KUBECTL_VERSION="${KUBECTL_VERSION-$KUBECTL_DEFAULT_VERSION}" | |
# Fix version not beginning with "v" | |
if ! echo "${KUBECTL_VERSION}" | grep -q "v"; then | |
KUBECTL_VERSION="v${KUBECTL_VERSION}" | |
fi | |
curl -sL --fail --output /usr/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH-amd64}/kubectl" | |
chmod +x /usr/bin/kubectl | |
fi | |
kubectl version --client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if kubeseal is installed | |
if ! command -v kubeseal > /dev/null; then | |
echo "Installing kubeseal" | |
echo "You can set the desired version via KUBESEAL_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
KUBESEAL_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/bitnami-labs/sealed-secrets/releases/latest | jq -r .tag_name | cut -c 2-) | |
curl -sL --fail --output kubeseal.tar.gz "https://github.com/bitnami-labs/sealed-secrets/releases/download/v${KUBESEAL_VERSION-$KUBESEAL_DEFAULT_VERSION}/kubeseal-${KUBESEAL_VERSION-$KUBESEAL_DEFAULT_VERSION}-linux-${ARCH-amd64}.tar.gz" | |
tar -xzf kubeseal.tar.gz -C /usr/bin kubeseal | |
rm kubeseal.tar.gz | |
chmod +x /usr/bin/kubeseal | |
fi | |
kubeseal --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if minikube is installed | |
if ! command -v minikube > /dev/null; then | |
echo "Installing minikube" | |
echo "You can set the desired version via MINIKUBE_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
MINIKUBE_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/kubernetes/minikube/releases/latest | jq -r .tag_name) | |
curl -sL --fail --output /usr/local/bin/minikube https://github.com/kubernetes/minikube/releases/download/${MINIKUBE_VERSION-$MINIKUBE_DEFAULT_VERSION}/minikube-linux-${ARCH-amd64} | |
chmod +x /usr/local/bin/minikube | |
fi | |
minikube version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if minio mc is installed | |
if ! command -v mc > /dev/null; then | |
echo "Installing minio mc" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
curl -sL https://dl.min.io/client/mc/release/linux-${ARCH-amd64}/mc -o /usr/local/bin/mc | |
chmod +x /usr/local/bin/mc | |
fi | |
mc --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if openssl is installed | |
if ! command -v openssl > /dev/null; then | |
echo "Installing openssl" | |
if command -v apt-get > /dev/null; then | |
apt-get update -qq > /dev/null | |
apt-get install -y -qq --no-install-recommends openssl > /dev/null | |
fi | |
if command -v apk > /dev/null; then | |
apk add --no-cache openssl > /dev/null | |
fi | |
fi | |
openssl version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if opentofu is installed | |
if ! command -v tofu > /dev/null; then | |
echo "Installing opentofu!" | |
echo "You can set the desired version via OPENTOFU_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
TERRAFORM_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/opentofu/opentofu/releases/latest | jq -r .name) | |
OPENTOFU_VERSION="${OPENTOFU_VERSION-$TERRAFORM_DEFAULT_VERSION}" | |
# Fix version beginning with "v" | |
if echo "${OPENTOFU_VERSION}" | grep -q "v"; then | |
OPENTOFU_VERSION="${OPENTOFU_VERSION:1}" | |
fi | |
curl -sL --fail --output /tmp/tofu.tar.gz "https://github.com/opentofu/opentofu/releases/download/v${OPENTOFU_VERSION}/tofu_${OPENTOFU_VERSION}_linux_${ARCH-amd64}.tar.gz" | |
tar -xzf /tmp/tofu.tar.gz -C /usr/local/bin/ --exclude={LICENSE,README.md,CHANGELOG.md} | |
rm /tmp/tofu.tar.gz | |
fi | |
tofu --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if packer is installed | |
if ! command -v packer > /dev/null; then | |
echo "Installing packer" | |
echo "You can set the desired version via PACKER_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
PACKER_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/hashicorp/packer/releases/latest | jq -r .tag_name) | |
PACKER_VERSION=${PACKER_VERSION-$PACKER_DEFAULT_VERSION} | |
# Fix version beginning with "v" | |
if echo "${PACKER_VERSION}" | grep -q "v"; then | |
PACKER_VERSION="${PACKER_VERSION:1}" | |
fi | |
curl -sL https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_${ARCH-amd64}.zip -o /tmp/packer.zip | |
unzip -q /tmp/packer.zip -d /usr/local/bin -x "LICENSE.txt" | |
fi | |
packer version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if skopeo is installed | |
if ! command -v skopeo > /dev/null; then | |
echo "Installing skopeo" | |
if command -v apt-get > /dev/null; then | |
apt-get update -qq > /dev/null | |
apt-get install -y -qq --no-install-recommends skopeo > /dev/null | |
fi | |
if command -v apk > /dev/null; then | |
apk add --no-cache skopeo > /dev/null | |
fi | |
fi | |
skopeo --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Setting up SSH | |
eval $(ssh-agent -s) > /dev/null | |
echo "$SSH_PRIVATE_KEY" | base64 --decode | tr -d '\r' | ssh-add - > /dev/null | |
mkdir -p ~/.ssh | |
chmod 700 ~/.ssh | |
echo "$SSH_HOST_KEY" >> ~/.ssh/known_hosts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if tailscale is installed | |
if ! command -v tailscale > /dev/null; then | |
echo "Installing tailscale" | |
echo "You can set the desired version via TAILSCALE_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
TAILSCALE_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/tailscale/tailscale/releases/latest | jq -r .tag_name) | |
TAILSCALE_VERSION=${TAILSCALE_VERSION-$TAILSCALE_DEFAULT_VERSION} | |
# Fix version beginning with "v" | |
if echo "${TAILSCALE_VERSION}" | grep -q "v"; then | |
TAILSCALE_VERSION="${TAILSCALE_VERSION:1}" | |
fi | |
FILE_PREFIX="tailscale_${TAILSCALE_VERSION}_${ARCH-amd64}" | |
curl -sL https://pkgs.tailscale.com/stable/${FILE_PREFIX}.tgz -o tailscale.tar.gz | |
tar -xzf tailscale.tar.gz --strip-components=1 -C /usr/local/bin/ $FILE_PREFIX/tailscale $FILE_PREFIX/tailscaled | |
rm tailscale.tar.gz | |
fi | |
mkdir -p /var/run/tailscale | |
tailscale --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if talosctl is installed | |
if ! command -v talosctl > /dev/null; then | |
echo "Installing talosctl" | |
echo "You can set the desired version via TALOSCTL_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
TALOSCTL_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/siderolabs/talos/releases/latest | jq -r .tag_name) | |
TALOSCTL_VERSION=${TALOSCTL_VERSION-$TALOSCTL_DEFAULT_VERSION} | |
curl -sL https://github.com/siderolabs/talos/releases/download/${TALOSCTL_VERSION}/talosctl-linux-${ARCH-amd64} -o /usr/local/bin/talosctl | |
chmod +x /usr/local/bin/talosctl | |
fi | |
talosctl version --client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if terraform is installed | |
if ! command -v terraform > /dev/null; then | |
echo "Installing terraform!" | |
echo "You can set the desired version via TERRAFORM_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
TERRAFORM_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/hashicorp/terraform/releases/latest | jq -r .name) | |
TERRAFORM_VERSION="${TERRAFORM_VERSION-$TERRAFORM_DEFAULT_VERSION}" | |
# Fix version beginning with "v" | |
if echo "${TERRAFORM_VERSION}" | grep -q "v"; then | |
TERRAFORM_VERSION="${TERRAFORM_VERSION:1}" | |
fi | |
curl -sL --fail --output /tmp/terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${ARCH-amd64}.zip" | |
unzip /tmp/terraform.zip -d /usr/bin/ > /dev/null | |
fi | |
terraform --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if tflint is installed | |
if ! command -v tflint > /dev/null; then | |
echo "Installing tflint" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
TFLINT_SYSTEM_TYPE="linux_${ARCH-amd64}.zip" | |
TFLINT_RELEASES="https://api.github.com/repos/terraform-linters/tflint/releases/latest" | |
TFLINT_URL=$(curl -sL $TFLINT_RELEASES | jq -r --arg term $TFLINT_SYSTEM_TYPE '.assets[] | select(.name | test($term)).browser_download_url') | |
curl -sL --fail --output /tmp/tflint.zip $TFLINT_URL | |
unzip /tmp/tflint.zip -d /usr/bin/ > /dev/null | |
fi | |
tflint --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if vault is installed | |
if ! command -v vault > /dev/null; then | |
echo "Installing vault" | |
echo "You can set the desired version via VAULT_VERSION_TAG. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
VAULT_DEFAULT_VERSION_TAG=$(curl -sL https://api.github.com/repos/hashicorp/vault/releases/latest | jq -r .name) | |
VAULT_VERSION=${VAULT_VERSION_TAG-$VAULT_DEFAULT_VERSION_TAG} | |
# Fix version beginning with "v" | |
if echo "${VAULT_VERSION}" | grep -q "v"; then | |
VAULT_VERSION="${VAULT_VERSION:1}" | |
fi | |
curl -sL --fail --output /tmp/vault.zip https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_${ARCH-amd64}.zip | |
unzip -q /tmp/vault.zip -d /usr/local/bin -x "LICENSE.txt" | |
rm /tmp/vault.zip | |
fi | |
vault --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if yq is installed | |
if ! command -v yq > /dev/null; then | |
echo "Installing yq (by Mike Farah)" | |
echo "You can set the desired version via YQ_VERSION. Default is latest" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
ARCH=amd64 | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
ARCH=arm64 | |
else | |
echo "Unknown system arch. Default to amd64" | |
fi | |
YQ_DEFAULT_VERSION=$(curl -sL https://api.github.com/repos/mikefarah/yq/releases/latest | jq -r .tag_name) | |
curl -sL --fail --output /usr/bin/yq \ | |
https://github.com/mikefarah/yq/releases/download/${YQ_VERSION-$YQ_DEFAULT_VERSION}/yq_linux_${ARCH-amd64} | |
chmod +x /usr/bin/yq | |
fi | |
yq --version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment