Skip to content

fix(ci): Docker build image mirrors and concurrent output race - #2884

Open
Erik Osterman (Cloud Posse) (osterman) wants to merge 3 commits into
mainfrom
osterman/fix-docker-build-jq-null-error
Open

fix(ci): Docker build image mirrors and concurrent output race#2884
Erik Osterman (Cloud Posse) (osterman) wants to merge 3 commits into
mainfrom
osterman/fix-docker-build-jq-null-error

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Aug 6, 2026

Copy link
Copy Markdown
Member

what

  • Bump cloudposse/github-action-docker-build-push from v3.0.0 to v3.1.0 in the release docker job (.github/workflows/build.yml).
  • Explicitly override the action's binfmt-image input to mirror.gcr.io/tonistiigi/binfmt:qemu-v7.0.0.
  • Hold the shared output lock for an entire flush (not per line) in LinePrefixWriter (pkg/io/line_prefix_writer.go), so concurrent Terraform node writers can't interleave a line mid-block.

why

  • The release Docker build job was failing due to rate limiting when pulling its buildx builder (moby/buildkit) and QEMU binfmt images from public.ecr.aws.
  • v3.1.0 of the action switches the buildx builder's default image to the Google mirror (mirror.gcr.io/moby/buildkit), fixing that pull. The action's binfmt-image input still defaults to public.ecr.aws/eks-distro-build-tooling/binfmt-misc even at v3.1.0 (no upstream fix yet), so it's overridden here directly to the equivalent Google-mirrored tonistiigi/binfmt image, which publishes the same qemu-v7.0.0 tag. Verified live: both mirror.gcr.io/tonistiigi/binfmt:qemu-v7.0.0 and docker.io/tonistiigi/binfmt:qemu-v7.0.0 resolve to the same digest and pull successfully; mirror.gcr.io also falls through to Docker Hub origin on any cache miss, so it's never less reliable than a direct Docker Hub pull.
  • Separately, the macOS Acceptance Tests job was failing TestExecuteTerraformConcurrentHooksUseNodeWriters (pkg/scheduler/adapters) with a real, reproducible race: LinePrefixWriter.writeLine acquired/released the shared output mutex per line, so a single Write() call that produced multiple lines (e.g. a hook's buffered \r-then-\n progress update) could have a different node's writer interleave a line in between, corrupting concurrent Terraform output. Reproduced with go test -race -count=200 before the fix (intermittent failures) and confirmed 200/200 clean after.
  • Both fixes address CI reliability issues discovered while investigating unrelated failures on this branch; neither changes the shipped Atmos CLI's behavior for end users.

references

  • Upstream fix: cloudposse/github-action-docker-build-push v3.1.0
  • CI failure: Acceptance Tests (macos), job 92489708710

… ECR

The release Docker build job was rate-limited pulling its buildx builder
and QEMU binfmt images from public.ecr.aws. Bumps
cloudposse/github-action-docker-build-push to v3.1.0, which switches the
buildkit image default to mirror.gcr.io, and overrides binfmt-image to
the equivalent Google-mirrored tonistiigi/binfmt image.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@atmos-pro

atmos-pro Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@osterman Erik Osterman (Cloud Posse) (osterman) added the no-release Do not create a new release (wait for additional code changes) label Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@osterman, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ccb57624-ba15-44a5-a422-a1fe66dbed83

📥 Commits

Reviewing files that changed from the base of the PR and between 3339e02 and 119ba54.

📒 Files selected for processing (2)
  • docs/fixes/2026-08-06-docker-build-buildkit-binfmt-google-mirror.md
  • docs/fixes/2026-08-06-line-prefix-writer-concurrent-flush-race.md
📝 Walkthrough

Walkthrough

The PR updates the Docker build workflow and changes line-prefix writer locking so each write or flush operation emits output without interleaving.

Changes

Docker build configuration

Layer / File(s) Summary
Docker build action update
.github/workflows/build.yml
The workflow uses cloudposse/github-action-docker-build-push v3.1.0 and sets the QEMU binfmt image.

Line-prefix writer synchronization

Layer / File(s) Summary
Complete output locking
pkg/io/line_prefix_writer.go
Write and Flush hold writeMu across their complete flush operations. writeLine now requires callers to hold the mutex, and the helper documentation states the locking contract.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: patch

Suggested reviewers: aknysh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes both the Docker CI updates and the concurrent output race fix.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch osterman/fix-docker-build-jq-null-error

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size/xs Extra small size PR label Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

.github/workflows/build.yml

PackageVersionLicenseIssue Type
cloudposse/github-action-docker-build-push02993d675b44dcc7082e6de7485c1ff8740bce9dNullUnknown License
Allowed Licenses: MIT, MIT-0, Apache-2.0, BSD-2-Clause, BSD-2-Clause-Views, BSD-3-Clause, ISC, MPL-2.0, 0BSD, Unlicense, CC0-1.0, CC-BY-3.0, CC-BY-4.0, CC-BY-SA-3.0, Python-2.0, OFL-1.1, LicenseRef-scancode-generic-cla, LicenseRef-scancode-unknown-license-reference, LicenseRef-scancode-unicode, LicenseRef-scancode-google-patent-license-golang
Excluded from license check: pkg:golang/github.com/antlr4-go/antlr/v4, pkg:golang/github.com/google/cel-go, pkg:golang/golang.org/x/image, pkg:golang/modernc.org/libc, pkg:golang/github.com/opencontainers/go-digest, pkg:npm/pako, pkg:npm/sax

Scanned Files

  • .github/workflows/build.yml

@mergify

mergify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Cloud Posse Engineering Team Review Required

This 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 #pr-reviews channel.

@mergify mergify Bot added the needs-cloudposse Needs Cloud Posse assistance label Aug 6, 2026
writeLine acquired/released the shared writeMu once per line, so a
single Write() call that produced multiple lines (e.g. a hook's
buffered "\r"-then-"\n" progress update) could have another node's
writer interleave a line in between, corrupting concurrent Terraform
node output. Hold writeMu for the entire flush instead.

Reproduced with `go test -race -count=200` on
TestExecuteTerraformConcurrentHooksUseNodeWriters, which was flaking
in CI (Acceptance Tests macos, job 92489708710); now passes 200/200.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions github-actions Bot added size/s Small size PR and removed size/xs Extra small size PR labels Aug 6, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/io/line_prefix_writer.go (1)

68-74: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add a regression test for multi-line write atomicity.

The adjacent test at pkg/io/line_prefix_writer_test.go:54-92 writes one line per Write. It cannot detect interleaving between multiple lines emitted by one call. Add a deterministic test where concurrent calls write multiple complete lines and verify that each call's lines remain contiguous.

Based on the adjacent test at pkg/io/line_prefix_writer_test.go:54-92, current coverage does not exercise this lock-scope guarantee.

🤖 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 `@pkg/io/line_prefix_writer.go` around lines 68 - 74, Add a deterministic
regression test alongside the existing line-prefix writer concurrency test,
exercising concurrent Write calls where each call emits multiple complete lines.
Synchronize the writers so both calls overlap, then assert the shared output
contains each call’s lines as one contiguous block without interleaving; target
the writeMu-protected Write behavior in the line-prefix writer.
🤖 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 @.github/workflows/build.yml:
- Line 61: Update the binfmt-image configuration in the release build workflow
to avoid depending solely on mirror.gcr.io availability: either add an explicit
runner cache for tonistiigi/binfmt:qemu-v7.0.0 or point binfmt-image to a
registry you control, while preserving the required image tag.

---

Nitpick comments:
In `@pkg/io/line_prefix_writer.go`:
- Around line 68-74: Add a deterministic regression test alongside the existing
line-prefix writer concurrency test, exercising concurrent Write calls where
each call emits multiple complete lines. Synchronize the writers so both calls
overlap, then assert the shared output contains each call’s lines as one
contiguous block without interleaving; target the writeMu-protected Write
behavior in the line-prefix writer.
🪄 Autofix

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: b41a4161-717b-417e-b970-05bdb4b46f8f

📥 Commits

Reviewing files that changed from the base of the PR and between d2b8e81 and 3339e02.

📒 Files selected for processing (2)
  • .github/workflows/build.yml
  • pkg/io/line_prefix_writer.go

Comment thread .github/workflows/build.yml
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 6, 2026
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.77%. Comparing base (d2b8e81) to head (3339e02).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2884      +/-   ##
==========================================
+ Coverage   82.76%   82.77%   +0.01%     
==========================================
  Files        1861     1861              
  Lines      180438   180480      +42     
==========================================
+ Hits       149342   149397      +55     
+ Misses      23309    23296      -13     
  Partials     7787     7787              
Flag Coverage Δ
unittests 82.77% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/io/line_prefix_writer.go 97.01% <100.00%> (+0.09%) ⬆️

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@osterman Erik Osterman (Cloud Posse) (osterman) changed the title fix(ci): pull docker buildx/binfmt images from Google mirror fix(ci): Docker build image mirrors and concurrent output race Aug 6, 2026
@osterman Erik Osterman (Cloud Posse) (osterman) added patch A minor, backward compatible change and removed no-release Do not create a new release (wait for additional code changes) labels Aug 6, 2026
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-cloudposse Needs Cloud Posse assistance patch A minor, backward compatible change size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant