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

Simplify the way yarn-install action ensures yarn.lock stays unchanged after yarn install #369

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

ascrazy
Copy link
Contributor

@ascrazy ascrazy commented Dec 28, 2024

Background

I have faced a problem integrating yarn-install action into tracker-front where we have yarn.lock that gets all packages through registry.yarnpkg.com, so not a single mention of registry.npmjs.com is there, and this leads to Change registry in yarn.lock file to npm Artifact Registry step failing with an error (e.g. https://github.com/toptal/tracker-front/actions/runs/12527127099/job/34940394300?pr=3264)

Initially tried to hunt down and fix this specific problem, but debugging this quite complex bash script came to conclusion it's kind of overengineered and we can achieve the same behavior with much more simple and even more performant implementation. Thus this is my suggestion

Description

The idea if existing implementation is that after running yarn install we process entire yarn.lock and undo any registry overrides that we've done previously so we can compare yarn.lock after yarn install to one in git index.

The idea of updated implementation is that we capture checksum of the yarn.lock right before running yarn install (with overridden URLs) and compare it to checksum after yarn install

How to test

Development checks

  • Add changeset according to guidelines (if needed)
PR commands

List of available commands:

  • @toptal-anvil ping reviewers - Ping teams for review

Copy link

changeset-bot bot commented Dec 28, 2024

🦋 Changeset detected

Latest commit: e11f730

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
davinci-github-actions Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ascrazy ascrazy force-pushed the fix-yarn-install-registry-override branch 2 times, most recently from 77d66a9 to 333beb4 Compare December 28, 2024 14:28
@ascrazy ascrazy changed the title Fix yarn-install's registry change step Simplify the way yarn-install action ensures yarn.lock stays unchanged after yarn install Dec 28, 2024
@ascrazy
Copy link
Contributor Author

ascrazy commented Dec 28, 2024

Hi @sashuk,

I've noticed you were involved into testing of #295 when many of those bash scripts I'm modifying here were introduced, so could you please have a look at this PR and share what do you think of my suggestion? Maybe you know any pitfalls I might be missing?

@ascrazy ascrazy force-pushed the fix-yarn-install-registry-override branch 6 times, most recently from 3cace5f to 27a3821 Compare December 31, 2024 11:03
@ascrazy ascrazy force-pushed the fix-yarn-install-registry-override branch from 27a3821 to 65c5157 Compare January 6, 2025 20:54
@ascrazy ascrazy marked this pull request as ready for review January 6, 2025 21:09
@ascrazy ascrazy requested a review from a team as a code owner January 6, 2025 21:09
@ascrazy ascrazy force-pushed the fix-yarn-install-registry-override branch 3 times, most recently from 9f7c650 to 31eab9a Compare January 7, 2025 08:16
@ascrazy ascrazy force-pushed the fix-yarn-install-registry-override branch 2 times, most recently from 4ce24b4 to d71bcaf Compare January 7, 2025 10:27
so it's more performant and less error prone
@ascrazy ascrazy force-pushed the fix-yarn-install-registry-override branch from d71bcaf to e11f730 Compare January 7, 2025 10:30
Copy link
Collaborator

@sashuk sashuk left a comment

Choose a reason for hiding this comment

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

Thank you for testing it in two apps, looks good!

@ascrazy
Copy link
Contributor Author

ascrazy commented Jan 8, 2025

I have addressed the concerns raised by @sashuk and @pudek357 and re-rested on toptal/staff-portal and on toptal/platform https://github.com/toptal/platform/actions/runs/12673183166/job/35318966291#step:11:624

@ascrazy ascrazy requested review from pudek357 and sashuk January 8, 2025 15:25
@ascrazy ascrazy requested a review from a team January 8, 2025 15:40
Copy link
Contributor

@pudek357 pudek357 left a comment

Choose a reason for hiding this comment

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

Great job!

@ascrazy ascrazy merged commit 3687c4d into master Jan 9, 2025
4 of 5 checks passed
@ascrazy ascrazy deleted the fix-yarn-install-registry-override branch January 9, 2025 06:30
@github-actions github-actions bot mentioned this pull request Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants