Skip to content

feat(pull_policy): add pull_if_missing and make it the default#254

Merged
jarlah merged 1 commit into
mainfrom
fix/pull-if-missing
Apr 22, 2026
Merged

feat(pull_policy): add pull_if_missing and make it the default#254
jarlah merged 1 commit into
mainfrom
fix/pull-if-missing

Conversation

@jarlah
Copy link
Copy Markdown
Member

@jarlah jarlah commented Apr 22, 2026

Summary

Fixes #250.

  • Adds PullPolicy.pull_if_missing/0, which inspects the local Docker daemon and only pulls the image if it is not already present. This avoids Docker Hub rate limits when running containers whose images are already cached locally.
  • Makes pull_if_missing the default when no pull_policy is set on the container config and "pull.policy" is not overridden via properties. "always" and "never" remain opt-in, matching testcontainers-java semantics.
  • Fixes all mix credo --strict findings (numbers with underscores, @moduledoc, alphabetical aliases, struct-in-@SPECt(), nested/complex function extraction, withcase where only one <-, etc.) and wires mix credo --strict into .github/workflows/elixir.yml.
  • Fixes one dialyzer pattern_match_cov in the new Docker.Api.image_exists?/2.

Test plan

  • mix credo --strict — 0 issues
  • mix dialyzer — passes
  • mix test — 191 tests, 0 failures (including 2 new tests for pull_if_missing: one where the image is already tagged locally and pulling is skipped, one where the image is deleted and must be pulled)

Adds PullPolicy.pull_if_missing/0 which inspects the local Docker daemon
and only pulls the image if it is not already present, avoiding Docker Hub
rate limits.

Changes the default pull policy (when neither set on the container config
nor overridden via the "pull.policy" property) from always_pull to
pull_if_missing, matching testcontainers-java behavior.

Also addresses all credo --strict and dialyzer warnings across the
codebase and wires `mix credo --strict` into the Elixir CI workflow.
Copy link
Copy Markdown
Member Author

@jarlah jarlah left a comment

Choose a reason for hiding this comment

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

Lets goo 🚀

@jarlah jarlah merged commit 28dc4cf into main Apr 22, 2026
8 checks passed
@jarlah jarlah deleted the fix/pull-if-missing branch April 22, 2026 06:08
@gossi
Copy link
Copy Markdown
Contributor

gossi commented Apr 22, 2026

This is wonderful 🥳

I let it use for quite some time. Telling AI to use TDD for fixing the tests, running in the background. Maybe it fixes them (that is unchanged), but it doesn't stop anymore due to rate limits 🎉

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.

Hitting Rate Limits

2 participants