diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7eb0588..948bb69 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -86,6 +86,7 @@ snippets: - !reference [.snippets, talosctl-install] - !reference [.snippets, vault-install] - !reference [.snippets, helm-install] + - !reference [.snippets, helm-docs-install] - !reference [.snippets, packer-install] - !reference [.snippets, kind-install] - !reference [.snippets, minikube-install] diff --git a/.gitlab/ci/snippets.yml b/.gitlab/ci/snippets.yml index 40552c3..8b18619 100644 --- a/.gitlab/ci/snippets.yml +++ b/.gitlab/ci/snippets.yml @@ -240,6 +240,30 @@ tar -xzf /tmp/helm.tar.gz -C /usr/local/bin/ --strip-components=1 --exclude={LICENSE,README.md} fi helm version + helm-docs-install: + - | + # 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 -xzvf helm-docs.tar.gz -C /usr/local/bin --exclude={LICENSE,README.md,CHANGELOG.md} + rm helm-docs.tar.gz + fi + helm-docs --version kind-install: - | # Check if kind is installed diff --git a/README.md b/README.md index 6781428..2bd67fe 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Currently supported snippets are: * vault-install * argocd-cli-install * helm-install + * helm-docs-install * kubeseal-install * kubeconform-install * kind-install diff --git a/scripts/generated/alpine-core-tools.sh b/scripts/generated/alpine-core-tools.sh index 96bae0e..92ec090 100755 --- a/scripts/generated/alpine-core-tools.sh +++ b/scripts/generated/alpine-core-tools.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Installing core tools if command -v apk > /dev/null; then apk add --no-cache curl jq unzip tar gzip gcompat > /dev/null diff --git a/scripts/generated/argocd-cli-install.sh b/scripts/generated/argocd-cli-install.sh index db8f75d..65941ea 100755 --- a/scripts/generated/argocd-cli-install.sh +++ b/scripts/generated/argocd-cli-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if argo-cli is installed if ! command -v argo > /dev/null; then echo "Installing argo-cli" diff --git a/scripts/generated/aws-cli-install.sh b/scripts/generated/aws-cli-install.sh index 0eeb1ed..844d745 100755 --- a/scripts/generated/aws-cli-install.sh +++ b/scripts/generated/aws-cli-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if aws cli is installed if ! command -v aws > /dev/null; then echo "Installing aws-cli" diff --git a/scripts/generated/az-copy-install.sh b/scripts/generated/az-copy-install.sh index 39cc99a..ddb186d 100755 --- a/scripts/generated/az-copy-install.sh +++ b/scripts/generated/az-copy-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if azcopy is installed if ! command -v azcopy > /dev/null; then echo "Installing azcopy" diff --git a/scripts/generated/azure-cli-install.sh b/scripts/generated/azure-cli-install.sh index bc8d946..ef3ea24 100755 --- a/scripts/generated/azure-cli-install.sh +++ b/scripts/generated/azure-cli-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if az cli is installed if ! command -v az > /dev/null; then if command -v apt-get > /dev/null; then diff --git a/scripts/generated/cosign-install.sh b/scripts/generated/cosign-install.sh index a7a7372..cbdbf1e 100755 --- a/scripts/generated/cosign-install.sh +++ b/scripts/generated/cosign-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if cosign is installed if ! command -v cosign > /dev/null; then echo "Installing cosign!" diff --git a/scripts/generated/debian-core-tools.sh b/scripts/generated/debian-core-tools.sh index 3f877a3..775d300 100755 --- a/scripts/generated/debian-core-tools.sh +++ b/scripts/generated/debian-core-tools.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Installing core tools if command -v apt-get > /dev/null; then if [ ! -z ${HTTP_PROXY+x} ]; then diff --git a/scripts/generated/git-install.sh b/scripts/generated/git-install.sh index 586a003..5fcae09 100755 --- a/scripts/generated/git-install.sh +++ b/scripts/generated/git-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if git is installed if ! command -v git > /dev/null; then echo "Installing git" diff --git a/scripts/generated/helm-docs-install.sh b/scripts/generated/helm-docs-install.sh new file mode 100755 index 0000000..af29a60 --- /dev/null +++ b/scripts/generated/helm-docs-install.sh @@ -0,0 +1,24 @@ +#!/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 -xzvf helm-docs.tar.gz -C /usr/local/bin --exclude={LICENSE,README.md,CHANGELOG.md} + rm helm-docs.tar.gz +fi +helm-docs --version diff --git a/scripts/generated/helm-install.sh b/scripts/generated/helm-install.sh index b6f1f0c..aa82c94 100755 --- a/scripts/generated/helm-install.sh +++ b/scripts/generated/helm-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if helm is installed if ! command -v helm > /dev/null; then echo "Installing helm" diff --git a/scripts/generated/jq-install.sh b/scripts/generated/jq-install.sh index 5c830bb..382ed51 100755 --- a/scripts/generated/jq-install.sh +++ b/scripts/generated/jq-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if jq is installed if ! command -v jq > /dev/null; then echo "Installing jq" diff --git a/scripts/generated/kind-install.sh b/scripts/generated/kind-install.sh index fc18207..734a578 100755 --- a/scripts/generated/kind-install.sh +++ b/scripts/generated/kind-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if kind is installed if ! command -v kind > /dev/null; then echo "Installing kind" diff --git a/scripts/generated/kubeconform-install.sh b/scripts/generated/kubeconform-install.sh index a457bcb..013d1dd 100755 --- a/scripts/generated/kubeconform-install.sh +++ b/scripts/generated/kubeconform-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if kubeconform is installed if ! command -v kubeconform > /dev/null; then echo "Installing kubeconform" diff --git a/scripts/generated/kubectl-gitlab-agent.sh b/scripts/generated/kubectl-gitlab-agent.sh index 1748643..730267a 100755 --- a/scripts/generated/kubectl-gitlab-agent.sh +++ b/scripts/generated/kubectl-gitlab-agent.sh @@ -1,4 +1,5 @@ #!/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 diff --git a/scripts/generated/kubectl-install.sh b/scripts/generated/kubectl-install.sh index 322fc00..1efb2a1 100755 --- a/scripts/generated/kubectl-install.sh +++ b/scripts/generated/kubectl-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if kubectl is installed if ! command -v kubectl > /dev/null; then echo "Installing kubectl" diff --git a/scripts/generated/kubeseal-install.sh b/scripts/generated/kubeseal-install.sh index 90d40fd..5c53a23 100755 --- a/scripts/generated/kubeseal-install.sh +++ b/scripts/generated/kubeseal-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if kubeseal is installed if ! command -v kubeseal > /dev/null; then echo "Installing kubeseal" diff --git a/scripts/generated/minikube-install.sh b/scripts/generated/minikube-install.sh index d1a558f..ebb8cb6 100755 --- a/scripts/generated/minikube-install.sh +++ b/scripts/generated/minikube-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if minikube is installed if ! command -v minikube > /dev/null; then echo "Installing minikube" diff --git a/scripts/generated/minio-mc-install.sh b/scripts/generated/minio-mc-install.sh index b7fa3d8..d4da87f 100755 --- a/scripts/generated/minio-mc-install.sh +++ b/scripts/generated/minio-mc-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if minio mc is installed if ! command -v mc > /dev/null; then echo "Installing minio mc" diff --git a/scripts/generated/openssl-install.sh b/scripts/generated/openssl-install.sh index 6798156..dd59ad0 100755 --- a/scripts/generated/openssl-install.sh +++ b/scripts/generated/openssl-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if openssl is installed if ! command -v openssl > /dev/null; then echo "Installing openssl" diff --git a/scripts/generated/opentofu-install.sh b/scripts/generated/opentofu-install.sh index 9e06f9a..f8aad52 100755 --- a/scripts/generated/opentofu-install.sh +++ b/scripts/generated/opentofu-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if opentofu is installed if ! command -v tofu > /dev/null; then echo "Installing opentofu!" diff --git a/scripts/generated/packer-install.sh b/scripts/generated/packer-install.sh index 9028479..816024b 100755 --- a/scripts/generated/packer-install.sh +++ b/scripts/generated/packer-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if packer is installed if ! command -v packer > /dev/null; then echo "Installing packer" diff --git a/scripts/generated/skopeo-install.sh b/scripts/generated/skopeo-install.sh index 5176b11..3962211 100755 --- a/scripts/generated/skopeo-install.sh +++ b/scripts/generated/skopeo-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if skopeo is installed if ! command -v skopeo > /dev/null; then echo "Installing skopeo" diff --git a/scripts/generated/ssh-setup.sh b/scripts/generated/ssh-setup.sh index 2ae0e6d..0387a94 100755 --- a/scripts/generated/ssh-setup.sh +++ b/scripts/generated/ssh-setup.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Setting up SSH eval $(ssh-agent -s) > /dev/null echo "$SSH_PRIVATE_KEY" | base64 --decode | tr -d '\r' | ssh-add - > /dev/null diff --git a/scripts/generated/tailscale-install.sh b/scripts/generated/tailscale-install.sh index e29d2e4..dff7871 100755 --- a/scripts/generated/tailscale-install.sh +++ b/scripts/generated/tailscale-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if tailscale is installed if ! command -v tailscale > /dev/null; then echo "Installing tailscale" diff --git a/scripts/generated/talosctl-install.sh b/scripts/generated/talosctl-install.sh index 4bc4ce2..8f11228 100755 --- a/scripts/generated/talosctl-install.sh +++ b/scripts/generated/talosctl-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if talosctl is installed if ! command -v talosctl > /dev/null; then echo "Installing talosctl" diff --git a/scripts/generated/terraform-install.sh b/scripts/generated/terraform-install.sh index 287025b..673ba5e 100755 --- a/scripts/generated/terraform-install.sh +++ b/scripts/generated/terraform-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if terraform is installed if ! command -v terraform > /dev/null; then echo "Installing terraform!" diff --git a/scripts/generated/tflint-install.sh b/scripts/generated/tflint-install.sh index 01e365b..163e393 100755 --- a/scripts/generated/tflint-install.sh +++ b/scripts/generated/tflint-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if tflint is installed if ! command -v tflint > /dev/null; then echo "Installing tflint" diff --git a/scripts/generated/vault-install.sh b/scripts/generated/vault-install.sh index 5e5e985..cc2bf74 100755 --- a/scripts/generated/vault-install.sh +++ b/scripts/generated/vault-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if vault is installed if ! command -v vault > /dev/null; then echo "Installing vault" diff --git a/scripts/generated/yq-by-mike-farah-install.sh b/scripts/generated/yq-by-mike-farah-install.sh index 9c4fa80..e70da5d 100755 --- a/scripts/generated/yq-by-mike-farah-install.sh +++ b/scripts/generated/yq-by-mike-farah-install.sh @@ -1,4 +1,5 @@ #!/bin/bash + # Check if yq is installed if ! command -v yq > /dev/null; then echo "Installing yq (by Mike Farah)"