Repository navigation
Support explicit CI git checkout and bundle Docker CLI - #2812
Conversation
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
|
Warning Release Documentation RequiredThis PR is labeled
|
Resource Changes Found for
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR adds explicit CI-mode selection to ChangesCI-aware git clone
Containerized CI infrastructure
Test isolation and regression handling
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant CloneParser
participant RootBootstrap
participant CIProvider
participant Git
User->>CloneParser: Run atmos git clone with no positional arguments
CloneParser->>RootBootstrap: Resolve --ci or ATMOS_CI
RootBootstrap->>CIProvider: Detect CI context
CIProvider-->>RootBootstrap: Return Ref and short Branch
RootBootstrap->>Git: Clone current repository with --branch Branch
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (4)
Dockerfile (1)
22-22: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winConsider
docker-cliinstead ofdocker.io— only the CLI is needed here.The stated goal (per this PR's SKILL.md/docs changes) is Docker CLI support so Atmos container jobs can talk to the runner-provided Docker daemon/socket — not run a bundled daemon. Debian's
docker.iopackage ships the full daemon + client and its own description warns it "starts the daemon immediately and adds iptables rules for container networking," recommendingdocker-clifor just the client binary.docker-cliis available in Debian trixie (same source package) and avoids that daemon/iptables surface plus the extra dependency weight (containerd, runc, etc.) pulled in unnecessarily bydocker.io.♻️ Proposed fix
- apt-get -y install --no-install-recommends curl git ca-certificates docker.io python3; \ + apt-get -y install --no-install-recommends curl git ca-certificates docker-cli python3; \🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile` at line 22, Replace the docker.io dependency in the Dockerfile apt-get install command with docker-cli, keeping curl, git, ca-certificates, and python3 unchanged so the image provides only Docker client support without installing the daemon and its related dependencies.cmd/root.go (2)
1674-1692: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winBootstrap-time
--ciarg scan only recognizes two exact literal forms.
gitCloneBootstrapCIModematches only"--ci","--ci=true","--ci=false"literally, whileresolveCICloneModeincmd/git/clone.goparses the actual flag value withstrconv.ParseBool(accepting0/1/FALSE/False/etc.). A user passing--ci=0to opt out before repo config is loaded won't have that recognized here, and the pre-Cobra bootstrap gate could still initialize the CI-config bypass path inconsistently with the later, authoritative resolution inclone.go.♻️ Proposed fix — parse the value instead of literal-matching
for _, arg := range cloneArgs[2:] { - switch arg { - case "--ci": - return ciCloneBootstrapEnabled - case "--ci=true": - return ciCloneBootstrapEnabled - case "--ci=false": - return ciCloneBootstrapDisabled + if arg == "--ci" { + return ciCloneBootstrapEnabled + } + if value, ok := strings.CutPrefix(arg, "--ci="); ok { + if enabled, err := strconv.ParseBool(value); err == nil { + return ciCloneBootstrapModeFromBool(enabled) + } } }Since this touches how a CLI flag value is parsed at bootstrap time (before Cobra/pflag runs), please confirm the intended contract for accepted
--ci=value spellings matchesresolveCICloneMode'sstrconv.ParseBoolsemantics.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/root.go` around lines 1674 - 1692, Update gitCloneBootstrapCIMode to parse --ci= values using the same strconv.ParseBool semantics as resolveCICloneMode, accepting all equivalent boolean spellings such as 0, 1, FALSE, and False. Preserve the existing handling for bare --ci, return the corresponding enabled or disabled mode for successfully parsed values, and fall back to the environment-derived mode for invalid or absent values.
1674-1692: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMagic string
"--ci"duplicatesflagCIwith no compile-time link.
cmd/git/flags.godefinesflagCI = "ci"as the source of truth for this flag's name, butcmd/root.gore-hardcodes"--ci"/"--ci=true"/"--ci=false"as raw literals (andcmd/root_test.godoes the same). If the flag is ever renamed inflags.go, this bootstrap-time scan — and its tests — would silently stop detecting it, with no compiler or test failure surfacing the drift.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/root.go` around lines 1674 - 1692, Update gitCloneBootstrapCIMode to build its --ci argument comparisons from the cmd/git flagCI constant instead of hard-coded flag strings, covering bare, true, and false forms. Update the related cmd/root_test.go cases to use the same flagCI-derived values so production logic and tests remain linked to the flag’s source of truth.cmd/git/clone.go (1)
123-147: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winInconsistent error construction for invalid
--civalue.Line 128 raises a plain
fmt.Errorf(...)for the flag-parse failure, while the ATMOS_CI branch a few lines down correctly useserrUtils.Build(errUtils.ErrInvalidConfig)...Err()with hints and exit code. Since--ciis a bool flag, this ParseBool call can't actually fail in practice, but for consistency (and in case the flag type ever changes) it should follow the same static-error pattern as its sibling branch.As per coding guidelines, "Wrap all errors with static errors from
errors/errors.go; useerrors.Joinfor multiple errors,%wfor string context, the error builder for complex errors... Never use dynamic errors directly."♻️ Proposed fix
enabled, err := strconv.ParseBool(flag.Value.String()) if err != nil { - return ciCloneModeAuto, fmt.Errorf("invalid --%s value %q: %w", flagCI, flag.Value.String(), err) + return ciCloneModeAuto, errUtils.Build(errUtils.ErrInvalidConfig). + WithExplanation(fmt.Sprintf("--%s must be a boolean value, got %q.", flagCI, flag.Value.String())). + WithExitCode(2). + Err() }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/git/clone.go` around lines 123 - 147, Update the invalid --ci parsing branch in resolveCICloneMode to construct the error through errUtils.Build(errUtils.ErrInvalidConfig), matching the ATMOS_CI validation path. Preserve the flag value context, add the appropriate explanation and hint for --ci, and retain exit code 2 instead of returning the direct fmt.Errorf.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@cmd/git/clone.go`:
- Around line 123-147: Update the invalid --ci parsing branch in
resolveCICloneMode to construct the error through
errUtils.Build(errUtils.ErrInvalidConfig), matching the ATMOS_CI validation
path. Preserve the flag value context, add the appropriate explanation and hint
for --ci, and retain exit code 2 instead of returning the direct fmt.Errorf.
In `@cmd/root.go`:
- Around line 1674-1692: Update gitCloneBootstrapCIMode to parse --ci= values
using the same strconv.ParseBool semantics as resolveCICloneMode, accepting all
equivalent boolean spellings such as 0, 1, FALSE, and False. Preserve the
existing handling for bare --ci, return the corresponding enabled or disabled
mode for successfully parsed values, and fall back to the environment-derived
mode for invalid or absent values.
- Around line 1674-1692: Update gitCloneBootstrapCIMode to build its --ci
argument comparisons from the cmd/git flagCI constant instead of hard-coded flag
strings, covering bare, true, and false forms. Update the related
cmd/root_test.go cases to use the same flagCI-derived values so production logic
and tests remain linked to the flag’s source of truth.
In `@Dockerfile`:
- Line 22: Replace the docker.io dependency in the Dockerfile apt-get install
command with docker-cli, keeping curl, git, ca-certificates, and python3
unchanged so the image provides only Docker client support without installing
the daemon and its related dependencies.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8a94369e-fb12-4cad-b996-918a39683437
📒 Files selected for processing (10)
Dockerfileagent-skills/skills/atmos-modernization/SKILL.mdcmd/git/clone.gocmd/git/flags.gocmd/git/flags_test.gocmd/git/orchestration_test.gocmd/root.gocmd/root_test.gowebsite/docs/cli/commands/git/git-clone.mdxwebsite/docs/integrations/github-actions/setup-atmos.mdx
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
cmd/root_test.go (1)
250-254: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
cmd.NewTestKit(t)instead of a bespoke glob config snapshot.
NewTestKitalready snapshots and restores package root state for command tests, so this helper is a redundant, hand-rolled layer on top of the existing isolation path.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/root_test.go` around lines 250 - 254, Replace the bespoke atmosConfig snapshot in saveRestoreAtmosConfig with cmd.NewTestKit(t), relying on its built-in package root state isolation. Remove the manual original capture and cleanup while preserving test setup behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/root_test.go`:
- Around line 256-259: Make the Git clone bootstrap tests deterministic by
explicitly setting ATMOS_CI in the shared test helper or each affected test.
Ensure TestApplyCIGitCloneBootstrap_AllowsBootstrap pins ATMOS_CI to the value
that permits bootstrap, and apply the same explicit guard to the
NoCIProviderDetected case; use t.Setenv so the original environment is restored
automatically.
---
Nitpick comments:
In `@cmd/root_test.go`:
- Around line 250-254: Replace the bespoke atmosConfig snapshot in
saveRestoreAtmosConfig with cmd.NewTestKit(t), relying on its built-in package
root state isolation. Remove the manual original capture and cleanup while
preserving test setup behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9eecff93-27c4-4198-9101-b62bae356ee4
📒 Files selected for processing (4)
cmd/git/bootstrap.gocmd/git/bootstrap_test.gocmd/root.gocmd/root_test.go
Fix three CodeRabbit-flagged issues: - pkg/toolchain/install_test.go, list_test.go: several tests set Toolchain.InstallPath to a per-test t.TempDir() (needed to keep real installs off the shared XDG toolchain cache) but only partially restored atmosConfig afterward, leaving InstallPath pointed at a directory that TempDir cleanup had already deleted. Save/restore the full prior atmosConfig instead of reconstructing a partial one. - cmd/root_test.go: TestApplyCIGitCloneBootstrap_AllowsBootstrap and TestApplyCIGitCloneBootstrap_NoCIProviderDetected didn't pin ATMOS_CI, so an ambient ATMOS_CI=false in the developer/CI environment could make resolveCICloneMode resolve to "disabled" and fail the test non-deterministically. Pin ATMOS_CI explicitly, mirroring the existing guard in cmd/git/bootstrap_test.go. - .github/workflows/test.yml: the Docker Hub mirror configuration step used jq's `unique` to append mirror.gcr.io to registry-mirrors, which sorts the array and can silently reorder any pre-existing mirrors (Docker tries mirrors in listed order). Only append when absent, preserving existing order. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Add a real (non-stubbed) native-ci job cloning a local fixture repo to exercise the CI git-clone bootstrap path end-to-end, which immediately surfaced a pre-existing bug: runCICheckout passed the raw ref (e.g. refs/heads/main) as `git clone --branch`, which rejects full ref paths. Use the CI context's already-parsed branch name instead, and document the config-init tolerance mechanism in docs/prd/git-ops.md. Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cmd/git/clone.go (1)
123-129: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUse the canonical configuration error for invalid
--ci.Line 128 returns a raw
fmt.Errorf, unlike invalidATMOS_CIbelow. ReturnerrUtils.ErrInvalidConfigwith the same exit code and hint contract instead.As per coding guidelines, “Wrap all errors with static errors from errors/errors.go” and “Never use dynamic errors directly.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/git/clone.go` around lines 123 - 129, Update resolveCICloneMode’s invalid --ci parsing branch to return the canonical errUtils.ErrInvalidConfig error, preserving the same exit code and hint contract used for invalid ATMOS_CI values; do not return the dynamically formatted fmt.Errorf directly.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@cmd/git/clone.go`:
- Around line 123-129: Update resolveCICloneMode’s invalid --ci parsing branch
to return the canonical errUtils.ErrInvalidConfig error, preserving the same
exit code and hint contract used for invalid ATMOS_CI values; do not return the
dynamically formatted fmt.Errorf directly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 5dca25f3-6c1d-46fa-9262-f10dca6bce4e
📒 Files selected for processing (11)
.github/workflows/native-ci.yml.github/workflows/test.ymlcmd/git/clone.gocmd/git/provider_stub_test.gocmd/root_test.godocs/fixes/2026-07-30-git-clone-ci-checkout-branch-ref-bug.mddocs/fixes/2026-07-30-lychee-docs-docker-com-connection-reset.mddocs/prd/git-ops.mdlychee.tomlpkg/toolchain/install_test.gopkg/toolchain/list_test.go
The synthetic fixture-repo redirection (overriding GITHUB_SERVER_URL/ GITHUB_REPOSITORY at the step level) worked in a local shell but not in a real Actions run: GitHub Actions silently ignores GITHUB_-prefixed env overrides, so the job actually cloned the real cloudposse/atmos repo and failed a later assertion meant for the fixture. That's too curve-fitted to the local repro to be a real test of native CI in CI, and not fixable by adjusting the script further, so drop it rather than keep a job that looks like coverage but silently tests the wrong thing. The runCICheckout branch/ref fix itself is unaffected — it was found and verified via a local (non-CI) reproduction and is covered by the corrected unit test. Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/fixes/2026-07-30-git-clone-ci-checkout-branch-ref-bug.md`:
- Line 31: Update the prose in the git clone CI checkout documentation so “a CI
provider reports (e.g.” becomes “a CI provider reports, e.g.”, adding the
missing comma without changing the surrounding text.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 594517a5-afea-4004-b67e-ae6a82a8490a
📒 Files selected for processing (1)
docs/fixes/2026-07-30-git-clone-ci-checkout-branch-ref-bug.md
Co-Authored-By: Claude Sonnet 5 <[email protected]>
…it-clone # Conflicts: # docs/fixes/2026-07-29-telemetry-test-deleting-shared-toolchain-cache.md # pkg/toolchain/install_test.go # pkg/toolchain/list_test.go # tests/preconditions.go
TestPackerBuildCmdWithDirectoryTemplate failed on Windows CI (job 91001781247) with "Failed loading manifest ... EOF" -- text packer's own manifest post-processor produces, never Atmos. The packerRan heuristic didn't recognize this specific string, so it fell through to a real test failure even though packer clearly ran and failed for environmental (credential) reasons, same as the test already tolerates for other packer error shapes. Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
cmd/packer_build_test.go (1)
82-92: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCentralize the shared Packer-output predicate.
Both tests duplicate the same heuristic and Windows explanation. Extracting this into a helper would prevent future marker updates from diverging between the two test paths.
Also applies to: 225-235
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/packer_build_test.go` around lines 82 - 92, The Packer-output heuristic is duplicated across the tests and should be centralized. Extract the shared predicate, including the Windows-output explanation and all markers such as “amazon-ebs”, “Build”, “credential”, “Packer”, and “Failed loading manifest”, into a helper, then replace both test paths with calls to that helper so future marker changes remain synchronized.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/fixes/2026-07-30-packer-build-test-manifest-flake.md`:
- Around line 7-14: Revise the sentence describing the “Failed loading manifest”
error so it is grammatically complete and clearly attributes the error to
Packer’s text manifest post-processor rather than Atmos, while preserving the
existing context about the affected tests.
---
Nitpick comments:
In `@cmd/packer_build_test.go`:
- Around line 82-92: The Packer-output heuristic is duplicated across the tests
and should be centralized. Extract the shared predicate, including the
Windows-output explanation and all markers such as “amazon-ebs”, “Build”,
“credential”, “Packer”, and “Failed loading manifest”, into a helper, then
replace both test paths with calls to that helper so future marker changes
remain synchronized.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e0d2d894-0be9-4cd5-b547-75895cf6f8c3
📒 Files selected for processing (2)
cmd/packer_build_test.godocs/fixes/2026-07-30-packer-build-test-manifest-flake.md
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
These changes were released in v1.225.0-rc.4. |
what
--ciandATMOS_CIcontrols for no-argument CI checkout, including explicit opt-out behavior.cmd/root.gofor CI git-clone bootstrap detection with Cobra-identity + the existingcmd/gitflag-handler infrastructure (resolveCICloneMode), removing ~140 lines of bespoke parsing.atmos git clone's no-arg CI checkout to resolve the branch from the CI provider's parsed short name instead of the raw ref, which previously failed real branch/PR checkouts.why
actions/checkout(docs/prd/git-ops.md) never actually worked for a real branch or PR.references
Summary by CodeRabbit
New Features
--cisupport foratmos git clone, configurable withATMOS_CI.Bug Fixes
Documentation