-
Notifications
You must be signed in to change notification settings - Fork 183
cmd-build-fast: New command to iterate on content quickly #1371
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
cmd-build-fast: New command to iterate on content quickly #1371
Conversation
dc6cd53 to
35b5a83
Compare
|
OK whee I just had my first "oh wait this doesn't work because I used build-fast" moment - I was working on a new systemd unit in the target root stored in the overlays and updated the But...eh, we can expand on this as needed. |
9190c6f to
65edf3c
Compare
|
OK I now updated this to run in another mode that more clearly replaces rpm-ostree's |
|
Bigger picture, this PR is trying to add to coreos-assembler the concept of a "project source directory" that doesn't currently exist aside from the I worked on this PR in parallel with this script in ostree: Because again an important goal is "edit $project (ostree, igntition, etc.); build fast dev qemu image, run project tests" while still supporting "run project tests" outside of building the project. Tying these two things together for example, if this lands I'd probably change I dunno though. Maybe it is cleaner to have something like: Then you always live inside the cosa workdir, and it becomes much more obvious how to work on multiple projects. |
jlebon
left a comment
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.
Cool stuff! I like the project dir approach.
ISTM like we'll want the OSTree parts of logic in rpm-ostree instead at some point, e.g. rpm-ostree compose overlay or something? Then we get things like initrd regeneration and the /etc move thing more easily. (This would be helpful too for eventually implementing coreos/rpm-ostree#442.)
| # Depends https://github.com/ostreedev/ostree/pull/2041/commits/b3bbbd154225e81980546b2c0b5ed98714830696 | ||
| version="fastbuild-$(date +"%s")" | ||
| if [ -n "${projectdir}" ]; then | ||
| cd "${projectdir}" |
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.
This is minor/an aside, though in non-trivial shell scripts like this I find it conceptually easier to just always stay in the same directory and do anything that really needs a cd in a subshell.
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.
But everything after that is in the project dir?
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.
Hmm, it seemed to me like all the paths used were absolute in the ${projectdir} case.
Part of the implementation of coreos#1341 This is useful for me hacking on ostree/rpm-ostree. Here we don't need to regenerate the initramfs (usually), we just want new ostree binaries in `/usr`. But we *do* want the OS to be set up as a "proper" OSTree commit, i.e. not `rpm-ostree usroverlay`. Here this completes a qemu image (overlaid on previous) in 11 seconds, compared to 147 seconds for a full build; ~13x faster *and* we're not writing `O(sizeof(coreos))` bytes to my SSD, but `O(sizeof(change) + sizeof(metadata(coreos))`. With this a workflow looks like: ``` $ cd /src/ostree $ make && make install DESTDIR=/path/to/cosa/overrides/rootfs $ cd /path/to/cosa $ cosa build-fast $ cosa run --qemu-image tmp/fastbuild/fastbuild-qemu.qcow2 ``` (Or, instead of `cosa run`, `cosa kola run --qemu-image fastbuild/fastbuild-qemu.qcow2 -E /src/ostree ext.ostree.*`) You can also use this inside a project directory by setting `COSA_DIR`.
65edf3c to
68d5033
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cgwalters, jlebon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Definitely, I have a local branch for that with some hacks but...it has a similar problem to trying to do this in the main coreos-assembler path in that it's super messy to add a bunch of "skip this, skip that, hack this" steps into the main code flow. |
I'm using [cosa build-fast](coreos/coreos-assembler#1371) and this test doesn't like starting out with two deployments. Clean things up to one at the start just to simplify things.
I'm using [cosa build-fast](coreos/coreos-assembler#1371) and this test doesn't like starting out with two deployments. Clean things up to one at the start just to simplify things.
This is parallel to [build-fast](coreos#1371) which is about quickly iterating on userspace. Here is the opposite - we just want to take our new code and get it into the initramfs as fast as possible. An example use is demonstrated in the comment at the top of the file. Here this takes about 5 seconds to run, which is fast enough that at least I would probably stay at the terminal and not e.g. context switch to code review or check Twitter or whatever.
This is parallel to [build-fast](coreos#1371) which is about quickly iterating on userspace. Here is the opposite - we just want to take our new code and get it into the initramfs as fast as possible. An example use is demonstrated in the comment at the top of the file. Here this takes about 5 seconds to run, which is fast enough that at least I would probably stay at the terminal and not e.g. context switch to code review or check Twitter or whatever.
This is parallel to [build-fast](coreos#1371) which is about quickly iterating on userspace. Here is the opposite - we just want to take our new code and get it into the initramfs as fast as possible. An example use is demonstrated in the comment at the top of the file. Here this takes about 5 seconds to run, which is fast enough that at least I would probably stay at the terminal and not e.g. context switch to code review or check Twitter or whatever.
This is parallel to [build-fast](#1371) which is about quickly iterating on userspace. Here is the opposite - we just want to take our new code and get it into the initramfs as fast as possible. An example use is demonstrated in the comment at the top of the file. Here this takes about 5 seconds to run, which is fast enough that at least I would probably stay at the terminal and not e.g. context switch to code review or check Twitter or whatever.
I'm using [cosa build-fast](coreos/coreos-assembler#1371) and this test doesn't like starting out with two deployments. Clean things up to one at the start just to simplify things.
Part of the implementation of
#1341
This is useful for me hacking on ostree/rpm-ostree. Here we
don't need to regenerate the initramfs (usually), we just want
new ostree binaries in
/usr. But we do want the OS to beset up as a "proper" OSTree commit, i.e. not
rpm-ostree usroverlay.Here this completes a qemu image (overlaid on previous) in 13 seconds,
compared to 147 seconds for a full build; 11x faster and we're
not writing
O(sizeof(coreos))bytes to my SSD, butO(sizeof(change) + sizeof(metadata(coreos)).With this a workflow looks like:
(Or, instead of
cosa run,cosa kola run --qemu-image tmp/fastbuild/fastbuild-qemu.qcow2 -E /src/ostree ext.ostree.*)