-
-
Notifications
You must be signed in to change notification settings - Fork 35
Stone lockfiles #549
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
base: main
Are you sure you want to change the base?
Stone lockfiles #549
Conversation
|
Out of curiousity, if we can generate a lock file, could we not also update the fields in the recipe itself where they're immediately visible (instead of hidden away)? |
Yes that is a valid approach to consider as well. My thinking was to treat the The pattern is pretty common in other package manager (Cargo.toml / Cargo.lock, package.json / package-lock.json) and it felt like a good model to follow here too and keeps the |
|
Would be out of scope for this PR, but would you see anything else that we would want to resolve the state of during / after the build process, e.g., versions of |
|
If we do adopt a lock file approach, it may be beneficial to include some metadata in the lock file, at the very least a version string |
Question to @ermo: Do we want to do breaking changes at this point? I tend to prefer smooth transitions with deprecation warnings and such. Of course a little bit more implementation work, but probably not actually that much here? |
|
Regarding breaking changes, the repo is currently small enough that I think that, in general, any breaking changes that we do need a follow up PR in the recipes repo to fix the fallout. This is also the reason that we have a separate repo named "volatile" -- there is no guarantee that this repo will be in a working state. That said, a smooth transition process with deprecation warnings does sound like a nice thing to have, particularly in a production-ready setting. For now, while we are still alpha, I am asking myself if we want to be constrained by such a process? In some ways, if the tooling goes "I'm sorry Dave, I'm afraid I can't do that. However, if we do it this way, you're good to go.", then that would essentially be the deprecation warning and the smooth process? Comments and input welcome. Regarding the lock-file, the manifest is in many ways similar to that. We have already seen one user vociferously complain that, in their opinion:
My thinking is that we need to consider the following design properties:
In summary, it seems to me that we have an opportunity to rethink our approach as it relates to both the discovery process itself, and how we capture/encode that in a git friendly way without losing the "proof of build" guarantees associated with recipe updates. |
|
Thanks for looking into this. I appreciate the context. TBH I haven't looked into the manifest details at all yet, so feel free to correct me, but it sounds like there's definitely some overlap between what manifests and lock files are trying to solve and there is opportunity to unify these concepts into something more ergonomic. I'm pretty much on board with the user feedback you mentioned:
I think if we migrated to a single text-based If the main reason for choosing binary was to prevent people from circumventing local builds, I think CI can solve that problem just as effectively. And I don't see any reason why a lock file couldn't capture installed files too. We could enforce that the submitted
I think this is a shared responsibility. Of course I would expect anyone contributing changes to test that it works, but ultimately we do need to provide a mechanism to verify that was done (hence CI checks and branch protection). This gives automated feedback to the contributor if they've done something obviously wrong or unacceptable.
I'm not familiar with the infra setup, but could this potentially work through CI with self-hosted runners? Just thinking out loud. One other thought: since you mentioned auto-discovery for ergonomics, we could probably auto-discover hashes for plain upstreams and store those in the lock file too. Approach-wise, we could merge this PR as-is to get the lock file foundation in place, then tackle the manifest migration incrementally. Keep both systems running in parallel and incrementally add lock file generation for the same data currently in manifests. We could probably compress the full migration into 2-3 PRs? |
Closes #109 Replaces #547
Introduces a
stone.lockfile in an effort to make builds reproducible in the case of git tags / branches being re-pointed to different commits.Changes to recipes
This is a breaking change and will require any recipes that use git upstreams with tags to be specified using the
tagkey.Before:
After:
Packagers can also specify the
rev(commit hash) directly or through therevkeyLike this:
Or this:
A
branchkey is also possible, but only one oftag,branchorrevcan be provided in thestone.yamlLock File Design
builder buildon a recipe with a gittagorbranch, it resolves it to a specific commit hash (rev) at that momenttagor abranchwill be recorded in the lock filestone.lockfile in the same directory as the provided recipe file only after the build succeedsboulderwill use that locked commit hash from the stone.lock (and provide a warning message if the resolved hash does not match the lock file)Example
stone.lockgenerated for theaomrecipeFuture Considerations
This brings up a question for a follow-up discussion: How should a developer intentionally update the lock file if a tag or branch has been updated on the remote and they want the new version?
Currently, the only way to refresh the commit hash would be to manually delete the stone.lock file and run the build again.
Should we create a dedicated command for this like
boulder lock --update, or should we expand the scope of an existing command likeboulder recipe updateto also handle refreshing the lock file?Just deleting the file and rebuilding doesn't necessarily seem like a bad option either, but open to thoughts on the best path forward here.