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
Reproducible #1335
Reproducible #1335
Conversation
This adds an x-mirage-pre-build entry in the opam file which consists of "make depend" and "mirage configure ...", useful for reproducing the unikernel: - gather and extract sources - execute configure - execute depend - execute build step - execute install step
The idea behind this PR is to embed all the required information into the opam file, so that -- similar to MirageOS 3 -- we can use the opam file (with a non-standard opam client which does the opam monorepo pull etc.) as build instructions for a unikernel. Namely, what is embedded now:
Do these changes look good for being merged? Another change in my mind is to re-add the |
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 look into the PR in details (specially about the extra-repo
variable added into #1270) and it seems good for me. The CI is green, so if it helps you to provide a reproducible for MirageOS 4, I will happy to merge it. May be a double-check from @TheLortex.
I'll comment here again once satisfied with the flow of build and rebuild. There may be some more changes needed for this. |
Thank for this work, this is very nice ! I will take some time this week to review the PR. |
With the current version, I'm satisfied that a non-interactive non-opam driver can build unikernels using the mirage-generated opam file as follows:
So, with this PR, there are several fields added to the generated opam files:
Wiht this PR, I'm able to conduct unikernel builds with orb -- which is great. I'm not yet able to conduct a rebuild (of the same binary), which should avoid the opam repository (repositories) and only use the tarballs from the opam switch export (which includes the A review of this PR would be great, I suspect that the mirage-generated opam file is not used anywhere, so these changes should be fine. |
An example opam file of the |
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.
The patch looks good, and indeed won't break anything as currently nothing makes use of the generated opam file. I have added two small comments.
Additionally, I think we should either (or both):
- document how to use the opam file with these extra fields. Maybe in
opam.mli
- provide a minimal driver that is able to build an unikernel from the opam definition. This would enable having a command such as
mirage-install https://git.robur.io/hannes/test-opam/raw/branch/main/packages/mirage-unikernel-hello-hvt.0.0.1/opam
ormirage install <OPAM FILE PATH>
depending on if we want that feature in the mirage tool or as an additional binary.
What do you think ?
Thanks for your review and comments. I addressed your minor comments in subsequent commits.
Is such a documentation in opam.mli worth it? I'm more into writing a post for our website that describes these extra fields and how they can be used.
I've no clue what a "minimal driver" is. From my perspective, orb (the opam reproducible builder) is the minimal application that takes such an mirage-generated opam file as input and outputs a unikernel binary (and sufficient information to reproduce the exact same binary). If you like to develop something even smaller (mirage install?), please give it a try. For me, orb is mostly unrelated and independent of mirage -- thus its dependency cone does neither include "mirage" nor "opam" being available on the host system (and thus can be used in minimal systems (jail/container). |
A blog post would be nice indeed. It's just that the link between these fields and orb or reproducible builds is not clear for the unsuspecting user that woud look into these generated files, definitely that's not critical though.
I've looked into your MirageOS 4 work for |
Thanks @TheLortex, I'll merge and cut a release soon. |
… (4.2.0) CHANGES: #### Fixed - Remove non-existing mirage-repo-add and mirage-repo-rm from PHONY in generated Makefile (mirage/mirage#1332, @hannesm) - Update deprecated references (mirage/mirage#1337, @reynir) #### Changed - Prepare for reproducing unikernels with generated opam file (mirage/mirage#1335, @hannesm) - split x-mirage-configure (mirage configure), x-mirage-pre-build (make lock pull), and build instructions in opam file - embed x-mirage-extra-repo (a list of opam repositories to use) - take relative paths up to git repository into account - include x-mirage-opam-lock-location (relative to git repository root) - Adapt constraints for mirage-solo5 0.9.0 and mirage-xen 8.0.0 (ocaml-solo5 0.8.1 with trim and improved memory metrics) (mirage/mirage#1338, @hannesm, based on @palainp work) - Require opam-monorepo 0.3.2 (mirage/mirage#1332 mirage/mirage#1334, @hannesm @dinosaure) - Use OPAMVAR_monorepo instead of OPAMVAR_switch in generated opam file (mirage/mirage#1332, @hannesm) - Remove name from opam file (mirage/mirage#1332, @hannesm)
… (4.2.0) CHANGES: #### Fixed - Remove non-existing mirage-repo-add and mirage-repo-rm from PHONY in generated Makefile (mirage/mirage#1332, @hannesm) - Update deprecated references (mirage/mirage#1337, @reynir) #### Changed - Prepare for reproducing unikernels with generated opam file (mirage/mirage#1335, @hannesm) - split x-mirage-configure (mirage configure), x-mirage-pre-build (make lock pull), and build instructions in opam file - embed x-mirage-extra-repo (a list of opam repositories to use) - take relative paths up to git repository into account - include x-mirage-opam-lock-location (relative to git repository root) - Adapt constraints for mirage-solo5 0.9.0 and mirage-xen 8.0.0 (ocaml-solo5 0.8.1 with trim and improved memory metrics) (mirage/mirage#1338, @hannesm, based on @palainp work) - Require opam-monorepo 0.3.2 (mirage/mirage#1332 mirage/mirage#1334, @hannesm @dinosaure) - Use OPAMVAR_monorepo instead of OPAMVAR_switch in generated opam file (mirage/mirage#1332, @hannesm) - Remove name from opam file (mirage/mirage#1332, @hannesm)
this is a draft to enable reproducible builds with mirageos 4.x