Skip to content

chore(container): exclude irrelevant workspace members from nextest archive - #1872

Merged
josecelano merged 2 commits into
torrust:developfrom
josecelano:1868-1840-exclude-irrelevant-workspace-members
Jun 3, 2026
Merged

chore(container): exclude irrelevant workspace members from nextest archive#1872
josecelano merged 2 commits into
torrust:developfrom
josecelano:1868-1840-exclude-irrelevant-workspace-members

Conversation

@josecelano

Copy link
Copy Markdown
Member

Closes #1868.

Add --exclude workspace-coupling --exclude torrust-tracker-torrent-repository-benchmarking to all four cargo nextest archive commands in the Containerfile (pre-link warm-up × 2 and final archive × 2, covering both debug and release builds).

cargo chef prepare and cargo chef cook do not expose an --exclude flag (cargo-chef CLI limitation). The COPY/stub lines for the excluded packages are retained in the recipe stage because cargo chef prepare invokes cargo metadata internally, which requires every workspace member's manifest to be present on disk. This limitation and its rationale are documented in Containerfile comments.

Changes

  • Containerfile: added --exclude flags to 4 cargo nextest archive commands; added explanatory comments to cook and recipe stages
  • docs/issues/open/1868-…/ISSUE.md: T1–T3 marked DONE, AC4 marked DONE, automatic verification checkpoint checked

Verification

  • linter all → passed
  • cargo machete → passed
  • cargo test --doc --workspace → passed
  • Pre-commit hook → SUCCESS

Remaining: AC1–AC3 require a full CI run (build timing and image correctness).

Copilot AI review requested due to automatic review settings June 3, 2026 12:00
@josecelano josecelano self-assigned this Jun 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses #1868 by reducing unnecessary work during container builds by excluding two non-runtime workspace members from the cargo nextest archive steps, aiming to improve CI/container build performance while documenting cargo-chef limitations.

Changes:

  • Add --exclude workspace-coupling --exclude torrust-tracker-torrent-repository-benchmarking to all four cargo nextest archive commands (debug/release, warm-up/final).
  • Document why cargo chef prepare / cargo chef cook cannot exclude workspace members and why the recipe-stage COPY/stub entries must remain.
  • Update the issue spec to mark implementation and automatic verification as done, and record the rationale for the cargo-chef limitation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Containerfile Adds --exclude flags to cargo nextest archive commands and documents cargo-chef exclusion limitations.
docs/issues/open/1868-1840-workflow-performance-exclude-irrelevant-workspace-members/ISSUE.md Updates task/AC status and documents the cargo chef exclusion decision rationale.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Containerfile Outdated
josecelano added a commit to josecelano/torrust-tracker that referenced this pull request Jun 3, 2026
…scope

Address Copilot review comments on PR torrust#1872:

- Containerfile cook-stage comment: the previous wording implied that stub
  sources prevent the excluded packages' unique transitive dependencies from
  being compiled during the cook layer. In fact, dependency compilation is
  driven by Cargo.toml manifests (already in the recipe), not by stub sources.
  Reworded to make clear that the cook layer still compiles those packages,
  and that the build-time savings come from the archive/build stages where
  `--exclude` is applied to `cargo nextest archive`.

- ISSUE.md T2 task label: renamed from "Add `--exclude` flags to all
  Containerfile cargo commands" to "Add `--exclude` flags to all `cargo
  nextest archive` commands in Containerfile" to match what was actually done
  (only the nextest archive commands were updated; chef cook/prepare cannot
  accept `--exclude`).
…rchive

Closes torrust#1868.

Add `--exclude workspace-coupling --exclude torrust-tracker-torrent-repository-benchmarking`
to all four `cargo nextest archive` commands in the Containerfile (pre-link
warm-up × 2 and final archive × 2, covering both debug and release builds).

`cargo chef prepare` and `cargo chef cook` do not expose an `--exclude` flag
(cargo-chef CLI limitation). The COPY/stub lines for the excluded packages are
retained in the recipe stage because `cargo chef prepare` invokes `cargo metadata`
internally, which requires every workspace member's manifest to be present on
disk. This limitation and its rationale are documented in Containerfile comments.

Issue spec (T1–T3 DONE, AC4 DONE): docs/issues/open/1868-1840-workflow-performance-exclude-irrelevant-workspace-members/ISSUE.md
…scope

Address Copilot review comments on PR torrust#1872:

- Containerfile cook-stage comment: the previous wording implied that stub
  sources prevent the excluded packages' unique transitive dependencies from
  being compiled during the cook layer. In fact, dependency compilation is
  driven by Cargo.toml manifests (already in the recipe), not by stub sources.
  Reworded to make clear that the cook layer still compiles those packages,
  and that the build-time savings come from the archive/build stages where
  `--exclude` is applied to `cargo nextest archive`.

- ISSUE.md T2 task label: renamed from "Add `--exclude` flags to all
  Containerfile cargo commands" to "Add `--exclude` flags to all `cargo
  nextest archive` commands in Containerfile" to match what was actually done
  (only the nextest archive commands were updated; chef cook/prepare cannot
  accept `--exclude`).
@josecelano
josecelano force-pushed the 1868-1840-exclude-irrelevant-workspace-members branch from 14e8b37 to baf6c8d Compare June 3, 2026 12:15
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.76%. Comparing base (cbaa726) to head (baf6c8d).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1872   +/-   ##
========================================
  Coverage    77.76%   77.76%           
========================================
  Files          382      382           
  Lines        28637    28637           
  Branches     28637    28637           
========================================
  Hits         22270    22270           
  Misses        6059     6059           
  Partials       308      308           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josecelano

Copy link
Copy Markdown
Member Author

ACK baf6c8d

@josecelano
josecelano merged commit 5cb7718 into torrust:develop Jun 3, 2026
18 checks passed
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.

Exclude irrelevant workspace members from container build

2 participants