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

Trouble with uncommitted changes in Cargo.lock with release-plz update #1286

Closed
sdwilsh opened this issue Feb 21, 2024 · 2 comments · Fixed by #1294
Closed

Trouble with uncommitted changes in Cargo.lock with release-plz update #1286

sdwilsh opened this issue Feb 21, 2024 · 2 comments · Fixed by #1294
Labels
bug Something isn't working

Comments

@sdwilsh
Copy link

sdwilsh commented Feb 21, 2024

Bug description

In a newly setup configuration, CI and release-plz update fails with:

Error: failed to determine next versions

Caused by:
    the working directory of this project has uncommitted changes. Please commit or stash these changes:
    ["Cargo.lock"]

I'm fairly new to Rust, so it's very possible I'm just doing it wrong, but I get no changes to Cargo.lock when I run cargo update, so I'm not sure why Cargo.lock is becoming dirty when release-plz runs. The temporary directory that release-plz clones into gets deleted, which makes it hard to debug what the changes might be as well (having a flag to let it hang around might be a feature request I can file if there is interest).

  • Would you like to work on a fix? yes, even if it's to improve the docs to make whatever mistake I might have made more clear

To Reproduce

Steps to reproduce the behavior:

1. git clone https://github.com/sdwilsh/jellyfin-remote-proxy.git
2. cd jellyfin-remote-proxy
3. release-plz update

Expected behavior

The CI workflow and release-plz update runs successfully.

Environment

  • OS: Ubuntu 22.04
  • release-plz version: 0.3.45

Additional context

My workflow is copied verbatim from the docs, with a version selector added there, and you can see this failing in CI as well here.

@sdwilsh sdwilsh added the bug Something isn't working label Feb 21, 2024
@MarcoIeni
Copy link
Owner

The issue is that your Cargo.lock is committed, but it is also in .gitignore.
I have seen many users do this mistake.
If you want to open a PR to add this check here (just before the if) it would be awesome!

You should check if Cargo.lock is present and if it is in the .gitignore file.
You can find the path of the Cargo.lock by using the input.local_manifest field. I.e. you just need to change the file extension: Cargo.toml -> Cargo.lock.
You could also add an integration test for this. You can take inspiration from:

@sdwilsh
Copy link
Author

sdwilsh commented Feb 22, 2024

I have seen many users do this mistake.

That's probably because it's what cargo generated, and I didn't read the comment where it says you need to remove it if it's a binary!

I'll keep this open to add better messaging per your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants