-
Notifications
You must be signed in to change notification settings - Fork 35
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
Expose the hashes based on content for locally-modified modules. #61
Comments
Another way to look at this issue is to consider that |
Thanks for reporting. Current behaviour is intentional. |
I want to use the hash of the content to see if the build artifact for a particular locally modified module has been built and, if so, skip it. |
Thanks for explaining what you are trying to do. After making a change in your repo, if you run Traditional build systems like Version calculation was required because, if we are building a sub-set of our repository, we may want a reliable way to associate those build artifacts to a change in the repo (commit SHA is not good enough now because it represents every module in our commit, not just the ones got built as a result of a change).
Sorry about the length of the response. Thought giving a bit of background to how If you still think the version number based on the local content is essential, feel free to have a stab. I think you'd be able to generate the modules set as per //cc @wenisman |
Ah, thanks for the background. Hmm, would that even be possible though since as you mentioned there isn’t any hash of local changes until they’re committed? Or were you thinking of a different algorithm that looks at the content of the files on disk? Also, can you please point me to where in the codebase your current “discover workspace algorithm” is implemented? Thanks! |
No problem at all. Thank you for feedback like this. Current workspace discovery code is in Line 109 in 22d3f9f
That works out all the modules based on the presence of Line 154 in 22d3f9f
I was thinking that, New function in Just food for thought anyway. There could be a simpler approach... 😄 |
Closing this for now due to inactivity. |
How about: -. commit local changes ?? Not the most elegant solution but should be straightforward. The most difficult part would be step 3, restoration of all the associated states (new files, edited files, staged files, unstaged files etc etc). Thoughts? |
That's definitely workable. However, there's a bit more elegant story to this now. Couple of weeks ago, @sergey-ostapenko did some awesome work to remove the file system walking for working out local modules. If you look at the discussion here #86, you can see a method I suggested around creating a union of modules as per head commit and currently modified items in workspace. Current implementation is much simpler than that but it does not have a way to differentiate modules that have been changed. So it is still using the fixed version string If we change the implementation to the union based one, you could technically retain the versions from HEAD tree for unmodified modules. As for modified ones, you could simply create a hash based on the content of modified files and their path. A bit more work than what you proposed I suppose, but it would be cleaner in my opinion (You might even realise an easier approach than the union if you look at @sergey-ostapenko implementation 😉 ). Let me know what you think. |
Can you elaborate on "simply create a hash based on the content of modified files and their path"? Keep in mind that I'd like the hash we compute here to ultimately match the one that git itself would compute if we were to add and commit all of the local changes (so that build optimization can occur--i.e., so that already-built modules would not be rebuilt later on). |
I am using the following script for now as a workaround. Feel free to integrate the equivalent into mbt itself:
|
Thanks for sharing your script. |
Yes, one should not have to commit in order to build. I think this sums it up (from a systems consistency perspective):
|
Which mbt command are you having troubles with?
mbt describe local
What's the current behaviour?
It returns 'local' for any modules with local modifications. This is fine but I'd like to also build some optimization in our pipeline whereby it doesn't unnecessarily rebuild things. So, exposing the "content hash" per module perhaps via
mbt hash module
would be a nice feature to have.What's the expected behaviour?
Access to the content hashes (apart from committing local changes and then calling
mbt describe head
could be made available.The text was updated successfully, but these errors were encountered: