Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't cargo publish --workspace --dry-run if the versions already exist #14789

Closed
epage opened this issue Nov 6, 2024 · 1 comment · Fixed by #14847
Closed

Can't cargo publish --workspace --dry-run if the versions already exist #14789

epage opened this issue Nov 6, 2024 · 1 comment · Fixed by #14847
Labels
A-workspaces Area: workspaces C-bug Category: bug Command-publish S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review Z-package-workspace Nightly: package-workspace

Comments

@epage
Copy link
Contributor

epage commented Nov 6, 2024

Problem

In testing #1169 on cargo release now that #14721 is fixed, I came across another way you can't dry-run existing versions: the overlay registry blocks it

[2024-11-06T21:50:26Z TRACE cargo_release::ops::cmd] /home/epage/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/b
in/cargo publish --manifest-path /home/epage/src/personal/clap/clap_lex/Cargo.toml -Zpackage-workspace --package clap_
lex --package clap_builder --package clap_derive --package clap --package clap_complete --package clap_complete_fig --
package clap_complete_nushell --package clap_mangen --dry-run --allow-dirty
    Updating crates.io index
warning: crate clap@4.5.20 already exists on crates.io index
warning: crate clap_builder@4.5.20 already exists on crates.io index
warning: crate clap_lex@0.7.2 already exists on crates.io index
warning: crate clap_derive@4.5.18 already exists on crates.io index
warning: crate clap_complete@4.5.37 already exists on crates.io index
warning: crate clap_complete_fig@4.5.2 already exists on crates.io index
warning: crate clap_complete_nushell@4.5.4 already exists on crates.io index
warning: crate clap_mangen@0.2.24 already exists on crates.io index
   Packaging clap_lex v0.7.2 (/home/epage/src/personal/clap/clap_lex)
warning: ignoring test `testsuite` as `tests/testsuite/main.rs` is not included in the published package
    Packaged 8 files, 42.9KiB (12.5KiB compressed)
   Packaging clap_builder v4.5.20 (/home/epage/src/personal/clap/clap_builder)
    Packaged 62 files, 914.9KiB (160.0KiB compressed)
   Packaging clap_derive v4.5.18 (/home/epage/src/personal/clap/clap_derive)
    Packaged 22 files, 162.1KiB (29.4KiB compressed)
   Packaging clap v4.5.20 (/home/epage/src/personal/clap)
warning: ignoring test `builder` as `tests/builder/main.rs` is not included in the published package
warning: ignoring test `derive` as `tests/derive/main.rs` is not included in the published package
warning: ignoring test `derive_ui` as `tests/derive_ui.rs` is not included in the published package
warning: ignoring test `examples` as `tests/examples.rs` is not included in the published package
warning: ignoring test `macros` as `tests/macros.rs` is not included in the published package
warning: ignoring test `ui` as `tests/ui.rs` is not included in the published package
    Updating crates.io index
error: failed to prepare local package for uploading

Caused by:
  failed to get `clap_builder` as a dependency of package `clap v4.5.20 (/home/epage/src/personal/clap)`

Caused by:
  found a package in the remote registry and the local overlay: clap_builder@4.5.20

Steps

$ cargo install cargo-release
$ git clone git@github.com:clap-rs/clap.git
$ cd clap
$ cargo +nightly publish -Zpackage-workspace --package clap_
lex --package clap_builder --package clap_derive --package clap --package clap_complete --package clap_complete_fig --
package clap_complete_nushell --package clap_mangen --dry-run --allow-dirty

Possible Solution(s)

Remove the restriction on the overlay which comes at the risk of it being abused.

Notes

No response

Version

cargo 1.84.0-nightly (0310497 2024-11-01)

@epage epage added A-workspaces Area: workspaces C-bug Category: bug Command-publish S-needs-team-input Status: Needs input from team on whether/how to proceed. Z-package-workspace Nightly: package-workspace labels Nov 6, 2024
@ehuss ehuss added S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review and removed S-needs-team-input Status: Needs input from team on whether/how to proceed. labels Nov 19, 2024
@epage
Copy link
Contributor Author

epage commented Nov 21, 2024

In addition to being accepted, wanted to record some notes from the team's discussion

  • We considered making this a lint or flag but those aren't generally dynamic which this would need. Granted, --ignore-rust-version is kind of like that.
  • While we want to be cautious about what behavior we allow for this Source, this is still all internal, so it should be good.
  • The current error is more strict than the single-package case, so removing the error brings them inline with each other
  • The important thing is that we warn which we should already get from fix(publish): Downgrade version-exists error to warning on dry-run  #14742

epage added a commit to epage/cargo that referenced this issue Nov 21, 2024
epage added a commit to epage/cargo that referenced this issue Nov 21, 2024
epage added a commit to epage/cargo that referenced this issue Nov 21, 2024
epage added a commit to epage/cargo that referenced this issue Nov 21, 2024
epage added a commit to epage/cargo that referenced this issue Nov 21, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 21, 2024
### What does this PR try to resolve?

A dry-run release process won't be bumping the versions, making it so it
can't do a dry-run publish because the local/remote registries will
collide. This switches it to give the local registry precedence over the
remote registry to make the dry-run release process work.

Fixes #14789

### How should we test and review this PR?

### Additional information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-workspaces Area: workspaces C-bug Category: bug Command-publish S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review Z-package-workspace Nightly: package-workspace
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants