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

Failed to update workspace packages #1360

Closed
orhun opened this issue Mar 24, 2024 · 19 comments · Fixed by #1496
Closed

Failed to update workspace packages #1360

orhun opened this issue Mar 24, 2024 · 19 comments · Fixed by #1496
Labels
bug Something isn't working

Comments

@orhun
Copy link
Contributor

orhun commented Mar 24, 2024

Bug description

In my daktilo project I switched to workspaces (split the crate into 2 crates) and now release-plz errors with:

     Updating crates.io index
note: Downloading daktilo 0.5.0
 Downloading crates ...
  Downloaded daktilo v0.5.0
note: Cloning into "/tmp/.tmpUPqxNn"
  2024-03-24T13:37:32.693781Z  WARN  Package `daktilo_lib@*.*.*` not found
    in download with self=PackageDownloader { packages: ["daktilo", "daktilo_lib"], directory: "/tmp/.tmpUPqxNn", registry: None, cargo_cwd: None }
    in next_versions
    in update
    in release_pr

  2024-03-24T13:37:33.303035Z ERROR  failed to update packages

Caused by:
    0: failed to determine next versions
    1: failed to retrieve difference between packages
    2: cannot compare README files
    3: cannot determine hash of "/tmp/.tmp7VfYce/daktilo/crates/daktilo/../../README.md"
    4: No such file or directory (os error 2)

Error: failed to update packages

Caused by:
    0: failed to determine next versions
    1: failed to retrieve difference between packages
    2: cannot compare README files
    3: cannot determine hash of "/tmp/.tmp7VfYce/daktilo/crates/daktilo/../../README.md"
    4: No such file or directory (os error 2)

It might be about:

[package]
name = "daktilo"
readme.workspace = true
# <strip>

But I'm not sure.

  • Would you like to work on a fix? - if possible

To Reproduce

See the CI workflow: https://github.com/orhun/daktilo/blob/main/.github/workflows/cd.yml

Example run: https://github.com/orhun/daktilo/actions/runs/8409724309/job/23027336861

Expected behavior

No errors.

Environment

Additional context

None.

@orhun orhun added the bug Something isn't working label Mar 24, 2024
@MarcoIeni
Copy link
Owner

something bad is going on here.

Possible solutions:

  • return true if local_package_readme_path doesn't exist. Not sure if this is the correct thing to do.
  • return true if cannot compare README files and emit a warning. Probably this is the best short-term solution, so we fix this bug soon. In the next weeks I'll try to understand what's the real bug. Do you want to submit a PR with this fix?

@MarcoIeni
Copy link
Owner

Also, this code was introduced in 0.3.51 so maybe you can use version v0.5.44 of the action: MarcoIeni/[email protected] as a temporary workaround

@orhun
Copy link
Contributor Author

orhun commented Mar 24, 2024

Hey, I'm happy to work on it but unfortunately I couldn't reproduce this locally. I've tested the latest master and release subcommand worked fine :/

Using MarcoIeni/[email protected] seems like it will work, but I hit another issue.

https://github.com/orhun/daktilo/actions/runs/8411834568/job/23031905810

I am embedding some folders into the binary and release-plz looks for the wrong path for them. So I patched it in the workflow in this commit.

But now it says that project has uncommitted changes.

https://github.com/orhun/daktilo/actions/runs/8411897970/job/23032042405

Is there a way to pass --dry-run to release-plz-action?

@MarcoIeni
Copy link
Owner

The issue is in the update command, not release

@MarcoIeni
Copy link
Owner

Is there a way to pass --dry-run to release-plz-action?

You can add

[workspace]
allow_dirty = true

to the config file

@orhun
Copy link
Contributor Author

orhun commented Mar 25, 2024

allow_dirty = true

Tried this in orhun/daktilo@1fba8ed

But it didn't work:

error: 1 files in the working directory contain changes that were not yet committed into git:
src/embed.rs
to proceed despite this and include the uncommitted changes, pass the `--allow-dirty` flag

https://github.com/orhun/daktilo/actions/runs/8426534601/job/23075046031

@Boshen
Copy link

Boshen commented Mar 30, 2024

I'm also facing this issue, and here's an observation:

note: Cloning into "/tmp/.tmpUPqxNn"

    3: cannot determine hash of "/tmp/.tmp7VfYce/daktilo/crates/daktilo/../../README.md"

Notice these two tmp folders are different 😁

@MarcoIeni
Copy link
Owner

Sorry about it, I will try to fix this in the following days

@Boshen
Copy link

Boshen commented Apr 2, 2024

@MarcoIeni If you need a reproduction:

https://github.com/boshen/criterion2.rs

criterion2.rs  main ❯ ~/.cargo/bin/cargo-release-plz update
  2024-04-02T08:09:31.952062Z  INFO  using release-plz config file release-plz.toml

  2024-04-02T08:09:32.169519Z  INFO  downloading packages from cargo registry
    in download with self=PackageDownloader { packages: ["criterion2"], directory: "/var/folders/30/cmv9c_5j3mq_kthx63sb1t5c0000gn/T/.tmpehLfBs", registry: None, cargo_cwd: None }
    in next_versions
    in update

note: Cloning into "/var/folders/30/cmv9c_5j3mq_kthx63sb1t5c0000gn/T/.tmpehLfBs"
    Updating crates.io index
note: Downloading criterion2 0.6.0
  2024-04-02T08:10:11.932836Z ERROR  failed to determine next versions

Caused by:
    0: failed to retrieve difference between packages
    1: cannot compare README files
    2: cannot determine hash of "/var/folders/30/cmv9c_5j3mq_kthx63sb1t5c0000gn/T/.tmpRQERx3/criterion2.rs/README.md"
    3: No such file or directory (os error 2)

Error: failed to determine next versions

Caused by:
    0: failed to retrieve difference between packages
    1: cannot compare README files
    2: cannot determine hash of "/var/folders/30/cmv9c_5j3mq_kthx63sb1t5c0000gn/T/.tmpRQERx3/criterion2.rs/README.md"
    3: No such file or directory (os error 2)

@MarcoIeni
Copy link
Owner

Your projects should now work, I'll keep this issue open, because when comparing the readme there's a bug if the README path was specified after the package was released last time.
In theory we should read the readme field from Cargo.toml at every commit.

@Sec-ant
Copy link

Sec-ant commented May 6, 2024

Hello, @MarcoIeni we're encountering similar issues in this workflow run: https://github.com/getgrit/gritql/actions/runs/8967214489/job/24624285671. In short, release-plz reports uncommitted changes of several submodule paths. The submodules are all checked out in the github action. We wonder if this is a misconfiguration on ourside or a bug in release-plz.

Related PR to use allow_dirty = true as a workaround: getgrit/gritql#313

@MarcoIeni
Copy link
Owner

MarcoIeni commented May 6, 2024

I will look into this! Hopefully I'll find some time this week.
Also, the error message you are getting now (Is a directory (os error 21)) is pretty bad, I'm sorry!
Maybe somewhere we are using fs instead of fs_err.
Btw, release-plz update works well locally for me (after running git submodule update --init), so maybe you can run it locally as a workaround for now :/

@Sec-ant
Copy link

Sec-ant commented May 7, 2024

I will look into this! Hopefully I'll find some time this week.
Also, the error message you are getting now (Is a directory (os error 21)) is pretty bad, I'm sorry!
Maybe somewhere we are using fs instead of fs_err.
Btw, release-plz update works well locally for me (after running git submodule update --init), so maybe you can run it locally as a workaround for now :/

Yes, after allowing dirty files we can run release-plz locally. But like you said it's getting the "is a directory" error when running in GitHub Actions. And I'm also curious why dirty files have to be allowed in our repo.

Thanks in advance for your work!

@MarcoIeni
Copy link
Owner

I released a new version of release-plz where I improved the error messages of the file system ( #1450 )
Let me know if the error message Is a directory (os error 21) looks different next time you merge a PR 👍
Hopefully we get more insights and find the root cause.

One more thing: are you able to reproduce the bug locally when running release-plz release-pr --git-token XXX?

@MarcoIeni
Copy link
Owner

MarcoIeni commented May 11, 2024

image
now the error is a bit better, but it's not clear why release-plz is trying to read that file. I need to add more info to the error messages.

EDIT: imo the error is here
Let's see once I deploy the new release-plz :)

@Sec-ant
Copy link

Sec-ant commented May 12, 2024

image now the error is a bit better, but it's not clear why release-plz is trying to read that file. I need to add more info to the error messages.

EDIT: imo the error is here Let's see once I deploy the new release-plz :)

Thank you again for your time into debugging this ❤️. I don't know if it helps but that tree-sitter-php file is actually a git submodule, maybe there're some unexpected problems?

One more thing: are you able to reproduce the bug locally when running release-plz release-pr --git-token XXX?

Sorry I'm just an ordinary contributor so it seems I don't have the permission to test it in that repo.

@MarcoIeni
Copy link
Owner

I see 👍
I released the new version with more error context. Let's see how the error shows.

@MarcoIeni
Copy link
Owner

I released yet another version. The release contains #1461 which should fix gritql 👍
So I expect the next commit they do to create a release pr 👍

@Sec-ant
Copy link

Sec-ant commented May 15, 2024

I released yet another version. The release contains #1461 which should fix gritql 👍 So I expect the next commit they do to create a release pr 👍

A release PR is successfully created, thank you!

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.

4 participants