Skip to content

Conversation

@hawkw
Copy link
Contributor

@hawkw hawkw commented Nov 5, 2021

Currently, the linkerd-meshtls crate uses a build script to ensure
that at least one TLS implementation feature flag is enabled when
compiling the crate. This can be done much more simply using the
compile_error! macro.

Removing the build script may make compilation (very slightly) faster,
because the build script no longer needs to be compiled. Also, the error
message is a bit nicer, since it just prints the error, rather than
"failed to run custom build command".

Here's the compiler output before this change:

:; cargo build -p linkerd-meshtls --no-default-features
   Compiling linkerd-meshtls v0.1.0 (/home/eliza/Code/linkerd2-proxy/linkerd/meshtls)
   Compiling linkerd-tls v0.1.0 (/home/eliza/Code/linkerd2-proxy/linkerd/tls)
error: failed to run custom build command for `linkerd-meshtls v0.1.0 (/home/eliza/Code/linkerd2-proxy/linkerd/meshtls)`

Caused by:
  process didn't exit successfully: `/home/eliza/Code/linkerd2-proxy/target/debug/build/linkerd-meshtls-d2a634fb5bc47eea/build-script-build` (exit status: 1)
  --- stderr
  Error: "at least one of the following TLS implementations must be enabled: 'rustls'"

...and after:

:; cargo build -p linkerd-meshtls --no-default-features
   Compiling linkerd-meshtls v0.1.0 (/home/eliza/Code/linkerd2-proxy/linkerd/meshtls)
error: at least one of the following TLS implementations must be enabled: 'rustls'
 --> linkerd/meshtls/src/lib.rs:6:1
  |
6 | compile_error!("at least one of the following TLS implementations must be enabled: 'rustls'");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Currently, the `linkerd-meshtls` crate uses a build script to ensure
that at least one TLS implementation feature flag is enabled when
compiling the crate. This can be done much more simply using the
`compile_error!` macro.

Removing the build script may make compilation (very slightly) faster,
because the build script no longer needs to be compiled. Also, the error
message is a bit nicer, since it just prints the error, rather than
"failed to run custom build command".

Here's the compiler output before this change:

```
:; cargo build -p linkerd-meshtls --no-default-features
   Compiling linkerd-meshtls v0.1.0 (/home/eliza/Code/linkerd2-proxy/linkerd/meshtls)
   Compiling linkerd-tls v0.1.0 (/home/eliza/Code/linkerd2-proxy/linkerd/tls)
error: failed to run custom build command for `linkerd-meshtls v0.1.0 (/home/eliza/Code/linkerd2-proxy/linkerd/meshtls)`

Caused by:
  process didn't exit successfully: `/home/eliza/Code/linkerd2-proxy/target/debug/build/linkerd-meshtls-d2a634fb5bc47eea/build-script-build` (exit status: 1)
  --- stderr
  Error: "at least one of the following TLS implementations must be enabled: 'rustls'"
```

...and after:

```
:; cargo build -p linkerd-meshtls --no-default-features
   Compiling linkerd-meshtls v0.1.0 (/home/eliza/Code/linkerd2-proxy/linkerd/meshtls)
error: at least one of the following TLS implementations must be enabled: 'rustls'
 --> linkerd/meshtls/src/lib.rs:6:1
  |
6 | compile_error!("at least one of the following TLS implementations must be enabled: 'rustls'");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```
@hawkw hawkw requested review from a team and olix0r November 5, 2021 16:15
hawkw added 2 commits November 5, 2021 09:30
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
@olix0r olix0r merged commit b452971 into main Nov 5, 2021
@olix0r olix0r deleted the eliza/no-buildscript branch November 5, 2021 17:00
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Nov 9, 2021
This release updates the proxy's `rustls`, `ring`, and `webpki` dependencies.

Additionally, the proxy can now be built to use a `boringssl` backend
instead of the default `rustls` backend, but this functionality is
disabled in default builds.

---

* meshtls: replace build script with `compile_error!` macro (linkerd/linkerd2-proxy#1357)
* ci: Split actions into several workflows (linkerd/linkerd2-proxy#1356)
* ci: Make job names uniform (linkerd/linkerd2-proxy#1358)
* meshtls: allow building without any TLS impls enabled (linkerd/linkerd2-proxy#1359)
* `app-core` should not enable `meshtls-rustls` (linkerd/linkerd2-proxy#1360)
* Restore rustls credential tests (linkerd/linkerd2-proxy#1363)
* build(deps): bump hex from 0.3 to 0.4 (linkerd/linkerd2-proxy#1364)
* ci: Split jobs into 'fast' and 'slow' workflows (linkerd/linkerd2-proxy#1365)
* meshtls: Move TLS e2e tests into the meshtls crate (linkerd/linkerd2-proxy#1366)
* rustls: Tidy std::task imports (linkerd/linkerd2-proxy#1367)
* build(deps): bump serde_json from 1.0.68 to 1.0.69 (linkerd/linkerd2-proxy#1368)
* build(deps): bump libc from 0.2.106 to 0.2.107 (linkerd/linkerd2-proxy#1369)
* meshtls: Add a `boring` backend (linkerd/linkerd2-proxy#1351)
* meshtls-rustls: update to `rustls` 0.20 and `tokio-rustls` 0.23 (linkerd/linkerd2-proxy#1362)
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Nov 9, 2021
This release updates the proxy's `rustls`, `ring`, and `webpki` dependencies.

Additionally, the proxy can now be built to use a `boringssl` backend
instead of the default `rustls` backend, but this functionality is
disabled in default builds.

---

* meshtls: replace build script with `compile_error!` macro (linkerd/linkerd2-proxy#1357)
* ci: Split actions into several workflows (linkerd/linkerd2-proxy#1356)
* ci: Make job names uniform (linkerd/linkerd2-proxy#1358)
* meshtls: allow building without any TLS impls enabled (linkerd/linkerd2-proxy#1359)
* `app-core` should not enable `meshtls-rustls` (linkerd/linkerd2-proxy#1360)
* Restore rustls credential tests (linkerd/linkerd2-proxy#1363)
* build(deps): bump hex from 0.3 to 0.4 (linkerd/linkerd2-proxy#1364)
* ci: Split jobs into 'fast' and 'slow' workflows (linkerd/linkerd2-proxy#1365)
* meshtls: Move TLS e2e tests into the meshtls crate (linkerd/linkerd2-proxy#1366)
* rustls: Tidy std::task imports (linkerd/linkerd2-proxy#1367)
* build(deps): bump serde_json from 1.0.68 to 1.0.69 (linkerd/linkerd2-proxy#1368)
* build(deps): bump libc from 0.2.106 to 0.2.107 (linkerd/linkerd2-proxy#1369)
* meshtls: Add a `boring` backend (linkerd/linkerd2-proxy#1351)
* meshtls-rustls: update to `rustls` 0.20 and `tokio-rustls` 0.23 (linkerd/linkerd2-proxy#1362)
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.

3 participants