-
-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support for replacing images with custom substitutions #1719
feat: support for replacing images with custom substitutions #1719
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
* main: docs: Fix typo and mention the relevant function name in doc (testcontainers#1745) DOCKER_HOST var typo (testcontainers#1743) feat: Add Cassandra module (testcontainers#1726) K6 module (testcontainers#1721) Rancher Desktop instructions (testcontainers#1724) chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.8 to 3.23.9 (testcontainers#1720) chore(deps): bump urllib3 from 2.0.5 to 2.0.6 (testcontainers#1718) chore(deps): bump github.com/twmb/franz-go/pkg/kadm in /modules/redpanda (testcontainers#1714) chore(deps): bump github.com/couchbase/gocb/v2 in /modules/couchbase (testcontainers#1704) chore(deps): bump github.com/neo4j/neo4j-go-driver/v5 in /modules/neo4j (testcontainers#1713)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! Thanks! I can't comment on if it works, but the API looks easy to use.
As discussed internally, and as a follow-up to this PR, we are going to provide a secondary way to substitute images at the properties level:
Please read more on this here: https://java.testcontainers.org/features/image_name_substitution/#automatically-modifying-docker-hub-image-names |
* main: chore(deps): combine and bump compose dependencies (testcontainers#1787) feat: support for replacing images with custom substitutions (testcontainers#1719)
* main: (27 commits) docs: remove OpenSSF scorecard (#1823) Auto-cleanup of k6 build cache (#1788) Add OpenSSF Scorecards GitHub Action (#1795) chore(deps): bump google.golang.org/grpc from 1.57.0 to 1.57.1 (#1822) chore: expose SessionID (#1793) chore: use HTTP calls to invoke the lambda from the tests (#1794) wait for log producer to really stop inside StopLogProducer func (#1701) chore(deps): bump github.com/nats-io/nats-server/v2 in /modules/nats (#1784) chore(deps): bump urllib3 from 2.0.6 to 2.0.7 (#1781) chore: add an example of using localstack alongside AWS lambdas (#1790) chore(deps): combine and bump compose dependencies (#1787) feat: support for replacing images with custom substitutions (#1719) fix: data race in docker client `Info()` (#1779) Use correct formatting directive for errors in lifecycle logs (#1780) chore(deps): bump golang.org/x/mod from 0.12.0 to 0.13.0 in /modules/{elasticsearch,kafka} and /modulegen (#1778) chore(deps): bump github.com/rabbitmq/amqp091-go in /modules/rabbitmq (#1728) chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (#1732) ignore patterns defined in dockerignore (#1725) Fix wrong module names (#1776) docs: add default options to k6 module (#1744) ...
…ers/image-spec-1.1.0-rc5 * main: (49 commits) docs: remove OpenSSF scorecard (#1823) Auto-cleanup of k6 build cache (#1788) Add OpenSSF Scorecards GitHub Action (#1795) chore(deps): bump google.golang.org/grpc from 1.57.0 to 1.57.1 (#1822) chore: expose SessionID (#1793) chore: use HTTP calls to invoke the lambda from the tests (#1794) wait for log producer to really stop inside StopLogProducer func (#1701) chore(deps): bump github.com/nats-io/nats-server/v2 in /modules/nats (#1784) chore(deps): bump urllib3 from 2.0.6 to 2.0.7 (#1781) chore: add an example of using localstack alongside AWS lambdas (#1790) chore(deps): combine and bump compose dependencies (#1787) feat: support for replacing images with custom substitutions (#1719) fix: data race in docker client `Info()` (#1779) Use correct formatting directive for errors in lifecycle logs (#1780) chore(deps): bump golang.org/x/mod from 0.12.0 to 0.13.0 in /modules/{elasticsearch,kafka} and /modulegen (#1778) chore(deps): bump github.com/rabbitmq/amqp091-go in /modules/rabbitmq (#1728) chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (#1732) ignore patterns defined in dockerignore (#1725) Fix wrong module names (#1776) docs: add default options to k6 module (#1744) ...
What does this PR do?
This PR adds a mechanism for modifying the Docker image used in the container request, and for that, an slice of ImageSubstitutors can be configured at the container request level.
At the moment we resolve the tag to pull/use the Docker image, it will run the defined substitutors in order to calculate the final image.
To facilitate users to provide their own substitutors, we have exposed an interface, so users of tc-go can implement their own substitutors. Examples could be:
The PR includes documentation for the substitutor interface, also adding them to each module's functional options.
Why is it important?
In more locked down / secured environments, it can be problematic to pull images from Docker Hub and run them without additional precautions.
An image name substitutor converts a Docker image name, as may be specified in code, to an alternative name. This is intended to provide a way to override image names, for example to enforce pulling of images from a private registry.
Related issues
Follow-ups
We can support setting custom substitutions in the testcontainers.properties file. Please see https://java.testcontainers.org/features/image_name_substitution/#automatically-modifying-docker-hub-image-names to check requirements. cc/ @eddumelendez