CHEF-37329: add Linux ARM Habitat validation in Expeditor pipeline - #347
CHEF-37329: add Linux ARM Habitat validation in Expeditor pipeline#347sanjain-progress wants to merge 3 commits into
Conversation
Add an Arm64 Habitat validation step to .expeditor/habitat-test.pipeline.yml using Buildkite queue default-privileged-aarch64, docker plugin (ruby:3.4), and BUILD_PKG_TARGET=aarch64-linux, keeping HAB_AUTH_TOKEN propagation consistent with the existing Linux/Windows steps. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sachin Jain <Sachin.jain@chef.io>
Simplecov Report
|
Introduce habitat/aarch64-linux/plan.sh, sourcing the existing habitat/plan.sh to reuse the default Linux build logic for aarch64 (ARM) targets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sachin Jain <Sachin.jain@chef.io>
habitat/aarch64-linux/plan.sh (added earlier in this branch) reuses
habitat/plan.sh via 'source', so the same do_install/do_unpack code runs
for both x86_64-linux and aarch64-linux builds. That code referenced
paths relative to $PLAN_CONTEXT (e.g.
"${PLAN_CONTEXT}/../binstub_patch.rb"), assuming PLAN_CONTEXT always
points at habitat/.
However, Habitat sets PLAN_CONTEXT to the directory it started the build
from, not the directory of the file that's actually executing. When
building aarch64-linux, that's habitat/aarch64-linux/, one level deeper
than habitat/plan.sh's own location -- even though the code being run is
sourced from habitat/plan.sh. So "${PLAN_CONTEXT}/.." resolved to
habitat/ instead of the repo root on aarch64-linux builds, and
binstub_patch.rb / NOTICE were silently not found at that (wrong) path.
The 'sed -i ... r binstub_patch.rb' patch command doesn't error when its
referenced file is missing/its pattern isn't found -- it just does nothing
and still exits 0. So an aarch64-linux chef-cli build would silently ship
a binstub without the patch that pre-sets APPBUNDLER_ALLOW_RVM=true. This
leaves appbundler's own guard (which nils GEM_HOME/GEM_PATH unless that
var is already 'true') unprotected on aarch64-linux specifically, causing
Gem::MissingSpecError when chef-cli is binlinked and invoked directly
(bypassing hab pkg exec, which normally sets that var via
RUNTIME_ENVIRONMENT). This is the same bug already fixed in chef/ohai,
chef/fauxhai, chef/cookstyle, chef/berkshelf, and chef/chef-vault.
Fix: resolve the repo root from this file's own location via
BASH_SOURCE[0] (which always points at habitat/plan.sh, regardless of
which plan sourced it) instead of PLAN_CONTEXT, and use that for all
repo-root-relative paths (binstub_patch.rb, NOTICE, VERSION source copy).
This makes the path resolution correct on both x86_64-linux and
aarch64-linux. The existing bin/chef-cli wrapper is left untouched --
once the sed patch reliably applies on aarch64-linux, it works the same
way it already does on x86_64-linux.
Also hardened while in this code path (no behavior change on x86_64):
- Quoted the pkg_prefix/bin/* glob in the binstub-patching loop.
- Used "${GEM_PATH:?}" guards on the rm -rf cleanup lines so they fail
safely instead of operating on an empty/unset path.
Verified: manually sourced habitat/plan.sh with PLAN_CONTEXT deliberately
set to a wrong/aarch64-linux-style path -- CHEF_CLI_REPO_ROOT still
resolves correctly and both binstub_patch.rb and NOTICE are found.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Sachin Jain <Sachin.jain@chef.io>
c6e3a11
Follow-up: fixed
|
There was a problem hiding this comment.
Pull request overview
This PR extends chef-cli’s Expeditor/Buildkite Habitat validation pipeline to also validate Habitat builds on Linux ARM64 (aarch64), complementing the existing Linux (x86_64) and Windows validation coverage.
Changes:
- Added a new Buildkite step to run Habitat build validation on an aarch64 Buildkite queue.
- Added a Linux aarch64 Habitat plan wrapper and adjusted the shared Linux plan to resolve the repo root reliably when sourced.
- Hardened cleanup in the Habitat plan by guarding
rm -rfwith${GEM_PATH:?}.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
habitat/plan.sh |
Resolve repo root via BASH_SOURCE (not PLAN_CONTEXT) and use it for copy/patch paths; tighten rm -rf safety. |
habitat/aarch64-linux/plan.sh |
New wrapper plan to reuse the default Linux Habitat plan for aarch64 builds. |
.expeditor/habitat-test.pipeline.yml |
Add a new Linux ARM64 Habitat validation step running on the aarch64 privileged Buildkite queue. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
Adds Linux ARM64 (aarch64) Habitat build validation to the chef-cli Expeditor/Buildkite pipeline.
What Changed
Result
Habitat package builds for chef-cli are now validated on Linux ARM64 via Buildkite/Expeditor, in addition to the existing Linux (x86_64) and Windows validation steps.
Jira
CHEF-37329