-
-
Notifications
You must be signed in to change notification settings - Fork 498
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 passing registry credentials to the reaper #647
Merged
mdelapenya
merged 15 commits into
testcontainers:main
from
mdelapenya:reaper-functional-opts
Jan 2, 2023
Merged
feat: support passing registry credentials to the reaper #647
mdelapenya
merged 15 commits into
testcontainers:main
from
mdelapenya:reaper-functional-opts
Jan 2, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We do not want to create reapers from outside the library
This will provide a better namespace for future work
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Co-authored-by: Matthew McNew <me@mattmcnew.com>
mdelapenya
commented
Jan 1, 2023
mdelapenya
added
enhancement
New feature or request
and removed
chore
Changes that do not impact the existing functionality
labels
Jan 2, 2023
mdelapenya
added a commit
to mdelapenya/testcontainers-go
that referenced
this pull request
Jan 4, 2023
* main: (44 commits) feat: support passing registry credentials to the reaper (testcontainers#647) fix: close response body in http strategy (testcontainers#718) chore: move e2e module to postgres example module (testcontainers#717) chore: bump containerd transitive dep in examples (testcontainers#715) chore(deps): bump github.com/containerd/containerd from 1.6.12 to 1.6.14 (testcontainers#703) chore(deps): bump github.com/compose-spec/compose-go in /modules/compose (testcontainers#710) chore: bump testcontainers-go to 0.17.0 in examples (testcontainers#714) chore(deps): bump github.com/docker/compose/v2 in /modules/compose (testcontainers#711) chore: support running MySQL compose in ARM (testcontainers#712) chore: simplify compose replace directives (testcontainers#713) chore: add compose module to dependabot (testcontainers#709) chore: move compose code to a separate module (testcontainers#650) docs: refine onboarding process with quickstart guide (testcontainers#706) chore: move redis-specific tests to the example module (testcontainers#701) chore: bump transitive dependencies (#527) chore: reduce concurrent builds (testcontainers#702) chore: add mysql example (testcontainers#700) chore(deps): bump google.golang.org/api from 0.104.0 to 0.105.0 (testcontainers#699) chore(deps): bump google.golang.org/api in /examples/firestore (testcontainers#683) chore(deps): bump cloud.google.com/go/spanner in /examples/spanner (testcontainers#688) ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR is addresses the need of passing a registry credentials string to the Reaper. For that we are refactoring the
NewReaper
constructor to make it more configurable and, at the same time, deprecating it to avoid incorrect usage when creating a Reaper instance.For the registry credentials string, we have create a functional option, as we consider it is the Go idiom for providing dynamic configuration. The functional option returns a function that receive a
containerOptions
, a private struct type with the dynamic fields to configure a reaper. In this PR we are adding the aforementionedRegistryCredentials
string and the configurableImageName
string ascontainerOptions
. The latter is used everywhere when creating a Reaper instance and we considered it made sense to include it in this PR, not in a follow-up.We have created a new private constructor for the reaper,
newReaper
, which accepts functional options in a variadic manner (as last parameter). Then, the old constructor has been deprecated internally to call the private one, passing the old reaperImageName argument as the corresponding functional option. We have updated the usage of the old reaper to the new, private one.To set the new functional reaper options, the types allowing setting a reaper (NetworkRequest and ContainerRequest) have been modified:
ContainerOption
has been added to the structs, making it possible to configure the reaper in a more dynamic (and advanced) manner.Why is it important?
We want to fix the credentials bug, but at the same time, limit the configuration of the reaper in a smooth manner, so consumer do not get affect by these transition to a more consistent reaper. You can probably identify this PR with #549 #561 and #633 because of the reaper creation. This PR could establish the basis for a more consistent reaper usage.
Related issues
ReaperImage
pull doesn't useRegistryCred
forContainerRequest
#645Follow-ups
We could revisit #561 once this PR is merged. Regarding #633, if this PR gets merged we'll probably need to resolve conflicts, but keep the patterns introduced here for functional options.