Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions .github/workflows/bazel-nuget.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Bazel patch compatibility (NuGet)

# The NuGet flow of the real-Bazel tests (`nuget::` in `e2e_bazel_build`):
# The NuGet flows of the real-Bazel tests (`nuget::` in `e2e_bazel_build`):
# hosted mode for a package that rules_csharp's `nuget.from_lock` reads from
# `packages.lock.json` and `nuget.config`, on each Bazel release below.
# `packages.lock.json` and `nuget.config`, and for a tag that names no
# `nuget_config`, on each Bazel release below.
# bazel-compatibility.yml holds the legs and what every ecosystem shares;
# this file says when the NuGet legs run and on which releases.
#
Expand Down Expand Up @@ -35,11 +36,14 @@ on:
# finds a package in the global packages folder, the reader of the
# NuGet settings a project inherits (vendor/nuget_config.rs), the
# discovery of a hosted pin in the two files, the upstream restore of
# `rollback`, and the hosted scan's check of that folder.
# `rollback`, and the hosted scan's check of that folder. Then what
# reads the tag in `MODULE.bazel`: the reader of the workspace files,
# which every ecosystem's flow shares (bazel/mod.rs, starlark.rs and
# workspace.rs), and what hosted mode makes of the tag (bazel/nuget.rs).
# vendor/nuget_feed.rs is the vendored backend; it is here for the
# version and folder helpers that every one of those files calls.
# Nothing another ecosystem's flow owns is here, so a change to one
# ecosystem starts that ecosystem's legs only.
# Nothing else that another ecosystem's flow owns is here, so any other
# change to one ecosystem starts that ecosystem's legs only.
#
# What it does not cover: shared engine code. The hosted rewrite itself
# is there (`rewrite_nuget` in patch/redirect/mod.rs, the file of every
Expand All @@ -66,6 +70,10 @@ on:
- 'crates/socket-patch-core/src/vex/discover/nuget.rs'
- 'crates/socket-patch-core/src/patch/redirect/upstream/nuget.rs'
- 'crates/socket-patch-cli/src/commands/scan/hosted/nuget.rs'
- 'crates/socket-patch-core/src/bazel/mod.rs'
- 'crates/socket-patch-core/src/bazel/nuget.rs'
- 'crates/socket-patch-core/src/bazel/starlark.rs'
- 'crates/socket-patch-core/src/bazel/workspace.rs'
push:
branches: [main]
# The pull request paths, and what only a push to main covers: the
Expand All @@ -89,6 +97,10 @@ on:
- 'crates/socket-patch-core/src/vex/discover/nuget.rs'
- 'crates/socket-patch-core/src/patch/redirect/upstream/nuget.rs'
- 'crates/socket-patch-cli/src/commands/scan/hosted/nuget.rs'
- 'crates/socket-patch-core/src/bazel/mod.rs'
- 'crates/socket-patch-core/src/bazel/nuget.rs'
- 'crates/socket-patch-core/src/bazel/starlark.rs'
- 'crates/socket-patch-core/src/bazel/workspace.rs'
- 'crates/socket-patch-cli/tests/e2e_bazel_build/main.rs'
- 'crates/socket-patch-core/src/patch/redirect/**'
- 'crates/socket-patch-core/src/hosted/**'
Expand Down
2 changes: 2 additions & 0 deletions crates/socket-patch-cli/CLI_CONTRACT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,8 @@ command's integration tests check its output.
| `redirect_pin_lockless` | `warnings[]` (warning) | scan/get `--mode hosted` (nuget, cargo): the pin was written without a lockfile that records its version, so `vex` cannot attest it and `rollback` / `remove` / `vendor` refuse it as unattributable. The detail names the lockfile to create (`dotnet restore --use-lock-file`, `cargo generate-lockfile`) before re-running the hosted scan. |
| `redirect_pypi_stale_install` | `warnings[]` (warning) | Hosted Python redirect: readable installed files differ from the pinned patched wheel's `RECORD` (or from the patch record, when the wheel cannot judge the copy). Read-only, repeated on re-scan, and excludes the package from same-run VEX. See the "Python stale-install guard" section. |
| `redirect_nuget_stale_global_package` / `vendor_nuget_stale_global_package` | `warnings[]` (warning, hosted) / `skipped` (warning, vendor advisory event) | scan `--mode hosted` / `vendor` / `scan --mode vendored` (nuget, v5.0 #352): NuGet's global packages folder (`NUGET_PACKAGES`, else `~/.nuget/packages`) already holds the patched package extracted from other bytes (its `.nupkg.metadata` `contentHash` is not the patched one). A patch keeps the upstream id and version and NuGet restores a package already in that folder without asking any source, so `dotnet restore` would keep the upstream bytes (silently without a lock, NU1403 against the re-pinned lock with one). The detail names the directory and the remedy: delete it, then `dotnet restore` (`dotnet nuget locals global-packages --clear` also works but empties the whole machine-wide folder, and the detail says so); CI caches of that folder must drop it too. Read-only like the gem guard (the folder is shared machine-wide), re-fired on every re-run until the copy is gone, skipped on `--dry-run`; a hosted purl it flags is excluded from the same run's `--vex` `assume_applied` and reported stale. A dir without `.nupkg.metadata` (a legacy `packages/` folder) is never judged. |
| `redirect_bazel_nuget_config_undeclared` | `warnings[]` (warning; human: `Warning: …`) | scan/get `--mode hosted` in a Bazel workspace (nuget, additive): a rules_csharp `nuget.from_lock` tag of the root `MODULE.bazel` (or of a file it includes) reads a `packages.lock.json` of the project, or may (its `packages_lock_json` is not a label in a plain string), and the tags do not show that the hub takes its package sources from the `nuget.config` hosted mode writes. The hub has one list of sources, which the last tag with a `nuget_config` or `feeds` decides: that tag names another file or has `feeds` alone, no tag has either, or a tag cannot be read with certainty (it is not a call of its own, passes `**`, or its `nuget_config` is not a label in a plain string). Also given, for every NuGet package of the run, where the tags do show it, a tag has `feeds` and the config names no package source yet: the first source in it would take the place of those `feeds`. Where the tags are in more than one file their order is unknown and every tag with a `nuget_config` or `feeds` must name the config. The hub would download the upstream package and fail the build on the re-pinned `contentHash`, so nothing is written for the package: no `nuget.config`, no lock entry. The package is a `skipped` / `redirect_unconfirmed` event; status and exit are unchanged (exit 0). One warning per package that the run would re-pin in a lock a tag reads (a package refused for another reason keeps that reason's code; a package in no such lock is pinned as without Bazel): the detail starts `<name>@<version>: <file>:<line>:`, says what stands against the pin, and names the way on: the attribute to put on the tag (`nuget_config = "//<package>:<config>"`, with the config as the project directory spells it; the file alone where the tag does not name its lock in a plain string or the config lies outside the package of that label), with the sources or `feeds` to name in that config where the tag had others, or, for a tag that names a NuGet config in a directory above the project, the directory to run the command in (`--cwd`). Never given outside a Bazel workspace, for a project without a lock, or when no tag names one of the project's locks: those runs are unchanged, as is one in a workspace where a part of `MODULE.bazel` cannot be read and the tags that are read show the config. See [Bazel workspaces: NuGet](../../docs/ecosystems.md#bazel-workspaces-nuget). |
| `redirect_bazel_nuget_lock_not_repinned` | `warnings[]` (warning; human: `Warning: …`) | scan/get `--mode hosted` in a Bazel workspace (nuget, additive): under the same condition (a `nuget.from_lock` tag reads, or may read, a lock of the project), another tag reads a `packages.lock.json` of the checkout that this run does not re-pin, and that lock holds the package at the patched version with another `contentHash`, or cannot be read; or another tag, beside one that names a lock of the project, does not name its lock in a plain string. The hub holds a package to the `contentHash` of the first lock that names it, so it would refuse the patched package: nothing is written for the package (`skipped` / `redirect_unconfirmed`, exit 0), also when the hub does not read the config yet. Not given when the tags are in one file and a lock of the project that holds the package comes before the other lock, or when the other lock holds the package at another version or already at the patched `contentHash`. The detail starts `<name>@<version>: <file>:<line>:`, names the tag and the lock, and says to run the command in a directory above both locks that holds a solution file or a `nuget.config` (`--cwd`), where the lock of every project is re-pinned; for a tag whose lock is not named, to write its `packages_lock_json` as a label in a plain string. Checked before `redirect_bazel_nuget_config_undeclared`. See [Bazel workspaces: NuGet](../../docs/ecosystems.md#bazel-workspaces-nuget). |
| `redirect_gem_stale_install` | `warnings[]` (warning) | scan / get `--mode hosted` (gem): a stale UNPATCHED materialization (installed gem, or committed archive in bundler's cache dir — `vendor/cache` unless `cache_path` moves it) that `bundle install` will reuse instead of fetching the redirected patch, and that the run did not refresh: it is in a shared gem home, or the refresh could not be done (the detail says why) or is turned off. The detail carries the remedy. A human run prints one warning for all of them. Full rules and flavors: the "Gem stale-install guard" section. |
| `redirect_gem_install_refreshed` | `warnings[]` (note) | scan / get `--mode hosted` (gem): a stale materialization the run replaced with the sha256-verified patched gem (the detail names the purl and the path). A human run prints a progress line instead. See the "Gem stale-install guard" section. |
| `redirect_gem_install_would_refresh` | `warnings[]` (note) | scan / get `--mode hosted --dry-run` (gem): a stale materialization a wet run would replace. Nothing was written or downloaded. |
Expand Down
Loading
Loading