Skip to content

[feature] Repeated installation of trusted-signing-cli causes Cargo error #1850

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

Open
TadasMil opened this issue Mar 3, 2025 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@TadasMil
Copy link

TadasMil commented Mar 3, 2025

Is your feature request related to a problem? Please describe.

In our CI/CD pipeline, every time we run moon ci, MoonRepo re-installs all configured binaries. In the case of trusted-signing-cli, this results in Cargo throwing an error because the binary already exists:

▪▪▪▪ cargo binstall
 INFO resolve: Resolving package: 'trusted-signing-cli'
 WARN The package trusted-signing-cli v0.5.0 will be installed from source (with cargo)
    Updating crates.io index
error: binary `trusted-signing-cli` already exists in destination
Add --force to overwrite
ERROR Cargo errored! ExitStatus(unix_wait_status(25856))

Describe the solution you'd like

It would be great if MoonRepo could either:

  • Automatically detect that the binary already exists and either skip the installation step, or
  • Provide an option to automatically pass the --force flag for certain binaries in the configuration (for example, via an additional property for each bin).

Ideally, this behavior should be configurable per binary, allowing users to decide whether to force reinstall or simply skip if the binary is already present.

Describe alternatives you've considered

- 'trusted-signing-cli --force'

Additional context

.toolchain.yml:

rust:
  version: '1.85.0'
  syncToolchainConfig: true
  targets: ['x86_64-pc-windows-msvc']
  bins: ['cargo-watch', '[email protected]', 'cargo-xwin', 'trusted-signing-cli']
  components: ['rustfmt', 'rust-analyzer']
@TadasMil TadasMil added the enhancement New feature or request label Mar 3, 2025
@milesj
Copy link
Collaborator

milesj commented Mar 3, 2025

I'm actually surprised cargo/binstall exit with an error in this situation. I'll look into a work around.

For the time being, we do support a force option for bins: https://moonrepo.dev/docs/config/toolchain#bins-1

@milesj
Copy link
Collaborator

milesj commented Mar 3, 2025

So it looks like binstall doesn't error if the package already exists:

 ~/Projects/moon   fixes-0303 ±  cargo binstall cargo-nextest
 INFO resolve: Resolving package: 'cargo-nextest'
 INFO resolve: cargo-nextest v0.9.92 is already installed, use --force to override
 INFO Done in 841.440792ms
 ~/Projects/moon   fixes-0303 ±  cargo binstall cargo-nextest
 INFO resolve: Resolving package: 'cargo-nextest'
 INFO resolve: cargo-nextest v0.9.92 is already installed, use --force to override
 INFO Done in 509.549625ms

I guess this error is because trusted-signing-cli already exists and wasn't installed through binstall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants