From 932716a449cf9f478a8b9249b26e7e17a1c81a0d Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 13:45:55 -0800 Subject: [PATCH 01/10] Make dist upload --- dist-workspace.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist-workspace.toml b/dist-workspace.toml index 429475ba..2e01a5b7 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -15,7 +15,7 @@ installers = ["shell", "powershell", "msi"] # Target platforms to build apps for (Rust target-triple syntax) targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"] # Which actions to run on pull requests -pr-run-mode = "plan" +pr-run-mode = "upload" # Whether to install an updater program install-updater = false ssldotcom-windows-sign = "prod" From d0d6f2ac1f6bbc559bbdfa038f9b9fb65607c9c7 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 13:53:22 -0800 Subject: [PATCH 02/10] Bump dist to 0.25.1 --- .github/workflows/release.yml | 48 +++++++++++++++++------------------ dist-workspace.toml | 6 ++--- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e4306e75..24c4ca45 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -# This file was autogenerated by cargo-dist: https://opensource.axo.dev/cargo-dist/ +# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/ # # Copyright 2022-2024, axodotdev # SPDX-License-Identifier: MIT or Apache-2.0 @@ -6,7 +6,7 @@ # CI that: # # * checks for a Git Tag that looks like a release -# * builds artifacts with cargo-dist (archives, installers, hashes) +# * builds artifacts with dist (archives, installers, hashes) # * uploads those artifacts to temporary workflow zip # * on success, uploads the artifacts to a GitHub Release # @@ -24,10 +24,10 @@ permissions: # must be a Cargo-style SemVer Version (must have at least major.minor.patch). # # If PACKAGE_NAME is specified, then the announcement will be for that -# package (erroring out if it doesn't have the given version or isn't cargo-dist-able). +# package (erroring out if it doesn't have the given version or isn't dist-able). # # If PACKAGE_NAME isn't specified, then the announcement will be for all -# (cargo-dist-able) packages in the workspace with that version (this mode is +# (dist-able) packages in the workspace with that version (this mode is # intended for workspaces with only one dist-able package, or with all dist-able # packages versioned/released in lockstep). # @@ -45,7 +45,7 @@ on: - '**[0-9]+.[0-9]+.[0-9]+*' jobs: - # Run 'cargo dist plan' (or host) to determine what tasks we need to do + # Run 'dist plan' (or host) to determine what tasks we need to do plan: runs-on: "ubuntu-20.04" outputs: @@ -59,16 +59,16 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - name: Install cargo-dist + - name: Install dist # we specify bash to get pipefail; it guards against the `curl` command # failing. otherwise `sh` won't catch that `curl` returned non-0 shell: bash - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.23.0/cargo-dist-installer.sh | sh" - - name: Cache cargo-dist + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.25.1/cargo-dist-installer.sh | sh" + - name: Cache dist uses: actions/upload-artifact@v4 with: name: cargo-dist-cache - path: ~/.cargo/bin/cargo-dist + path: ~/.cargo/bin/dist # sure would be cool if github gave us proper conditionals... # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible # functionality based on whether this is a pull_request, and whether it's from a fork. @@ -76,8 +76,8 @@ jobs: # but also really annoying to build CI around when it needs secrets to work right.) - id: plan run: | - cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json - echo "cargo dist ran successfully" + dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json + echo "dist ran successfully" cat plan-dist-manifest.json echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT" - name: "Upload dist-manifest.json" @@ -95,12 +95,12 @@ jobs: if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }} strategy: fail-fast: false - # Target platforms/runners are computed by cargo-dist in create-release. + # Target platforms/runners are computed by dist in create-release. # Each member of the matrix has the following arguments: # # - runner: the github runner - # - dist-args: cli flags to pass to cargo dist - # - install-dist: expression to run to install cargo-dist on the runner + # - dist-args: cli flags to pass to dist + # - install-dist: expression to run to install dist on the runner # # Typically there will be: # - 1 "global" task that builds universal installers @@ -121,7 +121,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - name: Install cargo-dist + - name: Install dist run: ${{ matrix.install_dist }} # Get the dist-manifest - name: Fetch local artifacts @@ -136,8 +136,8 @@ jobs: - name: Build artifacts run: | # Actually do builds and make zips and whatnot - cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json - echo "cargo dist ran successfully" + dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json + echo "dist ran successfully" - id: cargo-dist name: Post-build # We force bash here just because github makes it really hard to get values up @@ -172,12 +172,12 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - name: Install cached cargo-dist + - name: Install cached dist uses: actions/download-artifact@v4 with: name: cargo-dist-cache path: ~/.cargo/bin/ - - run: chmod +x ~/.cargo/bin/cargo-dist + - run: chmod +x ~/.cargo/bin/dist # Get all the local artifacts for the global tasks to use (for e.g. checksums) - name: Fetch local artifacts uses: actions/download-artifact@v4 @@ -188,8 +188,8 @@ jobs: - id: cargo-dist shell: bash run: | - cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json - echo "cargo dist ran successfully" + dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json + echo "dist ran successfully" # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" @@ -221,12 +221,12 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - name: Install cached cargo-dist + - name: Install cached dist uses: actions/download-artifact@v4 with: name: cargo-dist-cache path: ~/.cargo/bin/ - - run: chmod +x ~/.cargo/bin/cargo-dist + - run: chmod +x ~/.cargo/bin/dist # Fetch artifacts from scratch-storage - name: Fetch artifacts uses: actions/download-artifact@v4 @@ -237,7 +237,7 @@ jobs: - id: host shell: bash run: | - cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json + dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json echo "artifacts uploaded and released successfully" cat dist-manifest.json echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT" diff --git a/dist-workspace.toml b/dist-workspace.toml index 2e01a5b7..b76064c3 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -4,10 +4,10 @@ [workspace] members = ["cargo:."] -# Config for 'cargo dist' +# Config for 'dist' [dist] -# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax) -cargo-dist-version = "0.23.0" +# The preferred dist version to use in CI (Cargo.toml SemVer syntax) +cargo-dist-version = "0.25.1" # CI backends to support ci = "github" # The installers to generate for each app From cbc437ed5d6c95f93ee097ce65767677410390fc Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 14:39:14 -0800 Subject: [PATCH 03/10] Add rustls-tls feature to reqwest-middleware --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index edf134a5..3af11632 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ futures = "0.3" tempfile = "3" tokio = { version = "1", features = ["macros", "rt-multi-thread", "fs", "process"] } reqwest = { version = "0.12.8", default-features = false, features = ["blocking", "json", "rustls-tls", "rustls-tls-native-roots"] } -reqwest-middleware = "0.3" +reqwest-middleware = { version = "0.3", features = ["rustls-tls"] } reqwest-retry = "0.6" tracing = "0.1" tracing-subscriber = { version = "0.3", default-features = false, features = [ From e997fb9b88d681e4995afc7f8a7a24e7e1d6bfe5 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 14:57:22 -0800 Subject: [PATCH 04/10] Try to debug CI only aarch64 only issue --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cc3fdad..9b531aeb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -74,6 +74,13 @@ jobs: shell: bash run: cargo build + - name: DEBUG ME HERE + shell: bash + run: | + rustup target add aarch64-unknown-linux-gnu + cargo tree -i openssl-sys --target aarch64-unknown-linux-gnu + CARGO_BUILD_JOBS=1 cargo build --target aarch64-unknown-linux-gnu + - name: Upload criticalup debug build uses: actions/upload-artifact@v4 with: From d49ab8c8b6502a42cdc0718b4136381507e6d85e Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 15:09:04 -0800 Subject: [PATCH 05/10] Rip out reqwest-retry --- Cargo.lock | 117 +----------------- Cargo.toml | 3 +- crates/criticalup-core/Cargo.toml | 1 - .../src/download_server_client.rs | 6 - 4 files changed, 4 insertions(+), 123 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 95b24cc1..781dc458 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -725,7 +725,6 @@ dependencies = [ "mock-download-server", "reqwest", "reqwest-middleware", - "reqwest-retry", "serde", "serde_json", "sha2", @@ -951,7 +950,7 @@ checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "windows-sys 0.52.0", ] @@ -1092,10 +1091,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -1449,18 +1446,6 @@ dependencies = [ "similar", ] -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "ipnet" version = "2.9.0" @@ -1525,16 +1510,6 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - [[package]] name = "log" version = "0.4.21" @@ -1745,31 +1720,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", -] - [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -1950,15 +1900,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -2081,9 +2022,9 @@ dependencies = [ [[package]] name = "reqwest-middleware" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39346a33ddfe6be00cbc17a34ce996818b97b230b87229f10114693becca1268" +checksum = "d1ccd3b55e711f91a9885a2fa6fbbb2e39db1776420b062efc058c6410f7e5e3" dependencies = [ "anyhow", "async-trait", @@ -2094,37 +2035,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "reqwest-retry" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2a94ba69ceb30c42079a137e2793d6d0f62e581a24c06cd4e9bb32e973c7da" -dependencies = [ - "anyhow", - "async-trait", - "chrono", - "futures", - "getrandom", - "http 1.1.0", - "hyper 1.3.1", - "parking_lot", - "reqwest", - "reqwest-middleware", - "retry-policies", - "tokio", - "tracing", - "wasm-timer", -] - -[[package]] -name = "retry-policies" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5875471e6cab2871bc150ecb8c727db5113c9338cc3354dc5ee3425b6aa40a1c" -dependencies = [ - "rand", -] - [[package]] name = "rfc6979" version = "0.4.0" @@ -2345,12 +2255,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - [[package]] name = "sct" version = "0.7.1" @@ -3136,21 +3040,6 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" -[[package]] -name = "wasm-timer" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" -dependencies = [ - "futures", - "js-sys", - "parking_lot", - "pin-utils", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "web-sys" version = "0.3.69" diff --git a/Cargo.toml b/Cargo.toml index 3af11632..dd3b0570 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,8 +19,7 @@ futures = "0.3" tempfile = "3" tokio = { version = "1", features = ["macros", "rt-multi-thread", "fs", "process"] } reqwest = { version = "0.12.8", default-features = false, features = ["blocking", "json", "rustls-tls", "rustls-tls-native-roots"] } -reqwest-middleware = { version = "0.3", features = ["rustls-tls"] } -reqwest-retry = "0.6" +reqwest-middleware = { version = "0.4", features = ["rustls-tls"] } tracing = "0.1" tracing-subscriber = { version = "0.3", default-features = false, features = [ "ansi", diff --git a/crates/criticalup-core/Cargo.toml b/crates/criticalup-core/Cargo.toml index dbdf6585..c8d2f169 100644 --- a/crates/criticalup-core/Cargo.toml +++ b/crates/criticalup-core/Cargo.toml @@ -19,7 +19,6 @@ sha2 = { version = "0.10.8" } dirs = { version = "5.0.1", default-features = false } tokio.workspace = true reqwest-middleware.workspace = true -reqwest-retry.workspace = true tracing.workspace = true [dev-dependencies] diff --git a/crates/criticalup-core/src/download_server_client.rs b/crates/criticalup-core/src/download_server_client.rs index 150f82bf..de8156d3 100644 --- a/crates/criticalup-core/src/download_server_client.rs +++ b/crates/criticalup-core/src/download_server_client.rs @@ -12,12 +12,8 @@ use reqwest::header::{HeaderValue, AUTHORIZATION}; use reqwest::StatusCode; use reqwest::{Response, Url}; use reqwest_middleware::{ClientBuilder, ClientWithMiddleware, RequestBuilder}; -use reqwest_retry::policies::ExponentialBackoff; -use reqwest_retry::RetryTransientMiddleware; use serde::Deserialize; -const CLIENT_MAX_RETRIES: u32 = 5; - pub struct DownloadServerClient { base_url: String, client: ClientWithMiddleware, @@ -27,13 +23,11 @@ pub struct DownloadServerClient { impl DownloadServerClient { pub fn new(config: &Config, state: &State) -> Self { - let retry_policy = ExponentialBackoff::builder().build_with_max_retries(CLIENT_MAX_RETRIES); let client = reqwest::ClientBuilder::new() .user_agent(config.whitelabel.http_user_agent) .build() .expect("failed to configure http client"); let client = ClientBuilder::new(client) - .with(RetryTransientMiddleware::new_with_policy(retry_policy)) .build(); DownloadServerClient { From 4703e10fc48ab206b0f502b1ea9411cc93f308bd Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 15:09:49 -0800 Subject: [PATCH 06/10] rip out some CI steps --- .github/workflows/ci.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b531aeb..133774db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,26 +53,26 @@ jobs: shell: bash run: echo "INSTA_SNAPSHOT_REFERENCES_FILE=$(mktemp)" >> "${GITHUB_ENV}" - - name: Run the test suite (Without AWS KMS) - if: ${{ runner.os != 'Linux' }} - shell: bash - run: cargo test --timings --workspace --locked - - - name: Run the test suite (With AWS KMS) - if: ${{ runner.os == 'Linux' }} - shell: bash - run: cargo test --timings --workspace --locked --features aws-kms -- --test-threads=1 - - # Incompatible with Windows, insta snapshots output Windows paths - # Incompatible with Mac, find does not have `-n`, diff does not have `--color` - - if: ${{ matrix.os == 'ubuntu-latest' }} - name: Ensure there are no unused insta snapshots - shell: bash - run: diff -u --color <(find -name "*.snap" | xargs realpath | sort | uniq) <(cat "${INSTA_SNAPSHOT_REFERENCES_FILE}" | xargs realpath | sort | uniq) - - - name: Build debug builds - shell: bash - run: cargo build + # - name: Run the test suite (Without AWS KMS) + # if: ${{ runner.os != 'Linux' }} + # shell: bash + # run: cargo test --timings --workspace --locked + + # - name: Run the test suite (With AWS KMS) + # if: ${{ runner.os == 'Linux' }} + # shell: bash + # run: cargo test --timings --workspace --locked --features aws-kms -- --test-threads=1 + + # # Incompatible with Windows, insta snapshots output Windows paths + # # Incompatible with Mac, find does not have `-n`, diff does not have `--color` + # - if: ${{ matrix.os == 'ubuntu-latest' }} + # name: Ensure there are no unused insta snapshots + # shell: bash + # run: diff -u --color <(find -name "*.snap" | xargs realpath | sort | uniq) <(cat "${INSTA_SNAPSHOT_REFERENCES_FILE}" | xargs realpath | sort | uniq) + + # - name: Build debug builds + # shell: bash + # run: cargo build - name: DEBUG ME HERE shell: bash From 3cae8c5c0637c0cbb677d7624115d3fdc954f657 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 15:11:27 -0800 Subject: [PATCH 07/10] rip out some CI steps --- .github/workflows/ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 133774db..c3b65577 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,21 +37,21 @@ jobs: rustup update stable --no-self-update rustup default stable - - name: Cache Rust dependencies - uses: ferrous-systems/shared-github-actions/cache-rust@main + # - name: Cache Rust dependencies + # uses: ferrous-systems/shared-github-actions/cache-rust@main - - name: Check formatting - if: ${{ matrix.os == 'ubuntu-latest' }} - shell: bash - run: cargo fmt --all --check + # - name: Check formatting + # if: ${{ matrix.os == 'ubuntu-latest' }} + # shell: bash + # run: cargo fmt --all --check - - name: Check Clippy warnings - shell: bash - run: cargo clippy --workspace --tests --locked -- -Dwarnings + # - name: Check Clippy warnings + # shell: bash + # run: cargo clippy --workspace --tests --locked -- -Dwarnings - - name: Prepare file to record snapshots used by insta - shell: bash - run: echo "INSTA_SNAPSHOT_REFERENCES_FILE=$(mktemp)" >> "${GITHUB_ENV}" + # - name: Prepare file to record snapshots used by insta + # shell: bash + # run: echo "INSTA_SNAPSHOT_REFERENCES_FILE=$(mktemp)" >> "${GITHUB_ENV}" # - name: Run the test suite (Without AWS KMS) # if: ${{ runner.os != 'Linux' }} From f78713a2966b2bb8e0328820f0643ee39dc09f68 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 15:11:36 -0800 Subject: [PATCH 08/10] fmt --- crates/criticalup-core/src/download_server_client.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/criticalup-core/src/download_server_client.rs b/crates/criticalup-core/src/download_server_client.rs index de8156d3..5bb0fa74 100644 --- a/crates/criticalup-core/src/download_server_client.rs +++ b/crates/criticalup-core/src/download_server_client.rs @@ -27,8 +27,7 @@ impl DownloadServerClient { .user_agent(config.whitelabel.http_user_agent) .build() .expect("failed to configure http client"); - let client = ClientBuilder::new(client) - .build(); + let client = ClientBuilder::new(client).build(); DownloadServerClient { base_url: config.whitelabel.download_server_url.clone(), From 1a73695f583f40baa5704836814abae73c4b73e5 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 15:16:22 -0800 Subject: [PATCH 09/10] Rip out reqwest-middleware --- Cargo.lock | 33 ------------------- Cargo.toml | 1 - crates/criticalup-core/Cargo.toml | 1 - .../src/download_server_client.rs | 9 +++-- crates/criticalup-core/src/errors.rs | 2 -- 5 files changed, 4 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 781dc458..6d529805 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -89,29 +89,12 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "anyhow" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" - [[package]] name = "ascii" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" -[[package]] -name = "async-trait" -version = "0.1.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "atomic-waker" version = "1.1.2" @@ -724,7 +707,6 @@ dependencies = [ "dirs", "mock-download-server", "reqwest", - "reqwest-middleware", "serde", "serde_json", "sha2", @@ -2020,21 +2002,6 @@ dependencies = [ "windows-registry", ] -[[package]] -name = "reqwest-middleware" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1ccd3b55e711f91a9885a2fa6fbbb2e39db1776420b062efc058c6410f7e5e3" -dependencies = [ - "anyhow", - "async-trait", - "http 1.1.0", - "reqwest", - "serde", - "thiserror 1.0.69", - "tower-service", -] - [[package]] name = "rfc6979" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index dd3b0570..28e1b05f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ futures = "0.3" tempfile = "3" tokio = { version = "1", features = ["macros", "rt-multi-thread", "fs", "process"] } reqwest = { version = "0.12.8", default-features = false, features = ["blocking", "json", "rustls-tls", "rustls-tls-native-roots"] } -reqwest-middleware = { version = "0.4", features = ["rustls-tls"] } tracing = "0.1" tracing-subscriber = { version = "0.3", default-features = false, features = [ "ansi", diff --git a/crates/criticalup-core/Cargo.toml b/crates/criticalup-core/Cargo.toml index c8d2f169..3e2f2b9e 100644 --- a/crates/criticalup-core/Cargo.toml +++ b/crates/criticalup-core/Cargo.toml @@ -18,7 +18,6 @@ toml_edit = { version = "0.22.22", features = ["serde"] } sha2 = { version = "0.10.8" } dirs = { version = "5.0.1", default-features = false } tokio.workspace = true -reqwest-middleware.workspace = true tracing.workspace = true [dev-dependencies] diff --git a/crates/criticalup-core/src/download_server_client.rs b/crates/criticalup-core/src/download_server_client.rs index 5bb0fa74..ff55a266 100644 --- a/crates/criticalup-core/src/download_server_client.rs +++ b/crates/criticalup-core/src/download_server_client.rs @@ -9,14 +9,14 @@ use criticaltrust::manifests::ReleaseManifest; use criticaltrust::manifests::{KeysManifest, ReleaseArtifactFormat}; use criticaltrust::signatures::Keychain; use reqwest::header::{HeaderValue, AUTHORIZATION}; -use reqwest::StatusCode; +use reqwest::Client; +use reqwest::{RequestBuilder, StatusCode}; use reqwest::{Response, Url}; -use reqwest_middleware::{ClientBuilder, ClientWithMiddleware, RequestBuilder}; use serde::Deserialize; pub struct DownloadServerClient { base_url: String, - client: ClientWithMiddleware, + client: Client, state: State, trust_root: PublicKey, } @@ -27,7 +27,6 @@ impl DownloadServerClient { .user_agent(config.whitelabel.http_user_agent) .build() .expect("failed to configure http client"); - let client = ClientBuilder::new(client).build(); DownloadServerClient { base_url: config.whitelabel.download_server_url.clone(), @@ -137,7 +136,7 @@ impl DownloadServerClient { let response_result = self.client.execute(req).await; let response = response_result.map_err(|e| Error::DownloadServerError { - kind: DownloadServerError::NetworkWithMiddleware(e), + kind: DownloadServerError::Network(e), url, })?; diff --git a/crates/criticalup-core/src/errors.rs b/crates/criticalup-core/src/errors.rs index 9e70be62..fae14ccc 100644 --- a/crates/criticalup-core/src/errors.rs +++ b/crates/criticalup-core/src/errors.rs @@ -123,8 +123,6 @@ pub enum DownloadServerError { UnexpectedResponseData(#[source] serde_json::Error), #[error("Failed to send the network request.")] Network(#[source] reqwest::Error), - #[error("Failed to send the network request.")] - NetworkWithMiddleware(#[source] reqwest_middleware::Error), } #[derive(Debug, thiserror::Error)] From 159de426391b99161feefd8a4cc1a704c963ec29 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 22 Nov 2024 15:27:39 -0800 Subject: [PATCH 10/10] Make criticaltrust use workspace reqwest --- Cargo.lock | 168 +------------------------------- crates/criticaltrust/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 167 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d529805..a2665cfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -95,12 +95,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "autocfg" version = "1.2.0" @@ -348,7 +342,7 @@ dependencies = [ "aws-smithy-types", "bytes", "fastrand", - "h2 0.3.26", + "h2", "http 0.2.12", "http-body 0.4.6", "http-body 1.0.0", @@ -883,15 +877,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -942,21 +927,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1113,25 +1083,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "h2" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http 1.1.0", - "indexmap 2.6.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -1249,7 +1200,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.26", + "h2", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -1272,7 +1223,6 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.6", "http 1.1.0", "http-body 1.0.0", "httparse", @@ -1318,22 +1268,6 @@ dependencies = [ "webpki-roots", ] -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper 1.3.1", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - [[package]] name = "hyper-util" version = "0.1.4" @@ -1562,23 +1496,6 @@ dependencies = [ "tiny_http", ] -[[package]] -name = "native-tls" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1628,50 +1545,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "openssl" -version = "0.10.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" -dependencies = [ - "bitflags 2.5.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-sys" -version = "0.9.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" @@ -1960,23 +1839,19 @@ checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64 0.22.1", "bytes", - "encoding_rs", "futures-channel", "futures-core", "futures-util", - "h2 0.4.6", "http 1.1.0", "http-body 1.0.0", "http-body-util", "hyper 1.3.1", "hyper-rustls 0.27.2", - "hyper-tls", "hyper-util", "ipnet", "js-sys", "log", "mime", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", @@ -1989,9 +1864,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", - "tokio-native-tls", "tokio-rustls 0.26.0", "tower-service", "url", @@ -2482,27 +2355,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "system-configuration" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" -dependencies = [ - "bitflags 2.5.0", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "tar" version = "0.4.43" @@ -2663,16 +2515,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.24.1" @@ -2898,12 +2740,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" diff --git a/crates/criticaltrust/Cargo.toml b/crates/criticaltrust/Cargo.toml index 591d7055..ab630da7 100644 --- a/crates/criticaltrust/Cargo.toml +++ b/crates/criticaltrust/Cargo.toml @@ -24,7 +24,7 @@ aws-sdk-kms = { version = "1.50.0", optional = true, features = ["rustls"] } aws-smithy-runtime-api = { version = "1.7.3", optional = true } tokio = { version = "1.37.0", features = ["rt", "rt-multi-thread", "macros"], optional = true } once_cell = "1.19.0" -reqwest = "0.12.9" +reqwest.workspace = true [dev-dependencies] itertools = "0.13.0"