-
Notifications
You must be signed in to change notification settings - Fork 28
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
cachi2 yarn: prefetch dependencies for regular workflow #342
cachi2 yarn: prefetch dependencies for regular workflow #342
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think we should unit test the _fetch_dependencies
function, even though we'll likely end up with a very basic test that essentially guarantees that the function parameters are being handled correctly.
|
We should also make the run_yarn_cmd function fully functional. It is currently still returning a |
# the output_dir is where the globalFolder must be set to | ||
# the yarn commands can be called by using the core.utils.run_cmd function | ||
pass | ||
cachi2_output = output_dir.join_within_root("deps", "yarnberry") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any opinions on the file path? It's not technically public API since the output directory structure should be considered opaque, but users will most likely see these paths somewhere, e.g. source containers once RHTAP implements them
If Yarn Berry is the version of Yarn for us, we should probably just call it deps/yarn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Yarn Berry is the version of Yarn for us, we should probably just call it deps/yarn
Without having literally any knowledge of Yarn, if there are multiple versions/flavours of Yarn packaging you already do support or may support in the future deps/yarn
will bite us in the back for sure. We should either refer to it by the official name (some lowercase name variant) or yarn + version if those are a thing by which it could be determined whether it's Yarn berry or something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for users, if it's not part of the official public API, it doesn't matter at all as the paths are bound to change in that case, so whatever they do on them/expect from them is irrelevant in that case, so we're free to alter it to our liking. Of course the question then is whether we should make these deps paths officially part of the API so we guarantee them - which we should do if we refer to them in any shape or form in the docs... just my 2c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's yarn v1: https://classic.yarnpkg.com/en/docs
And yarn v2+: https://yarnpkg.com/
The official name for both is Yarn, but they might as well be two entirely different package managers. V1 is sometimes referred to as Yarn Classic, v2+ as Yarn Berry.
Yarn v1 is supported in Cachito but not in Cachi2, v2+ is not supported in Cachito and will be in Cachi2. There is some hope that we wouldn't have to implement v1 in Cachi2, but I'm not among the optimists 😄
In Cachito Yarn v1 deps went to deps/yarn
, but I don't think we need to keep backwards compatibility with those, they never mattered to any system or user AFAIK. (At least the deps/yarn
part of the filepath didn't, the files themselves did)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course the question then is whether we should make these deps paths officially part of the API so we guarantee them - which we should do if we refer to them in any shape or form in the docs... just my 2c
True, we should probably consider changes in the path as breaking changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a separate matter of what do we call the package manager in the cachi2 input (now this very much is public API)
cachi2 fetch-deps yarn
?
cachi2 fetch-deps yarnberry
?
But maybe cachi2 should be smart, accept only yarn
and auto-detect which yarn it is. We had a story in the backlog to figure this out, but deferred it because yarn v1 support may not be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TLDR: deps/yarn
is fine by me 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not expect such a long discussion about the file path 😄
Should I rename YarnBerryError to YarnError to keep it consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I rename YarnBerryError to YarnError to keep it consistent?
To me, that makes sense 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I rename YarnBerryError to YarnError to keep it consistent?
Yeah, I think dropping Berry from the name makes sense. The error message is probably generic enough to be usable for all flavours of yarn anyway. Maybe call it YarnCommandError though, YarnError seems too generic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM apart from the output directory name 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
For future reference, here's what I imagine a commit message for a change like this could look like
Though some parts of this probably wouldn't be necessary if they were code comments The current commit message also says YarnBerryError rather than YarnCommandError |
* with new custom YarnCommandError * covered with unit tests JIRA: STONEBLD-1788 Signed-off-by: Michal Šoltis <[email protected]>
Maybe we could start using any commit message template or pre-commit or something that is automated. I scrolled down commit history a little bit and I rarely saw such a verbose commit message (except for your commits 😄 ). Mostly it was a JIRA ticket number and even for larger PRs than this one. WDYT ? |
To take effect, this needs to be defined in some kind of contributor guidelines which we currently don't have, but yeah, totally in agreement. |
You'd have to use AI to provide any meaningful gist for the commit subject, we're not there yet :). Writing good commit messages is a skill worth having rather than trying to automate it. Think of it as a way of explaining your changes to a real person.
The fact that the commit history is scarce in detailed information in this case must not serve as a precedent preventing adoption of an improvement in the future. Projects and communities evolve gradually :). |
I am sorry, I meant that the check of the commit message would automated at least at some form. I think it would be fine for consistency of all commits. Since check in the PR template is quite subjective. Second point, I did not want to sound it like an excuse, but I feel like I am the only one who is blamed for commit messages. |
I don't think verbosity is always needed, but the message does need to describe what the change does and explain things that are not obvious from the code or comments. For more complex changes, the message should help the reviewer understand what they're getting into. It absolutely is subjective as you said, and we're not always good at enforcing the checklist. Sorry if it looks like you're the only one getting called out for non-descriptive commits 😞 (I'm pretty sure others do as well) Using a commit message template could be a good idea 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
One more thing...In this PR I should split the one commit into probably two (implement YarnCommandError and implement fetching), but usually I make changes along the discussion (which is completely fine), and then I would have to rearrange commits as well, which is not always straightforward so it leads to one or more big commits where I have to explain everything. I wish I could do it better from the beginning. Thats the skill I want to have. I think it would not lead to those kind of discussions. But anyaway, I agree that something like commit template is a good idea. Thats my final words. :drop-the-mike: |
Do you use
Can you look into that, or bring it up in a team discussion? |
Maintainers will complete the following section