Skip to content

Commit 2d5c44d

Browse files
committed
refactor(build): Replace build tooling with simplified script-based approach
Replace the build toolchain with a cleaner, script-based approach using just as the task runner: - hack/build.sh: Unified multi-version build + publish script - hack/generate-image-manifests.sh: OpenStack Image CRD generator - hack/generate-resources.sh: ClusterStack + Cluster YAML generator - hack/show-matrix.sh: Version matrix display tool - hack/update-addons.sh: Generic addon updater with versions.yaml sync - hack/update-versions.sh: Auto-update K8s versions and tied addons from GitHub/Helm repos - hack/docugen.py: Rewritten to accept any stack directory as argument - justfile: Just task runner (replaces Taskfile.yml) - Containerfile: Alpine 3.21, pinned tool versions - flake.nix: Updated dev shell (just instead of task, dropped py3-requests) Assisted-by: Claude Code
1 parent 2b3373e commit 2d5c44d

17 files changed

Lines changed: 1981 additions & 837 deletions

Containerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM alpine:3.21
2+
3+
LABEL org.opencontainers.image.source="https://github.com/SovereignCloudStack/cluster-stacks"
4+
LABEL org.opencontainers.image.description="Cluster Stack Build Tools"
5+
LABEL org.opencontainers.image.licenses="Apache-2.0"
6+
7+
# Install system dependencies
8+
RUN apk add --no-cache \
9+
bash \
10+
git \
11+
curl \
12+
tar \
13+
gzip \
14+
gawk \
15+
python3 \
16+
py3-yaml \
17+
jq \
18+
ca-certificates
19+
20+
# Install helm
21+
RUN HELM_VERSION=v3.17.3 && \
22+
curl -fsSL "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" | \
23+
tar -xz -C /usr/local/bin --strip-components=1 linux-amd64/helm
24+
25+
# Install yq (mikefarah)
26+
RUN YQ_VERSION=v4.45.4 && \
27+
curl -fsSL "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" \
28+
-o /usr/local/bin/yq && chmod +x /usr/local/bin/yq
29+
30+
# Install oras
31+
RUN ORAS_VERSION=1.2.2 && \
32+
curl -fsSL "https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz" | \
33+
tar -xz -C /usr/local/bin oras
34+
35+
# Install just
36+
RUN JUST_VERSION=1.40.0 && \
37+
curl -fsSL "https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz" | \
38+
tar -xz -C /usr/local/bin just
39+
40+
WORKDIR /workspace
41+
42+
# Verify installations
43+
RUN bash --version | head -1 && \
44+
helm version --short && \
45+
yq --version && \
46+
oras version && \
47+
just --version && \
48+
git --version
49+
50+
# Allow git operations inside mounted volumes
51+
RUN git config --global --add safe.directory /workspace
52+
53+
CMD ["/bin/bash"]

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
description = "Cluster Stacks - Build tools for SCS Kubernetes cluster stacks";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
in
14+
{
15+
devShells.default = pkgs.mkShell {
16+
name = "cluster-stacks-dev";
17+
18+
buildInputs = with pkgs; [
19+
# Core tools
20+
bash
21+
git
22+
curl
23+
24+
# Container tools
25+
docker
26+
podman
27+
28+
# Kubernetes tools
29+
kubectl
30+
kubernetes-helm
31+
kind
32+
kustomize
33+
34+
# Build tools
35+
just
36+
python3
37+
python3Packages.pyyaml
38+
jq
39+
yq-go
40+
41+
# OCI/Registry tools
42+
oras
43+
];
44+
45+
shellHook = ''
46+
echo "Cluster Stacks development environment"
47+
echo ""
48+
echo "Available tools:"
49+
echo " just - Run 'just --list' to see available commands"
50+
echo " helm - Kubernetes package manager"
51+
echo " kubectl - Kubernetes CLI"
52+
echo " kind - Local Kubernetes clusters"
53+
echo " yq - YAML processor"
54+
echo " oras - OCI registry client"
55+
echo " python3 - With PyYAML"
56+
echo ""
57+
58+
# Generate shell completions into a cache directory
59+
comp_dir="''${XDG_CACHE_HOME:-$HOME/.cache}/cluster-stacks/completions"
60+
mkdir -p "$comp_dir"
61+
62+
user_shell=$(getent passwd "$(whoami)" 2>/dev/null | cut -d: -f7)
63+
shell_name=$(basename "''${user_shell:-bash}")
64+
65+
# Regenerate completions if the directory is empty or tools were updated
66+
if [ ! -f "$comp_dir/.$shell_name-generated" ]; then
67+
kubectl completion "$shell_name" > "$comp_dir/_kubectl" 2>/dev/null || true
68+
helm completion "$shell_name" > "$comp_dir/_helm" 2>/dev/null || true
69+
just --completions "$shell_name" > "$comp_dir/_just" 2>/dev/null || true
70+
kind completion "$shell_name" > "$comp_dir/_kind" 2>/dev/null || true
71+
oras completion "$shell_name" > "$comp_dir/_oras" 2>/dev/null || true
72+
touch "$comp_dir/.$shell_name-generated"
73+
fi
74+
75+
# Make completions available
76+
export FPATH="$comp_dir:$FPATH"
77+
78+
# Start user's preferred shell instead of bash.
79+
# nix develop always drops into bash; this detects the user's
80+
# real login shell from /etc/passwd and exec's into it.
81+
if [ -n "$user_shell" ] && [ "$shell_name" != "bash" ] && [ -x "$user_shell" ]; then
82+
exec "$user_shell"
83+
fi
84+
'';
85+
};
86+
}
87+
);
88+
}

0 commit comments

Comments
 (0)