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

Fix installing our xgettext-js fork using Yarn v4 #3258

Merged
merged 2 commits into from
May 9, 2024

Conversation

yvanzo
Copy link
Contributor

@yvanzo yvanzo commented May 8, 2024

Problem

For some reason, installing node modules using Node.js 20.13.0 that brings Yarn 4.0.1 would fail with the following error message:

xgettext-js@https://github.com/metabrainz/xgettext-js.git#commit=0301681a479c1796ff6850c9bd2a169074386d92: The remote archive doesn't match the expected checksum

It is unclear which version(s) and on which platform(s) would fail here. (It fails in macOS and Docker Composed Ubuntu Jammy, but it works in ArchLinux and CircleCI Dockerized Ubuntu Jammy.) When failing, the following key was added to xgettext-js’ package.json:

"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"

It seems that it was the only difference in the installed files, thus affecting the checksum of the fetched package xgettext-js.

Solution

To fix this issue I have upgraded our xgettext-js fork to Yarn v4 too, in order to avoid this and have the same checksum on all platforms.

To update the checksum in yarn.lock file, I have temporarily set checksumBehavior key to update in .yarnrc.yml file and run yarn.

References:

Additional change

Upgrade Yarn version to the latest 4.2.2

References:

Testing

xgettext-js’ fix

  • Using Node 20.13.0 / Yarn 4.0.1 on Ubuntu Jammy through our Docker Compose project.
  • Using the same Node/Yarn/Ubuntu versions through our CircleCI tests; See the build 19770.

yarn’s update

  • Using Node 20.13.0 / Yarn 4.2.2 on Ubuntu Jammy through our Docker Compose project.
  • Using the same Node/Yarn/Ubuntu versions through our CircleCI tests; See the build 19771.

@yvanzo
Copy link
Contributor Author

yvanzo commented May 8, 2024

Now the error is showing up in CI test instead:

➤ YN0018: │ @metabrainz/xgettext-js@https://github.com/metabrainz/xgettext-js.git#commit=0301681a479c1796ff6850c9bd2a169074386d92: The remote archive doesn't match the expected checksum

@yvanzo yvanzo marked this pull request as draft May 8, 2024 14:49
@yvanzo yvanzo changed the base branch from master to schema-change-2024-q2 May 8, 2024 15:11
@yvanzo yvanzo changed the base branch from schema-change-2024-q2 to master May 8, 2024 15:12
@yvanzo yvanzo force-pushed the fix-xgettext-js branch 4 times, most recently from dada56f to 1a26b23 Compare May 9, 2024 09:41
@yvanzo yvanzo changed the title Fix installing xgettext-js using yarn 4.0.1 Fix installing our xgettext-js fork using Yarn v4 May 9, 2024
For some reason, installing node modules using Node.js 20.13.0 that
brings Yarn 4.0.1 would fail with the following error message:

    xgettext-js@https://github.com/metabrainz/xgettext-js.git#commit=0301681a479c1796ff6850c9bd2a169074386d92: The remote archive doesn't match the expected checksum

It is unclear which version(s) and on which platform(s) would fail here.
(It fails in macOS and Docker Composed Ubuntu Jammy, but
it works in ArchLinux and CircleCI Dockerized Ubuntu Jammy.)
When failing, the following key was added to xgettext-js’ package.json:

    "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"

It seems that it was the only difference in the installed files, thus
affecting the checksum of the fetched package xgettext-js.

To fix this issue I have upgraded our xgettext-js fork to Yarn v4 too,
in order to avoid this and have the same checksum on all platforms.

To update the checksum in `yarn.lock` file, I have temporarily set
`checksumBehavior` key to `update` in `.yarnrc.yml` file and run `yarn`.

References:

* https://yarnpkg.com/configuration/manifest#packageManager
* https://yarnpkg.com/configuration/yarnrc#checksumBehavior
@yvanzo yvanzo marked this pull request as ready for review May 9, 2024 10:53
@yvanzo
Copy link
Contributor Author

yvanzo commented May 9, 2024

Finally found a solution that works in both Docker Compose and CircleCI at least.
Additionally updating Yarn version to the latest 4.2.2.
I updated the pull request’s description accordingly.
Any Selenium test failure is irrelevant.

Note that building Docker images without this patch is currently failing too; See build 1055 for example.

Copy link
Member

@mwiencek mwiencek left a comment

Choose a reason for hiding this comment

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

Thanks, it's working for me on macOS now. :)

When failing, the following key was added to xgettext-js’ package.json:

In my case I noticed that the package downloaded to ~/.yarn/berry/cache was not of the fork (i.e., it had none of the hermes-parser changes), which is odd.

@yvanzo
Copy link
Contributor Author

yvanzo commented May 9, 2024

Thanks, it's working for me on macOS now. :)

Phew!

In my case I noticed that the package downloaded to ~/.yarn/berry/cache was not of the fork (i.e., it had none of the hermes-parser changes), which is odd.

That’s very odd and a second unexplained mystery. After you mentioned it, I did check the content of the installed packages if updating the checksum instead of erroring in both my setup and SSHed CircleCI job, and both had the right fork using hermes-parser.

I guess that it takes a pair of deep mysteries to make a breathtaking yarn. Happily, we can now breath again.

@yvanzo yvanzo merged commit d2c5631 into metabrainz:master May 9, 2024
2 checks passed
@yvanzo yvanzo deleted the fix-xgettext-js branch May 9, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants