feat: introduce container builder api#801
feat: introduce container builder api#801mervyn-mccreight merged 14 commits intotestcontainers:mainfrom
Conversation
✅ Deploy Preview for testcontainers-rust ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thank you for the contribution 🙏 That's really useful enhancement, I'll take a look soon I think #478 can be addressed by this change |
|
Also we could drop/rework our It's better to do as follow-up, but it would be a good exercise to check everything is working |
Yes, I think this would be a good idea, and I am willing to do this. But first I would like to hear whether the API as I have proposed for now is going in the direction you imagine. |
|
@mervyn-mccreight may I ask you to take a look at the design too, please? This PR is extremely useful and I don't want the job to be lost, we need to finalize it |
|
Would be happy if this and the follow up #804 could be finalized soon, as long as I still remember what I did here :-) Willing to help if anything is missing |
mervyn-mccreight
left a comment
There was a problem hiding this comment.
I think it's a good starting point, well done!
I left a few questions that I was wondering about and couldn't find an answer to by myself
|
Thanks for your detailed replies :) I resolved everything, because it's clear to me now. |
|
Thanks for your review. |
|
Few PRs have been merged (e.g bollard update), could you update the branch and solve conflicts? |
Only append to the archive to make the functions reusable in a context of multiple sources in a single archive. Signed-off-by: mbodmer <marc.bodmer@email.ch>
This type will allow for uploading of multiple files and directories in a single tar -> e.g: a docker build context Signed-off-by: mbodmer <marc.bodmer@email.ch>
Signed-off-by: mbodmer <marc.bodmer@email.ch>
Signed-off-by: mbodmer <marc.bodmer@email.ch>
Signed-off-by: mbodmer <marc.bodmer@email.ch>
Signed-off-by: mbodmer <marc.bodmer@email.ch>
Signed-off-by: mbodmer <marc.bodmer@email.ch>
Signed-off-by: mbodmer <marc.bodmer@email.ch>
To be usable in a library like testcontainer modules we need the core::copy structs to be accessible on the api. Signed-off-by: Marc Bodmer <marc.bodmer@securiton.ch>
Signed-off-by: mbodmer <marc.bodmer@email.ch>
lazy_sync_runner() is now also used by the sync_builder thus it cannot be private anymore. But we don't have to expose it as public API. Signed-off-by: mbodmer <marc.bodmer@email.ch>
Signed-off-by: Marc Bodmer <marc.bodmer@securiton.ch>
39683fd to
f3c5c9d
Compare
|
Ok, too bad. Merging was quite a pain and I hope I've not introduced some unintended side effects. Please lets rush with #804, I'd not be really happy having too many conflicts there again. |
Signed-off-by: mbodmer <marc.bodmer@email.ch>
Signed-off-by: Marc Bodmer <marc.bodmer@securiton.ch>
DDtKey
left a comment
There was a problem hiding this comment.
Thank you for your contribution! 🚀
I appreciate the effort and don’t see any reason to block this.
We can always revisit the design based on user experience.
As a follow-up, I would greatly appreciate comprehensive documentation coverage. Otherwise, people might not be aware of this feature that has been delivered.
|
Yes, I also think documentation would be needed. I will try to improve on it in a later effort, right now I am not in the mood for this :-). But I really see the importance. |
|
I'd say lets merge it and do the documentation in a later PR :) |
This PR is based on feat/build-image from PR: #801 --------- Signed-off-by: mbodmer <marc.bodmer@email.ch> Signed-off-by: Marc Bodmer <marc.bodmer@securiton.ch>
## 🤖 New release
* `testcontainers`: 0.24.0 -> 0.25.0 (⚠ API breaking changes)
### ⚠ `testcontainers` breaking changes
```text
--- failure enum_variant_added: enum variant added on exhaustive enum ---
Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/enum_variant_added.ron
Failed in:
variant ClientError:BuildImage in /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/client.rs:71
variant ClientError:BuildImage in /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/client.rs:71
variant LogSource:BothStd in /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/logs.rs:32
--- failure trait_method_added: pub trait method added ---
Description:
A non-sealed public trait added a new method without a default implementation, which breaks downstream implementations of the trait
ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-item-no-default
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/trait_method_added.ron
Failed in:
trait method testcontainers::core::ImageExt::with_ready_conditions in file /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:184
trait method testcontainers::core::ImageExt::with_health_check in file /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:206
trait method testcontainers::ImageExt::with_ready_conditions in file /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:184
trait method testcontainers::ImageExt::with_health_check in file /tmp/.tmp8ymZuo/testcontainers-rs/testcontainers/src/core/image/image_ext.rs:206
```
<details><summary><i><b>Changelog</b></i></summary><p>
<blockquote>
## [0.25.0] - 2025-07-27
### Details
#### Bug Fixes
- Make tls features optional
([#806](#806))
- Add `Send` trait to `stderr` & `stdout` of `ExecResult`
([#809](#809))
- Added new parse rule for correctly parsing ports without protocol
specifier
([#812](#812))
#### Features
- Allow ready conditions customization via ImageExt
([#794](#794))
- Allow to wait for log line on either stdout or stderr
([#795](#795))
- Add `Container*::exit_code`
([#791](#791))
- Add `Container*::is_running`
([#790](#790))
- Add custom health check support for containers
([#816](#816))
- Introduce container builder api
([#801](#801))
#### Miscellaneous Tasks
- [❗] Update bollard to 1.19.1
([#817](#817))
#### Refactor
- Testimages and tests to use builder API
([#804](#804))
</blockquote>
</p></details>
---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Here is a proposal for a builder API.
Please comment and help me improve it if there is interest for it.
resolves #478