Skip to content
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

build-kmod-kit: don't rebuild if kernel hasn't changed #1286

Merged
merged 1 commit into from Jan 22, 2021

Conversation

tjkirch
Copy link
Contributor

@tjkirch tjkirch commented Jan 20, 2021

If the kernel archive is older than the kmod kit, we can assume that the kmod
kit is up to date and skip its 20+ second build.

Note: This is built on top of #1285. The goal is to have this be fast enough that it can be added as a dependency to build-variant, so the kmod kit can consistently be added to repos.

Testing done:

With no existing archive, a new one is prepared:

> ls build/archives/
> cargo make build-archives
...
[cargo-make] INFO - Running Task: build-packages
    Finished dev [optimized] target(s) in 0.12s
[cargo-make] INFO - Running Task: build-kmod-kit
[cargo-make] INFO - Build Done in 24 seconds.

A rerun notices the existing artifact:

[cargo-make] INFO - Running Task: build-kmod-kit
Existing kmod kit /home/tjk/work/bottlerocket/build/archives/aws-k8s-1.17-x86_64-kmod-kit-v1.0.5.tar.xz is newer than kernel archive /home/tjk/work/bottlerocket/build/rpms/bottlerocket-x86_64-kernel-archive-5.4.80-1.x86_64.rpm; skipping build.
[cargo-make] INFO - Build Done in 3 seconds.

Updating the kernel results in a new archive being build:

> touch build/rpms/*kernel*
> cargo make build-archives
...
[cargo-make] INFO - Running Task: build-kmod-kit
[cargo-make] INFO - Build Done in 24 seconds.

Removing the kernel forces the new error. (This wouldn't normally happen because build-kmod-kit depends on build-packages which builds this kernel archive.)

> mv build/rpms/*kernel* ~
> cargo make build-archives
...
[cargo-make] INFO - Running Task: build-kmod-kit
Unable to find latest kernel archive for x86_64 in /home/tjk/work/bottlerocket/build/rpms
[cargo-make] ERROR - Error while executing command, exit code: 1

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

If the kernel archive is older than the kmod kit, we can assume that the kmod
kit is up to date and skip its 20+ second build.
@tjkirch tjkirch requested a review from bcressey January 20, 2021 23:26
@tjkirch tjkirch changed the base branch from kmod-kit-dirs to develop January 22, 2021 05:40
@tjkirch tjkirch merged commit a709827 into bottlerocket-os:develop Jan 22, 2021
@tjkirch tjkirch deleted the kmod-kit-cond-rebuild branch January 22, 2021 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants