mirror of
https://github.com/truecharts/charts.git
synced 2026-07-06 10:11:22 -03:00
fix(devcontainer): Make independent devcontainer & try to avoid version dependency (#36651)
**Description** <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. --> ⚒️ Fixes # <!--(issue)--> **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code - [ ] 📜 Documentation Changes **🧪 How Has This Been Tested?** <!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration --> **📃 Notes:** <!-- Please enter any other relevant information here --> **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made changes to the documentation - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning - [ ] I made sure the title starts with `feat(chart-name):`, `fix(chart-name):`, `chore(chart-name):`, `docs(chart-name):` or `fix(docs):` **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Alfred Göppel <43101280+alfi0812@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
|
||||
"name": "TrueCharts",
|
||||
"image": "tccr.io/tccr/devcontainer:v2.0.0@sha256:d8a12070a88e36cf1eb5b14fbeb1d5c866a1e5f8b52cc9e5989fb7f53c154b2b",
|
||||
"initializeCommand": "docker pull tccr.io/tccr/devcontainer:v2.0.0",
|
||||
"postCreateCommand": {
|
||||
"setup": "bash ${containerWorkspaceFolder}/.devcontainer/postCreateCommand.sh"
|
||||
},
|
||||
|
||||
@@ -12,9 +12,18 @@ fisher install nickeb96/puffer-fish
|
||||
fisher install PatrickF1/fzf.fish
|
||||
"
|
||||
|
||||
kubectl krew install pv-mounter
|
||||
(
|
||||
set -x; cd "$(mktemp -d)" &&
|
||||
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
|
||||
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
|
||||
KREW="krew-${OS}_${ARCH}" &&
|
||||
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
|
||||
tar zxvf "${KREW}.tar.gz" &&
|
||||
./"${KREW}" install krew
|
||||
)
|
||||
|
||||
# Create/update virtual environment
|
||||
if ! grep -q "venv /workspaces/" .venv/pyvenv.cfg; then
|
||||
rm -rf .venv
|
||||
fi
|
||||
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
||||
|
||||
kubectl krew install pv-mounter
|
||||
kubectl krew install cnpg
|
||||
kubectl krew install df-pv
|
||||
|
||||
3
.github/renovate/main.json5
vendored
3
.github/renovate/main.json5
vendored
@@ -36,7 +36,8 @@
|
||||
"github>truecharts/public//.github/renovate/special/customClusterManagers.json5",
|
||||
"github>truecharts/public//.github/renovate/special/customRules.json5",
|
||||
"github>truecharts/public//.github/renovate/special/customVersioning.json5",
|
||||
"github>truecharts/public//.github/renovate/special/customTalosClustertool.json5"
|
||||
"github>truecharts/public//.github/renovate/special/customTalosClustertool.json5",
|
||||
"github>truecharts/public//.github/renovate/special/devcontainer.json5"
|
||||
],
|
||||
// Main Renovate configuration that lists package rules for various paths
|
||||
"packageRules": [
|
||||
|
||||
18
.github/renovate/special/devcontainer.json5
vendored
Normal file
18
.github/renovate/special/devcontainer.json5
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"customManagers": [
|
||||
{
|
||||
"customType": "regex",
|
||||
"managerFilePatterns": [
|
||||
"/Dockerfile$/"
|
||||
],
|
||||
"matchStrings": [
|
||||
"ARG CLUSTERTOOL_VERSION=(?<currentValue>[0-9.]+)"
|
||||
],
|
||||
"datasourceTemplate": "github-releases",
|
||||
"packageNameTemplate": "truecharts/public",
|
||||
"versioningTemplate": "semver",
|
||||
"extractVersionTemplate": "^v(?<version>.*)$"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
|
||||
"name": "ClusterTool Cluster",
|
||||
"image": "tccr.io/tccr/devcontainer:v2.0.0@sha256:d8a12070a88e36cf1eb5b14fbeb1d5c866a1e5f8b52cc9e5989fb7f53c154b2b",
|
||||
"initializeCommand": "docker pull tccr.io/tccr/devcontainer:v2.0.0",
|
||||
"postCreateCommand": {
|
||||
"setup": "bash ${containerWorkspaceFolder}/.devcontainer/postCreateCommand.sh"
|
||||
},
|
||||
|
||||
@@ -12,9 +12,18 @@ fisher install nickeb96/puffer-fish
|
||||
fisher install PatrickF1/fzf.fish
|
||||
"
|
||||
|
||||
kubectl krew install pv-mounter
|
||||
(
|
||||
set -x; cd "$(mktemp -d)" &&
|
||||
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
|
||||
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
|
||||
KREW="krew-${OS}_${ARCH}" &&
|
||||
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
|
||||
tar zxvf "${KREW}.tar.gz" &&
|
||||
./"${KREW}" install krew
|
||||
)
|
||||
|
||||
# Create/update virtual environment
|
||||
if ! grep -q "venv /workspaces/" .venv/pyvenv.cfg; then
|
||||
rm -rf .venv
|
||||
fi
|
||||
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
||||
|
||||
kubectl krew install pv-mounter
|
||||
kubectl krew install cnpg
|
||||
kubectl krew install df-pv
|
||||
|
||||
@@ -1,44 +1,89 @@
|
||||
# hadolint ignore=DL3007
|
||||
FROM ghcr.io/onedr0p/cluster-template/devcontainer:latest@sha256:90bd47adcf1ac31e8d60e028e521db7a203a16186685546c298a5bb5e7ff642b
|
||||
FROM mcr.microsoft.com/devcontainers/base:alpine
|
||||
|
||||
ARG VERSION
|
||||
ARG CLUSTERTOOL_VERSION=2.0.0
|
||||
ARG CONTAINER_NAME
|
||||
ARG CONTAINER_VER
|
||||
|
||||
# hadolint ignore=DL3008,DL3015,SC2086,SC2155
|
||||
RUN \
|
||||
apk update && \
|
||||
apk --no-cache update && \
|
||||
RUN apk update && \
|
||||
apk --no-cache add \
|
||||
sshfs \
|
||||
libc6-compat \
|
||||
fuse && \
|
||||
age bash bind-tools ca-certificates curl direnv fish fzf \
|
||||
gettext git github-cli helm iputils jq k9s kubectl kustomize \
|
||||
python3 py3-pip moreutils openssh-client openssl starship yq \
|
||||
sshfs libc6-compat fuse && \
|
||||
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
|
||||
|
||||
# Install CLI tools via jpillora scripts
|
||||
RUN for app in \
|
||||
"budimanjojo/talhelper!!?as=talhelper&type=script" \
|
||||
"fluxcd/flux2!!?as=flux&type=script" \
|
||||
"helmfile/helmfile!!?as=helmfile&type=script" \
|
||||
"kubecolor/kubecolor!!?as=kubecolor&type=script" \
|
||||
"kubernetes-sigs/krew!!?as=krew&type=script" \
|
||||
"siderolabs/talos!!?as=talosctl&type=script"; \
|
||||
do \
|
||||
echo "=== Installing ${app} ==="; \
|
||||
curl -fsSL "https://i.jpillora.com/${app}" | bash; \
|
||||
done
|
||||
|
||||
# Create the completions and conf.d directories explicitly
|
||||
RUN mkdir -p /home/vscode/.config/fish/completions && \
|
||||
mkdir -p /home/vscode/.config/fish/conf.d
|
||||
|
||||
# Add completions only if the command exists
|
||||
RUN for tool in cilium flux helm helmfile k9s kubectl kustomize talhelper talosctl; do \
|
||||
if command -v "$tool" >/dev/null 2>&1; then \
|
||||
mkdir -p /home/vscode/.config/fish/completions && \
|
||||
$tool completion fish > "/home/vscode/.config/fish/completions/${tool}.fish" || true; \
|
||||
fi; \
|
||||
done && \
|
||||
gh completion --shell fish > /home/vscode/.config/fish/completions/gh.fish || true && \
|
||||
stern --completion fish > /home/vscode/.config/fish/completions/stern.fish || true && \
|
||||
yq shell-completion fish > /home/vscode/.config/fish/completions/yq.fish || true
|
||||
|
||||
RUN mkdir -p /home/vscode/.config/fish/conf.d && \
|
||||
printf '%s\n' \
|
||||
"if status is-interactive" \
|
||||
" direnv hook fish | source" \
|
||||
" starship init fish | source" \
|
||||
"end" \
|
||||
> /home/vscode/.config/fish/conf.d/hooks.fish
|
||||
|
||||
# Add aliases to fish config
|
||||
RUN mkdir -p /home/vscode/.config/fish/conf.d && \
|
||||
printf '%s\n' \
|
||||
"alias kubectl kubecolor" \
|
||||
"alias k kubectl" \
|
||||
> /home/vscode/.config/fish/conf.d/aliases.fish
|
||||
|
||||
# Custom fish prompt
|
||||
RUN mkdir -p /home/vscode/.config/fish/conf.d && \
|
||||
echo "set fish_greeting" > /home/vscode/.config/fish/conf.d/fish_greeting.fish
|
||||
|
||||
# Setup direnv whitelist
|
||||
RUN mkdir -p /home/vscode/.config/direnv && \
|
||||
tee /home/vscode/.config/direnv/direnv.toml > /dev/null <<EOF
|
||||
[whitelist]
|
||||
prefix = [ "/workspaces" ]
|
||||
EOF
|
||||
|
||||
# Fix permissions for devcontainer user
|
||||
RUN chown -R vscode:vscode /home/vscode/
|
||||
RUN chmod -R 755 /home/vscode/
|
||||
|
||||
# Download and set up the clustertool binary
|
||||
RUN curl -L "https://github.com/truecharts/public/releases/download/v${VERSION}/clustertool_${VERSION}_linux_amd64.tar.gz" -o /tmp/clustertool.tar.gz \
|
||||
RUN curl -L "https://github.com/truecharts/public/releases/download/v${CLUSTERTOOL_VERSION}/clustertool_${CLUSTERTOOL_VERSION}_linux_amd64.tar.gz" -o /tmp/clustertool.tar.gz \
|
||||
&& tar -xzvf /tmp/clustertool.tar.gz -C /usr/local/bin \
|
||||
&& chmod +x /usr/local/bin/clustertool \
|
||||
&& rm /tmp/clustertool.tar.gz
|
||||
|
||||
# Download and set up the krew binary
|
||||
RUN curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew-linux_amd64.tar.gz" \
|
||||
&& tar zxvf "krew-linux_amd64.tar.gz" \
|
||||
&& ./"krew-linux_amd64" install krew \
|
||||
&& rm ./krew-linux_amd64.tar.gz
|
||||
|
||||
ENV PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
||||
|
||||
# add pvmounter to kubectl using crew
|
||||
RUN kubectl krew install pv-mounter
|
||||
|
||||
# Maintainer and metadata
|
||||
LABEL "maintainer"="TrueCharts <info@truecharts.org>"
|
||||
LABEL "org.opencontainers.image.source"="https://github.com/truecharts/apps"
|
||||
LABEL org.opencontainers.image.licenses="All-Rights-Reserved"
|
||||
LABEL org.opencontainers.image.title="${CONTAINER_NAME}"
|
||||
LABEL org.opencontainers.image.url="https://truecharts.org/docs/charts/${CONTAINER_NAME}"
|
||||
LABEL org.opencontainers.image.version="${CONTAINER_VER}"
|
||||
LABEL org.opencontainers.image.version="${CLUSTERTOOL_VERSION}"
|
||||
LABEL org.opencontainers.image.description="Container for ${CONTAINER_NAME} by TrueCharts"
|
||||
LABEL org.opencontainers.image.authors="TrueCharts"
|
||||
LABEL org.opencontainers.image.documentation="https://truecharts.org/docs/charts/${CONTAINER_NAME}"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
2.0.0
|
||||
3
containers/apps/devcontainer/get-version.sh
Normal file
3
containers/apps/devcontainer/get-version.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
version=$(grep "ARG CLUSTERTOOL_VERSION=" ./containers/apps/devcontainer/Dockerfile | cut -d '=' -f2)
|
||||
printf "%s" "${version}"
|
||||
@@ -1 +0,0 @@
|
||||
curl -s "https://api.github.com/repos/truecharts/clustertool/releases/latest" | jq -r '.name' | sed 's/^clustertool-v//'
|
||||
Reference in New Issue
Block a user