Skip to content

Commit 8168a82

Browse files
build: propagate ring/aws-lc-rs feature flags to bollard (#781)
In order for consumers to be able to switch between `ring` and `aws-lc-rs` cleanly without `testcontainers_rs` bringing in the wrong library, add feature flags that are propagated through to `bollard` to switch between the two ssl providers. --------- Co-authored-by: kaitlin-smith <kaitlin.smith@anaplan.com>
1 parent 9121760 commit 8168a82

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
with:
3333
tool: cargo-hack
3434
- name: Build
35-
run: cargo hack build --each-feature --keep-going
35+
run: cargo hack build --at-least-one-of ring,aws-lc-rs,ssl --feature-powerset --depth 2 --keep-going
3636

3737
test:
3838
name: Test
@@ -62,7 +62,7 @@ jobs:
6262
with:
6363
tool: cargo-hack
6464
- name: Tests
65-
run: cargo hack test --each-feature --clean-per-run
65+
run: cargo hack test --at-least-one-of ring,aws-lc-rs,ssl --feature-powerset --depth 2 --clean-per-run
6666

6767
fmt:
6868
name: Rustfmt check

docs/features/configuration.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,13 @@ Configuration is fetched in the following order:
3131
1. `DOCKER_AUTH_CONFIG` environment variable, unmarshalling the string value from its JSON representation and using it as the Docker config.
3232
2. `DOCKER_CONFIG` environment variable, as an alternative path to the directory containing Docker `config.json` file.
3333
3. else it will load the default Docker config file, which lives in the user's home, e.g. `~/.docker/config.json`.
34+
35+
## bollard, rustls and SSL Cryptography providers
36+
`testcontainers` uses [`bollard`](https://docs.rs/bollard/latest/bollard/) to interact with the Docker API.
37+
38+
`bollard` in turn has options provided by `rustls` to configure its SSL cryptography providers.
39+
40+
The `testcontainers` feature flags to control this are as follows:
41+
* `ring` - use `rustls` with `ring` as the cryptography provider (default)
42+
* `aws-lc-rs` - use `rustls` with `aws-lc-rs` as the cryptography provider
43+
* `ssl` - use `rustls` with a custom cryptography provider configuration - see [bollard](https://docs.rs/bollard/latest/bollard/#feature-flags) and [rustls](https://docs.rs/rustls/latest/rustls/#cryptography-providers) documentation for more.

testcontainers/Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1717

1818
[dependencies]
1919
async-trait = { version = "0.1" }
20-
bollard = { version = "0.18.1", features = ["ssl"] }
20+
bollard = { version = "0.18.1"}
2121
bollard-stubs = "=1.47.1-rc.27.3.1"
2222
bytes = "1.6.0"
2323
conquer-once = { version = "0.4", optional = true }
@@ -44,7 +44,10 @@ ulid = { version = "1.1.3", optional = true }
4444
url = { version = "2", features = ["serde"] }
4545

4646
[features]
47-
default = []
47+
default = ["ring"]
48+
ring = ["bollard/ssl"]
49+
aws-lc-rs = ["bollard/aws-lc-rs"]
50+
ssl = ["bollard/ssl_providerless"]
4851
blocking = []
4952
watchdog = ["signal-hook", "conquer-once"]
5053
http_wait = ["reqwest"]

0 commit comments

Comments
 (0)