Skip to content

Commit 1d78c19

Browse files
committed
feat(setup): add various installation scripts for tools
- Implements installation scripts for essential tools including Docker tools, JSON/YAML tools, .NET SDK, GitHub CLI, DNS utilities, and Kubernetes tools. - Ensures easy setup and verification processes for newly added tools in the development environment.
1 parent 3e2d14c commit 1d78c19

File tree

9 files changed

+340
-1
lines changed

9 files changed

+340
-1
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"WebFetch(domain:github.com)",
1212
"Bash(mv:*)",
1313
"WebFetch(domain:learn.microsoft.com)",
14-
"Bash(find:*)"
14+
"Bash(find:*)",
15+
"Bash(chmod:*)"
1516
],
1617
"deny": []
1718
}

src/scripts/install-dnsutils.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Install dnsutils (includes dig, nslookup, etc.)
4+
5+
echo "Installing dnsutils..."
6+
7+
# Install dnsutils package
8+
apt-get update
9+
apt-get install -y --no-install-recommends dnsutils
10+
11+
# Verify installations
12+
echo "Verifying dnsutils installation..."
13+
if ! command -v dig &> /dev/null; then
14+
echo "ERROR: dig command not found after installation"
15+
exit 1
16+
fi
17+
echo "dig version:"
18+
dig -v 2>&1 | head -1
19+
20+
if ! command -v nslookup &> /dev/null; then
21+
echo "ERROR: nslookup command not found after installation"
22+
exit 1
23+
fi
24+
echo "nslookup available"
25+
26+
if ! command -v nsupdate &> /dev/null; then
27+
echo "ERROR: nsupdate command not found after installation"
28+
exit 1
29+
fi
30+
echo "nsupdate available"
31+
32+
echo "dnsutils installation completed successfully!"
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
3+
# Install Docker Compose plugin and Docker Buildx
4+
5+
echo "Installing Docker tools..."
6+
7+
# Install prerequisites
8+
apt-get update
9+
apt-get install -y --no-install-recommends \
10+
ca-certificates \
11+
curl
12+
13+
# Docker is already installed in the base image, we just need the plugins
14+
15+
# Install Docker Compose plugin
16+
echo "Installing Docker Compose plugin..."
17+
DOCKER_CONFIG=${DOCKER_CONFIG:-/usr/local/lib/docker}
18+
mkdir -p $DOCKER_CONFIG/cli-plugins
19+
20+
# Get latest compose version
21+
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
22+
if [ -z "$COMPOSE_VERSION" ]; then
23+
echo "Failed to get Docker Compose version, using fallback"
24+
COMPOSE_VERSION="2.32.4"
25+
fi
26+
27+
# Detect architecture
28+
ARCH=$(uname -m)
29+
case ${ARCH} in
30+
x86_64) ARCH_SUFFIX="x86_64" ;;
31+
aarch64) ARCH_SUFFIX="aarch64" ;;
32+
*) echo "Unsupported architecture: ${ARCH}"; exit 1 ;;
33+
esac
34+
35+
# Download Docker Compose
36+
curl -SL "https://github.com/docker/compose/releases/download/v${COMPOSE_VERSION}/docker-compose-linux-${ARCH_SUFFIX}" -o $DOCKER_CONFIG/cli-plugins/docker-compose
37+
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
38+
39+
# Install Docker Buildx
40+
echo "Installing Docker Buildx..."
41+
BUILDX_VERSION=$(curl -s https://api.github.com/repos/docker/buildx/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
42+
if [ -z "$BUILDX_VERSION" ]; then
43+
echo "Failed to get Docker Buildx version, using fallback"
44+
BUILDX_VERSION="0.19.3"
45+
fi
46+
47+
# Download Docker Buildx
48+
curl -SL "https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-${ARCH_SUFFIX}" -o $DOCKER_CONFIG/cli-plugins/docker-buildx
49+
chmod +x $DOCKER_CONFIG/cli-plugins/docker-buildx
50+
51+
# Create symlinks for backward compatibility
52+
ln -sf $DOCKER_CONFIG/cli-plugins/docker-compose /usr/local/bin/docker-compose
53+
54+
# Verify installations by checking files exist
55+
echo "Verifying Docker plugin installations..."
56+
if [ -f "$DOCKER_CONFIG/cli-plugins/docker-compose" ]; then
57+
echo "Docker Compose plugin installed successfully"
58+
ls -la $DOCKER_CONFIG/cli-plugins/docker-compose
59+
else
60+
echo "ERROR: Docker Compose plugin not found at $DOCKER_CONFIG/cli-plugins/docker-compose"
61+
exit 1
62+
fi
63+
64+
if [ -f "$DOCKER_CONFIG/cli-plugins/docker-buildx" ]; then
65+
echo "Docker Buildx plugin installed successfully"
66+
ls -la $DOCKER_CONFIG/cli-plugins/docker-buildx
67+
else
68+
echo "ERROR: Docker Buildx plugin not found at $DOCKER_CONFIG/cli-plugins/docker-buildx"
69+
exit 1
70+
fi
71+
72+
# Also check the symlink
73+
if [ -L "/usr/local/bin/docker-compose" ]; then
74+
echo "docker-compose symlink created successfully"
75+
else
76+
echo "WARNING: docker-compose symlink not created"
77+
fi
78+
79+
echo "Docker tools installation completed successfully!"

src/scripts/install-dotnet-sdk.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Install .NET SDK
4+
5+
echo "Installing .NET SDK..."
6+
7+
# Install prerequisites
8+
apt-get update
9+
apt-get install -y --no-install-recommends \
10+
ca-certificates \
11+
curl
12+
13+
# Detect architecture
14+
ARCH=$(uname -m)
15+
case ${ARCH} in
16+
x86_64) ARCH_SUFFIX="x64" ;;
17+
aarch64) ARCH_SUFFIX="arm64" ;;
18+
*) echo "Unsupported architecture: ${ARCH}"; exit 1 ;;
19+
esac
20+
21+
# Use Microsoft's official installation script
22+
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel LTS --install-dir /usr/share/dotnet
23+
24+
# Add dotnet to PATH and create symlinks
25+
ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
26+
27+
# Export DOTNET_ROOT
28+
export DOTNET_ROOT=/usr/share/dotnet
29+
echo "export DOTNET_ROOT=/usr/share/dotnet" >> /etc/environment
30+
31+
# Verify installation
32+
echo "Verifying .NET SDK installation..."
33+
if ! command -v dotnet &> /dev/null; then
34+
echo "ERROR: dotnet command not found after installation"
35+
exit 1
36+
fi
37+
echo ".NET SDK version:"
38+
dotnet --version
39+
echo ".NET SDKs installed:"
40+
dotnet --list-sdks
41+
echo ".NET Runtimes installed:"
42+
dotnet --list-runtimes
43+
44+
echo ".NET SDK installation completed successfully!"

src/scripts/install-github-cli.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Install GitHub CLI (gh)
4+
5+
echo "Installing GitHub CLI..."
6+
7+
# Install prerequisites
8+
apt-get update
9+
apt-get install -y --no-install-recommends \
10+
ca-certificates \
11+
curl \
12+
gnupg
13+
14+
# Add GitHub CLI repository
15+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
16+
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
17+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
18+
19+
# Update and install gh
20+
apt-get update
21+
apt-get install -y gh
22+
23+
# Verify installation
24+
echo "Verifying GitHub CLI installation..."
25+
if ! command -v gh &> /dev/null; then
26+
echo "ERROR: gh command not found after installation"
27+
exit 1
28+
fi
29+
echo "GitHub CLI version:"
30+
gh --version
31+
32+
echo "GitHub CLI installation completed successfully!"

src/scripts/install-json-tools.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# Install jq (yq is already installed in the Dockerfile)
4+
5+
echo "Installing JSON/YAML tools..."
6+
7+
# Install jq
8+
apt-get update
9+
apt-get install -y --no-install-recommends jq
10+
11+
# Verify jq installation
12+
echo "Verifying jq installation..."
13+
if ! command -v jq &> /dev/null; then
14+
echo "ERROR: jq command not found after installation"
15+
exit 1
16+
fi
17+
echo "jq version:"
18+
jq --version
19+
20+
# Verify yq is available (installed in Dockerfile)
21+
echo "Verifying yq installation..."
22+
if ! command -v yq &> /dev/null; then
23+
echo "ERROR: yq command not found"
24+
exit 1
25+
fi
26+
echo "yq version:"
27+
yq --version
28+
29+
echo "JSON/YAML tools installation completed successfully!"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
3+
# Install kubectl, helm, and kustomize
4+
5+
echo "Installing Kubernetes tools..."
6+
7+
# Install prerequisites
8+
apt-get update
9+
apt-get install -y --no-install-recommends \
10+
ca-certificates \
11+
curl
12+
13+
# Detect architecture
14+
ARCH=$(uname -m)
15+
case ${ARCH} in
16+
x86_64) ARCH_SUFFIX="amd64" ;;
17+
aarch64) ARCH_SUFFIX="arm64" ;;
18+
*) echo "Unsupported architecture: ${ARCH}"; exit 1 ;;
19+
esac
20+
21+
# Install kubectl
22+
echo "Installing kubectl..."
23+
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
24+
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH_SUFFIX}/kubectl"
25+
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
26+
rm kubectl
27+
28+
# Install helm
29+
echo "Installing helm..."
30+
HELM_VERSION=$(curl -s https://api.github.com/repos/helm/helm/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
31+
if [ -z "$HELM_VERSION" ]; then
32+
echo "Failed to get Helm version, using fallback"
33+
HELM_VERSION="3.16.4"
34+
fi
35+
curl -fsSL -o helm.tar.gz "https://get.helm.sh/helm-v${HELM_VERSION}-linux-${ARCH_SUFFIX}.tar.gz"
36+
tar -zxvf helm.tar.gz
37+
mv linux-${ARCH_SUFFIX}/helm /usr/local/bin/helm
38+
rm -rf helm.tar.gz linux-${ARCH_SUFFIX}
39+
40+
# Install kustomize
41+
echo "Installing kustomize..."
42+
KUSTOMIZE_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases | grep '"tag_name":' | grep kustomize | head -1 | sed -E 's/.*"kustomize\/v([^"]+)".*/\1/')
43+
if [ -z "$KUSTOMIZE_VERSION" ]; then
44+
echo "Failed to get Kustomize version, using fallback"
45+
KUSTOMIZE_VERSION="5.5.0"
46+
fi
47+
curl -L "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_${ARCH_SUFFIX}.tar.gz" | tar xz
48+
mv kustomize /usr/local/bin/kustomize
49+
50+
# Verify installations
51+
echo "Verifying kubectl installation..."
52+
if ! command -v kubectl &> /dev/null; then
53+
echo "ERROR: kubectl command not found after installation"
54+
exit 1
55+
fi
56+
echo "kubectl version:"
57+
kubectl version --client
58+
59+
echo "Verifying helm installation..."
60+
if ! command -v helm &> /dev/null; then
61+
echo "ERROR: helm command not found after installation"
62+
exit 1
63+
fi
64+
echo "helm version:"
65+
helm version --short
66+
67+
echo "Verifying kustomize installation..."
68+
if ! command -v kustomize &> /dev/null; then
69+
echo "ERROR: kustomize command not found after installation"
70+
exit 1
71+
fi
72+
echo "kustomize version:"
73+
kustomize version
74+
75+
echo "Kubernetes tools installation completed successfully!"

src/scripts/install-yamllint.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Install yamllint
4+
5+
echo "Installing yamllint..."
6+
7+
# yamllint is a Python package, so we'll use pip
8+
python3 -m pip install --no-cache-dir yamllint
9+
10+
# Verify installation
11+
echo "Verifying yamllint installation..."
12+
if ! command -v yamllint &> /dev/null; then
13+
echo "ERROR: yamllint command not found after installation"
14+
exit 1
15+
fi
16+
echo "yamllint version:"
17+
yamllint --version
18+
19+
echo "yamllint installation completed successfully!"

src/setup.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,34 @@ setup:
2727
script: "scripts/install-ansible.sh"
2828
description: "Installs Ansible using pip"
2929

30+
- name: "Install Docker tools"
31+
script: "scripts/install-docker-tools.sh"
32+
description: "Installs Docker Compose plugin and Docker Buildx"
33+
34+
- name: "Install JSON/YAML tools"
35+
script: "scripts/install-json-tools.sh"
36+
description: "Installs jq (yq is already installed)"
37+
38+
- name: "Install Kubernetes tools"
39+
script: "scripts/install-kubernetes-tools.sh"
40+
description: "Installs kubectl, helm, and kustomize"
41+
42+
- name: "Install yamllint"
43+
script: "scripts/install-yamllint.sh"
44+
description: "Installs yamllint for YAML validation"
45+
46+
- name: "Install GitHub CLI"
47+
script: "scripts/install-github-cli.sh"
48+
description: "Installs GitHub CLI (gh)"
49+
50+
- name: "Install .NET SDK"
51+
script: "scripts/install-dotnet-sdk.sh"
52+
description: "Installs .NET SDK (LTS version)"
53+
54+
- name: "Install dnsutils"
55+
script: "scripts/install-dnsutils.sh"
56+
description: "Installs DNS utilities (dig, nslookup, etc.)"
57+
3058
- name: "Clean up"
3159
command: "apt-get clean && rm -rf /var/lib/apt/lists/*"
3260
description: "Clean up package caches"

0 commit comments

Comments
 (0)