fix: devops profile fails — kubectl, helm, terraform not in Debian repos#101
fix: devops profile fails — kubectl, helm, terraform not in Debian repos#101b00y0h wants to merge 1 commit into
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideDevOps profile now installs kubectl, helm, and terraform via upstream scripts/binaries instead of Debian packages, keeping only available tools in apt and removing invalid awscli, with get_profile_devops emitting the corresponding Dockerfile RUN commands. Sequence diagram for devops profile Docker build and upstream tool installationsequenceDiagram
actor Developer
participant DevopsProfile as Devops_profile_script
participant Docker as Docker_daemon
participant Apt as Debian_apt_repos
participant K8s as K8s_dl_server
participant Helm as Helm_GitHub_script
participant Terraform as Hashicorp_releases
Developer->>DevopsProfile: Request devops Dockerfile
DevopsProfile-->>Developer: Dockerfile with RUN commands
Developer->>Docker: docker build
Docker->>Apt: Install docker.io, docker-compose, ansible
Apt-->>Docker: Packages installed
Docker->>K8s: Download kubectl binary (arch-specific)
K8s-->>Docker: kubectl binary
Docker->>Helm: Fetch and run get-helm-3 script
Helm-->>Docker: Helm installed
Docker->>Terraform: Download terraform zip (arch-specific)
Terraform-->>Docker: terraform zip
Docker->>Docker: Unzip terraform to /usr/local/bin
Docker-->>Developer: Built devops image with all tools installed
Flow diagram for devops profile Dockerfile generation and tool installationflowchart TD
dev["Developer selects devops profile"] --> cfg["get_profile_devops in config_sh"]
cfg --> pkgs["Resolve apt packages: docker.io, docker-compose, ansible"]
cfg --> scripts["Emit RUN commands for kubectl, helm, terraform installation scripts"]
pkgs --> df["Generated Dockerfile"]
scripts --> df
df --> build["docker build"]
build --> apt["Debian apt repositories"]
build --> k8s["dl.k8s.io for kubectl binary"]
build --> helm["get-helm-3 script from GitHub"]
build --> tf["HashiCorp releases for terraform zip"]
apt --> img["DevOps image with docker.io, docker-compose, ansible"]
k8s --> img
helm --> img
tf --> img
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The Terraform download URL hardcodes version 1.9.8; consider extracting this into a variable or build arg so the version can be updated in one place without editing the heredoc body.
- For the curl | bash Helm install, it would be safer to add
-fsSLto curl and ensure the shell is configured withset -euo pipefail(or similar) so failures in the download or script cause the Docker build to fail. - You compute
ARCH=$(dpkg --print-architecture)in two separate RUN steps; consider factoring this into a single earlier RUN or using a build arg/env to avoid duplication and reduce the chance of divergent logic in future changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The Terraform download URL hardcodes version 1.9.8; consider extracting this into a variable or build arg so the version can be updated in one place without editing the heredoc body.
- For the curl | bash Helm install, it would be safer to add `-fsSL` to curl and ensure the shell is configured with `set -euo pipefail` (or similar) so failures in the download or script cause the Docker build to fail.
- You compute `ARCH=$(dpkg --print-architecture)` in two separate RUN steps; consider factoring this into a single earlier RUN or using a build arg/env to avoid duplication and reduce the chance of divergent logic in future changes.
## Individual Comments
### Comment 1
<location> `lib/config.sh:329-330` </location>
<code_context>
echo "RUN apt-get update && apt-get install -y $packages && apt-get clean"
fi
+ cat << 'EOF'
+RUN ARCH=$(dpkg --print-architecture) && \
+ curl -fsSL "https://dl.k8s.io/release/$(curl -fsSL https://dl.k8s.io/release/stable.txt)/bin/linux/${ARCH}/kubectl" -o /usr/local/bin/kubectl && \
+ chmod +x /usr/local/bin/kubectl
+RUN curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
</code_context>
<issue_to_address>
**issue:** Architecture string from dpkg may not match upstream kubectl/terraform archive naming
Using `dpkg --print-architecture` in the URL assumes upstream uses Debian’s arch names. This is fine for `amd64`/`arm64`, but will likely break on `ppc64el`, `armhf`, etc., where upstream expects different values. Please map `$ARCH` to the upstream’s expected strings, or fail fast with a clear error on unsupported architectures.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| RUN ARCH=$(dpkg --print-architecture) && \ | ||
| curl -fsSL "https://dl.k8s.io/release/$(curl -fsSL https://dl.k8s.io/release/stable.txt)/bin/linux/${ARCH}/kubectl" -o /usr/local/bin/kubectl && \ |
There was a problem hiding this comment.
issue: Architecture string from dpkg may not match upstream kubectl/terraform archive naming
Using dpkg --print-architecture in the URL assumes upstream uses Debian’s arch names. This is fine for amd64/arm64, but will likely break on ppc64el, armhf, etc., where upstream expects different values. Please map $ARCH to the upstream’s expected strings, or fail fast with a clear error on unsupported architectures.
0ce62e5 to
186d446
Compare
… profile kubectl, helm, and terraform are not available in the Debian bookworm apt repos, causing the devops profile to fail during docker build with "Unable to locate package" errors. Install these tools from their official sources instead: - kubectl: direct binary download from dl.k8s.io (arch-aware) - helm: official get-helm-3 install script - terraform: binary from releases.hashicorp.com (arch-aware) All three installs run in a single RUN layer so ARCH is computed once and any failure (including in the helm install script) aborts the build. Terraform version is configurable via CLAUDEBOX_TERRAFORM_VERSION env var (defaults to 1.9.8). Also remove awscli from the package list as it is not a valid Debian bookworm package name.
186d446 to
2ea4cf8
Compare
Summary
The devops profile fails during
docker buildbecausekubectl,helm, andterraformare not available in Debian bookworm's apt repositories.Fix
Install these tools from their official upstream sources (matching the pattern used by Rust, Go, Flutter, and Java profiles):
dl.k8s.iowith architecture detectionget-helm-3install script (handles arch automatically)releases.hashicorp.comwith architecture detectionKeep
docker.io,docker-compose, andansibleas apt packages since they are available in bookworm.Also removed
awscliwhich is not a valid Debian package name (the Debian package ispython3-awsor requires pip installation).Testing
Verified the profile generates valid Dockerfile RUN commands:
Tested on arm64 (Apple Silicon / OrbStack).
Summary by Sourcery
Update the devops profile to install kubectl, helm, and terraform from their official upstream sources instead of Debian packages, ensuring compatibility with Debian bookworm.
Bug Fixes:
Enhancements:
Build: