From 613ed69e3d63426d04cfddd112e837f6a5f7292f Mon Sep 17 00:00:00 2001 From: Christian Knell Date: Tue, 17 Dec 2024 11:17:18 +0000 Subject: [PATCH] updated pre-commit-config and devcontainer spec --- .devcontainer/devcontainer.json | 27 ++++++++++++++++++++++----- .devcontainer/postCreateCommand.sh | 15 +++++++++++++++ .pre-commit-config.yaml | 7 +++++++ 3 files changed, 44 insertions(+), 5 deletions(-) create mode 100755 .devcontainer/postCreateCommand.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bd49db08..9ddc8f91 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,24 +3,41 @@ "name": "helm-charts-development", - "image": "mcr.microsoft.com/devcontainers/base:bullseye", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04", + + "containerEnv": { + "HOME": "/home/vscode", + "SHELL": "/bin/bash" + }, // Features to add to the dev container. More info: https://containers.dev/features. "features": { - "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}, "ghcr.io/devcontainers/features/kubectl-helm-minikube:1": { "version": "latest", "helm": "latest", "minikube": "latest" }, + "ghcr.io/devcontainers-extra/features/pre-commit:2": {}, "ghcr.io/dirsigler/devcontainer-features/helm-docs:1": {}, - "ghcr.io/devcontainers-contrib/features/pre-commit:2": {}, "ghcr.io/mpriscella/features/helm-chart-testing:1": {} }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "uname -a", + "postCreateCommand": "/bin/bash .devcontainer/postCreateCommand.sh", + + "remoteUser": "vscode", - "remoteUser": "christianhuth" + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "ms-kubernetes-tools.vscode-kubernetes-tools", + "tim-koehler.helm-intellisense" + ] + } + } } diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100755 index 00000000..0166add9 --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# install pre-commit hooks +pre-commit install --install-hooks + +# set up autocompletion +TEMP_COMPLETION_FOLDER="${HOME}/bash_completion.d" +COMPLETION_FOLDER="/etc/bash_completion.d" +mkdir -p ${TEMP_COMPLETION_FOLDER} +BINARIES=("ct") +for binary in "${BINARIES[@]}" +do + $binary completion bash > ${TEMP_COMPLETION_FOLDER}/$binary + sudo mv ${TEMP_COMPLETION_FOLDER}/$binary ${COMPLETION_FOLDER}/$binary +done diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3aa56b38..dc61e46c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,3 +13,10 @@ repos: - id: check-yaml args: [--allow-multiple-documents] exclude: ^charts/.*/templates/ + - repo: https://github.com/norwoodj/helm-docs + rev: "" + hooks: + - id: helm-docs-container + entry: jnorwood/helm-docs:v1.14.2 + args: + - --chart-search-root=charts