From b4eaf7e4d5543d4fc072ba0702e48e9c0198a7ae Mon Sep 17 00:00:00 2001 From: Damon Barry Date: Fri, 27 Sep 2024 13:42:21 -0700 Subject: [PATCH] Revert "Use Azure feed to resolve crate dependencies (#636)" (#637) This reverts commit 7173094241e37fac6b1db20bd8fc6e16badf7ec5. The build is ignoring the feed because the rust toolchain used by v1.4 doesn't support the ability to replace crates-io with an alternate registry. We're too close to the end of support for v1.4 to undertake a toolchain upgrade. --- Cargo.toml | 6 ----- aziotctl/.cargo/config.toml | 9 -------- docs-dev/building.md | 46 ------------------------------------- 3 files changed, 61 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 353c7c030..d52a48e62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ members = [ "cert/aziot-cert-client-async", "cert/aziot-cert-common", "cert/aziot-cert-common-http", - "cert/aziot-certd-config", "cert/aziot-certd", "cert/cert-renewal", @@ -20,7 +19,6 @@ members = [ "identity/aziot-identity-client-async", "identity/aziot-identity-common", "identity/aziot-identity-common-http", - "identity/aziot-identityd-config", "identity/aziot-identityd", "identity/mock-iot-server", @@ -28,7 +26,6 @@ members = [ "key/aziot-key-client-async", "key/aziot-key-common", "key/aziot-key-common-http", - "key/aziot-keyd-config", "key/aziot-keyd", "key/aziot-key-openssl-engine", "key/aziot-key-openssl-engine-shared", @@ -36,8 +33,6 @@ members = [ "key/aziot-keys", "key/aziot-keys-common", - "logger", - "mini-sntp", "openssl2", @@ -52,7 +47,6 @@ members = [ "tpm/aziot-tpm-client-async", "tpm/aziot-tpm-common-http", "tpm/aziot-tpm-common", - "tpm/aziot-tpmd-config", "tpm/aziot-tpmd", "tpm/tss-minimal", ] diff --git a/aziotctl/.cargo/config.toml b/aziotctl/.cargo/config.toml index 5572620b8..6fcb94777 100644 --- a/aziotctl/.cargo/config.toml +++ b/aziotctl/.cargo/config.toml @@ -4,12 +4,3 @@ USER_AZIOTKS = "aziotks" USER_AZIOTCS = "aziotcs" USER_AZIOTTPM = "aziottpm" SOCKET_DIR = "/run/aziot" - -[registries] -iotedge_PublicPackages = { index = "sparse+https://pkgs.dev.azure.com/iotedge/iotedge/_packaging/iotedge_PublicPackages/Cargo/index/" } - -[registry] -global-credential-providers = ["cargo:token", "cargo:libsecret"] - -[source.crates-io] -replace-with = "iotedge_PublicPackages" diff --git a/docs-dev/building.md b/docs-dev/building.md index 63ea1c301..a2c97447e 100644 --- a/docs-dev/building.md +++ b/docs-dev/building.md @@ -49,49 +49,3 @@ ``` Then invoke `make` again. - -# Updating a dependency - -If you update a dependency in one of the Rust projects, e.g., by updating a Cargo.toml file or calling `cargo update`, you may get an error when you build the project, e.g.: - -```sh -$ cargo build -p aziotd -error: failed to download from `https://pkgs.dev.azure.com/iotedge/39b8807f-aa0b-43ed-b4c9-58b83c0a23a7/_packaging/0581b6d1-911e-44b2-88d9-b384271aaf3a/cargo/api/v1/crates/http-body/1.0.1/download` - -Caused by: - failed to get successful HTTP response from `https://pkgs.dev.azure.com/iotedge/39b8807f-aa0b-43ed-b4c9-58b83c0a23a7/_packaging/0581b6d1-911e-44b2-88d9-b384271aaf3a/cargo/api/v1/crates/http-body/1.0.1/download` (13.107.42.20), got 401 - debug headers: - x-cache: CONFIG_NOCACHE - body: - {"$id":"1","innerException":null,"message":"No local versions of package 'http-body'; please provide authentication to access versions from upstream that have not yet been saved to your feed.","typeName":"Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException, Microsoft.TeamFoundation.Framework.Server","typeKey":"UnauthorizedRequestException","errorCode":0,"eventId":3000} -``` - -To add/upgrade a package in the feed, you must authenticate with write credentials. Ideally, a simple `cargo login` before `cargo build` would allow you to seamlessly update the feed, but cargo does not currently support optional authentication with fallback to anonymous. In other words, because we allow anonymous access to the feed, cargo will not authenticate. Instead, you can use the feed's REST API directly, e.g., - -```bash -package='' -version='' - -# the user needs to have "Feed and Upstream Reader (Collaborator)" permissions on the feed -az login -auth_header=$(az account get-access-token --query "join(' ', ['Authorization: Bearer', accessToken])" --output tsv) - -url="$(curl -sSL 'https://pkgs.dev.azure.com/iotedge/iotedge/_packaging/iotedge_PublicPackages/Cargo/index/config.json' | jq -r '.dl')" -url="${url/\{crate\}/$package}" -url="${url/\{version\}/$v}" - -# curl with --max-time of 5 seconds because we don't actually have to download the package, we just need to nudge -# the feed to acquire the package from upstream -curl -sSL --max-time 5 --header "$auth_header" --write-out '%{http_code}\n' "$url" -``` - -Once you've added/updated the package in the feed, the build should proceed normally. - -Contributors who need to add/update packages, but who do not have write access to the feed, can temporarily comment out the `replace-with` line in .cargo/config.toml during development: - -```toml -[source.crates-io] -# replace-with = "iotedge_PublicPackages" -``` - -Restore the line to its original state before opening a PR for review. Someone with access to the feed will need to update the feed before the PR can be tested and merged.