Skip to content

ci: optional Docker Hub login to raise pull rate limits#160

Merged
vadimpiven merged 8 commits into
mainfrom
ci/dockerhub-login
May 24, 2026
Merged

ci: optional Docker Hub login to raise pull rate limits#160
vadimpiven merged 8 commits into
mainfrom
ci/dockerhub-login

Conversation

@vadimpiven
Copy link
Copy Markdown
Owner

Summary

  • Adds a Docker Hub docker/login-action step in .github/actions/setup-docker/action.yaml, right after the existing GHCR login.
  • The step is gated on dockerhub-username / dockerhub-token inputs being non-empty, so it cleanly skips on forks (where the ci environment isn't accessible and secrets are scrubbed).
  • Plumbs the two new optional inputs through .github/actions/setup/action.yaml.
  • In .github/workflows/regular.yaml's build-and-test job, binds environment: "ci" and passes vars.DOCKERHUB_USERNAME / secrets.DOCKERHUB_TOKEN into setup.

Why

Anonymous docker.io pulls are aggressively rate-limited on shared CI IPs. Authenticating raises the ceiling and reduces transient build failures when pulling base images.

Notes

  • The ci environment must have no required-reviewer protection rule, otherwise build-and-test will stall waiting for approval on every run.
  • Only regular.yaml is wired up here; release.yaml also calls setup but is left unchanged. If Docker Hub auth is wanted there too, the same two-line addition to its build-addon / build-packages jobs would extend coverage.

Test plan

  • On the upstream repo: confirm the step logs "Login Succeeded" against docker.io.
  • On a fork PR (no ci env access): confirm the step is skipped with no failure.

🤖 Generated with Claude Code

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented May 24, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  .github/actions/setup-docker/action.yaml  0% smaller
  .github/actions/setup/action.yaml  0% smaller
  .github/workflows/regular.yaml  0% smaller
  .github/workflows/release.yaml  0% smaller

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds optional Docker Hub authentication to the setup-docker and setup composite actions to help avoid rate limits. Reviewers noted that the workflow files needed to actually provide these credentials are missing from the PR, and suggested extending the implementation to the release workflow for consistency.

Comment thread .github/actions/setup/action.yaml
Comment thread .github/actions/setup/action.yaml
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 24, 2026

Greptile Summary

This PR adds optional Docker Hub authentication to CI to raise the anonymous pull rate limit for docker.io base images, gated on two new optional inputs so it safely no-ops on forks or repos without the ci environment configured.

  • Adds a docker/login-action step (pinned to SHA) in setup-docker/action.yaml, skipped when either credential is empty; threads dockerhub-username / dockerhub-token through setup/action.yaml.
  • Wires environment: \"ci\" and the two credential inputs into the build-and-test job in regular.yaml; release.yaml is intentionally left unchanged per the PR description.

Confidence Score: 4/5

Safe to merge once the ci environment's protection rules are confirmed to have no deployment-branch restrictions or wait timers.

The credential-passing chain is straightforward and the conditional guard correctly skips the login step when either input is absent. The one area to double-check is the ci environment configuration: the PR notes the required-reviewer rule, but deployment-branch restrictions or a wait timer would equally stall every PR run. Everything else — pinned action SHA, default docker.io registry, optional inputs — looks correct.

regular.yaml — the new environment: "ci" declaration deserves a quick review of the environment's protection settings before merging.

Important Files Changed

Filename Overview
.github/actions/setup-docker/action.yaml Adds optional Docker Hub login step with pinned SHA and correct conditional guard; no registry: key means it defaults to docker.io as intended.
.github/actions/setup/action.yaml Correctly threads two new optional inputs through to setup-docker with no logic of its own.
.github/workflows/regular.yaml Adds environment: "ci" and plumbs DOCKERHUB_USERNAME/DOCKERHUB_TOKEN into setup; the new environment declaration could stall or block runs if the environment has deployment-branch or wait-timer protection rules.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
.github/workflows/regular.yaml:45
**`environment: "ci"` may block runs on non-main branches or fork PRs**

The PR description calls out the required-reviewer protection rule, but GitHub environments also support two other protection types that could silently break CI: *deployment branch/tag rules* (if configured to allow only `main`, every PR branch would be blocked) and *wait timers* (all runs pause for the configured duration). Since `regular.yaml` is the primary PR-validation workflow and `build-and-test` now always requires the `ci` environment, any of those protection types would stall or block every PR run — including those from external forks where access to the environment is already restricted. Worth documenting or verifying that the `ci` environment has no branch/tag rules and no wait timer, not just no required reviewers.

Reviews (1): Last reviewed commit: "ci: gate environment: ci on upstream rep..." | Re-trigger Greptile

Comment thread .github/workflows/regular.yaml Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 24, 2026

Merging this PR will not alter performance

✅ 15 untouched benchmarks


Comparing ci/dockerhub-login (eafe7dc) with main (79e89e3)

Open in CodSpeed

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

vadimpiven and others added 7 commits May 24, 2026 10:52
Adds a docker/login-action step in setup-docker for Docker Hub,
gated on `dockerhub-username`/`dockerhub-token` inputs being
non-empty so it no-ops on forks (where the `ci` environment
isn't accessible and secrets are scrubbed).

Threads the credentials through the `setup` composite action and
wires them in `regular.yaml`'s build-and-test job from
`vars.DOCKERHUB_USERNAME` / `secrets.DOCKERHUB_TOKEN` via the
`ci` environment.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Switches the build-and-test job's environment binding to a
conditional expression — `ci` on the upstream repo, empty string
(no environment) elsewhere. Prevents forks from auto-materializing
a stray empty `ci` environment in their settings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors the regular.yaml wiring on release.yaml's build-addon
and build-packages jobs. Same fork-friendly environment guard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Forks auto-create the empty environment on first run and the
conditional step in setup-docker still skips; the repo-name guard
was cosmetic only and brittle to renames.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Makes the docker.io pull (currently mitmproxy) visible as its own
step so failures surface clearly instead of being buried in
compose up output. Uses --ignore-buildable so the locally built
dev image is skipped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vadimpiven vadimpiven merged commit 1c94669 into main May 24, 2026
22 checks passed
@vadimpiven vadimpiven deleted the ci/dockerhub-login branch May 24, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant