-
Notifications
You must be signed in to change notification settings - Fork 53
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
Extract recovery kernel #2016
Extract recovery kernel #2016
Conversation
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
Refactors build-iso command to use the new DeployRecoverySystem method. Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2016 +/- ##
==========================================
- Coverage 72.56% 72.34% -0.22%
==========================================
Files 76 76
Lines 8907 8992 +85
==========================================
+ Hits 6463 6505 +42
- Misses 1910 1944 +34
- Partials 534 543 +9 ☔ View full report in Codecov by Sentry. |
Use DeployRecoverySystem to deploy the recovery system. Needs some changes to grub.cfg to be fully compatible and also extracts the bootargs.cfg file into the recovery partition. Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
This commit changes the DeployRecoverySystem method to remove any conflicting boot artifacts before copying the new files. Also adds power and squashfs compression flags to the command. Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
target := filepath.Join(bootDir, filepath.Base(file)) | ||
if exist, _ := utils.Exists(cfg.Fs, target); exist { | ||
cfg.Logger.Debugf("Removing old file %s", target) | ||
err = cfg.Fs.Remove(target) |
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 to make sure we deploy the newest files.
On error we could potentially leave the system unbootable because of a mix of kernel/initrd/grub-bootargs.
I think this is safe since we are updating from the active system, but we could consider deploying the artifacts into a temporary boot-dir and then moving it to <recovery>/boot
once everything is deployed.
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.
Yes touching bootloader binaries is tricky. In fact this is also a valid concern we currently have for upgrades too when using the bootloader install flag. I'd be happy to brainstorm a little around this topic, if someone faces issues in that area, even it is unlikely, would be quite frustrating. I'd be in favor to apply some more elaborated logic, the question here is which would be the desired behavior.
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.
Agreed! I will create a ticket to stabilize the upgrade! It should probably include some integration tests as well.
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.
Nice! Great job 👍
I am wondering if shouldn't we create an issue to discuss bootloader upgrade. Probably we should define some better approach to be more robust in case of failures.
@@ -90,7 +90,7 @@ build-iso: | |||
mkdir -p $(ROOT_DIR)/build | |||
$(DOCKER) run --rm -v $(DOCKER_SOCK):$(DOCKER_SOCK) -v $(ROOT_DIR)/build:/build \ | |||
--entrypoint /usr/bin/elemental $(TOOLKIT_REPO):$(VERSION) --debug build-iso --bootloader-in-rootfs -n elemental-$(FLAVOR).$(ARCH) \ | |||
--local --platform $(PLATFORM) --squash-no-compression -o /build $(REPO):$(VERSION) | |||
--local --platform $(PLATFORM) -o /build $(REPO):$(VERSION) |
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.
Will it default to compressed squashfs images?
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.
Only for our example isos/disks since I noticed we saved ~50MB on the final image which could speed up CI sligthly.
FS: constants.SquashFs, | ||
} | ||
|
||
err = elemental.DeployRecoverySystem(b.cfg.Config, image, bootDir) |
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 really like this method 👍
target := filepath.Join(bootDir, filepath.Base(file)) | ||
if exist, _ := utils.Exists(cfg.Fs, target); exist { | ||
cfg.Logger.Debugf("Removing old file %s", target) | ||
err = cfg.Fs.Remove(target) |
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.
Yes touching bootloader binaries is tricky. In fact this is also a valid concern we currently have for upgrades too when using the bootloader install flag. I'd be happy to brainstorm a little around this topic, if someone faces issues in that area, even it is unlikely, would be quite frustrating. I'd be in favor to apply some more elaborated logic, the question here is which would be the desired behavior.
This PR refactors the deployment of the recovery-system in our different code-branches according to the ADR.
Fixes #1864 #1930