-
Notifications
You must be signed in to change notification settings - Fork 1
RFC [KT] Add content-release command for kernel release automation #57
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: mainline
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,3 +295,58 @@ and then | |
| ``` | ||
| <config.base_path>/kernel-src-tree-tools/kernel-kselftest.sh | ||
| ``` | ||
|
|
||
| ### kt content-release | ||
|
|
||
| Manages the complete content release workflow for kernel packages. This command | ||
| automates the process of preparing, building, and testing kernel releases. | ||
|
|
||
| The command has three steps that can be run individually or all together: | ||
|
|
||
| #### --prepare | ||
| Prepares the content release by: | ||
| - Validating git user.name and user.email are configured | ||
| - Running mkdistgitdiff.py to generate the staging branch and release files | ||
| - Checking out the staging branch {automation_tmp}_<src_branch> | ||
| - Creating and displaying the new release tag | ||
|
|
||
| #### --build | ||
| Builds kernel RPMs by: | ||
| - Verifying mock is installed and user is in mock group | ||
| - Checking DEPOT_USER and DEPOT_TOKEN environment variables are set | ||
| - Creating a temporary mock config with depot credentials | ||
| - Downloading sources using getsrc.sh | ||
| - Building SRPM with mock | ||
| - Building binary RPMs from the SRPM | ||
| - Listing all created RPMs | ||
|
|
||
| Requirements: | ||
| - mock must be installed | ||
| - User must be in the mock group | ||
| - DEPOT_USER and DEPOT_TOKEN environment variables must be set | ||
|
Comment on lines
+323
to
+326
|
||
|
|
||
| #### --test | ||
| Tests the built kernel by: | ||
| - Spinning up a VM (creates if needed, boots if stopped) | ||
| - Installing the built kernel RPMs from build_files | ||
| - Rebooting the VM | ||
| - Running kselftests using /usr/libexec/kselftests/run_kselftest.sh | ||
| - Reporting number of tests passed | ||
|
|
||
| Output logs: | ||
| - install.log: RPM installation output | ||
| - selftest-<kernel_version>.log: Kselftest results | ||
|
|
||
| #### Example: | ||
|
|
||
| Run all steps: | ||
| ``` | ||
| $ DEPOT_USER=user@example.com DEPOT_TOKEN=token kt content-release lts-9.2 | ||
| ``` | ||
|
|
||
| Run individual steps: | ||
| ``` | ||
| $ kt content-release lts-9.2 --prepare | ||
| $ DEPOT_USER=user@example.com DEPOT_TOKEN=token kt content-release lts-9.2 --build | ||
| $ kt content-release lts-9.2 --test | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import click | ||
|
|
||
| from kt.commands.content_release.impl import ContentRelease | ||
| from kt.ktlib.shell_completion import ShellCompletion | ||
|
|
||
| epilog = """ | ||
| Manages the complete content release workflow for kernel packages. | ||
|
|
||
| This command automates the kernel content release process through three steps: | ||
|
|
||
| --prepare: Validates git config, runs mkdistgitdiff.py to create staging branch, | ||
| and creates a new tagged release in the src_worktree. | ||
|
|
||
| --build: Builds both source and binary RPMs using mock. Downloads sources via | ||
| getsrc.sh and builds kernel packages in build_files directory. | ||
| Requires DEPOT_USER and DEPOT_TOKEN environment variables. | ||
|
|
||
| --test: Spins up a VM, installs the built kernel RPMs, reboots, and runs | ||
| kselftests using /usr/libexec/kselftests/run_kselftest.sh. | ||
|
|
||
| When run without options, executes all three steps sequentially. | ||
|
|
||
| Examples: | ||
|
|
||
| \b | ||
| $ DEPOT_USER=user@example.com DEPOT_TOKEN=token kt content-release lts-9.2 | ||
| \b | ||
| $ kt content-release lts-9.2 --prepare | ||
| \b | ||
| $ DEPOT_USER=user@example.com DEPOT_TOKEN=token kt content-release lts-9.2 --build | ||
| \b | ||
| $ kt content-release lts-9.2 --test | ||
| """ | ||
|
|
||
|
|
||
| @click.command(epilog=epilog) | ||
| @click.argument("kernel_workspace", required=True, shell_complete=ShellCompletion.show_kernel_workspaces) | ||
| @click.option( | ||
| "--prepare", | ||
| is_flag=True, | ||
| help="Run only the prepare step", | ||
| ) | ||
| @click.option( | ||
| "--build", | ||
| is_flag=True, | ||
| help="Run only the build step", | ||
| ) | ||
| @click.option( | ||
| "--test", | ||
| is_flag=True, | ||
| help="Run only the test step", | ||
| ) | ||
| def content_release(kernel_workspace, prepare, build, test): | ||
| """Manage content release workflow (prepare, build, test).""" | ||
|
|
||
| # Check if any specific step was requested | ||
| any_step_specified = prepare or build or test | ||
|
|
||
| # Determine which steps to run | ||
| run_prepare_step = prepare or not any_step_specified | ||
| run_build_step = build or not any_step_specified | ||
| run_test_step = test or not any_step_specified | ||
|
|
||
| if not any_step_specified: | ||
| click.echo(f"Running all content-release steps for {kernel_workspace}: prepare, build, test") | ||
|
|
||
| # Run the selected steps | ||
| if run_prepare_step: | ||
| ContentRelease.prepare(kernel_workspace=kernel_workspace) | ||
|
|
||
| if run_build_step: | ||
| ContentRelease.build(kernel_workspace=kernel_workspace) | ||
|
|
||
| if run_test_step: | ||
| ContentRelease.test(kernel_workspace=kernel_workspace) |
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 documentation states that the --build step uses "getsrc.sh" for downloading sources, but the implementation actually has special handling for certain kernel workspaces (lts-8.6, fipslegacy-8.6, cbr-7.9) that download files directly via curl instead. The documentation should mention this special handling or at least indicate that the download method varies by kernel workspace.