Skip to content

Conversation

@bmastbergen
Copy link
Collaborator

Add a new GitHub Actions workflow to automate the process of rebasing CLK kernel branches against upstream stable releases. The workflow:

  • Triggers on workflow_dispatch or repository_dispatch
  • Performs rebase using lt_rebase.sh from kernel-src-tree-tools
  • Builds the kernel (with virtme-ng compatible configuration tweaks)
  • Runs kernel selftests in a virtme-ng vm
  • Creates a pull request with build logs, test results, and config changes
  • Tracks test pass rates across rebase iterations

Also modifies sync.yml to trigger the rebase workflow via repository_dispatch when stable branches receive updates, creating an end-to-end automation pipeline for keeping CLK branches synchronized with upstream stable releases.

Add a new GitHub Actions workflow to automate the process of rebasing
CLK kernel branches against upstream stable releases. The workflow:

- Triggers on workflow_dispatch or repository_dispatch
- Performs rebase using lt_rebase.sh from kernel-src-tree-tools
- Builds the kernel (with virtme-ng compatible configuration tweaks)
- Runs kernel selftests in a virtme-ng vm
- Creates a pull request with build logs, test results, and config changes
- Tracks test pass rates across rebase iterations

Also modifies sync.yml to trigger the rebase workflow via repository_dispatch
when stable branches receive updates, creating an end-to-end automation pipeline
for keeping CLK branches synchronized with upstream stable releases.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive automation for rebasing CLK kernel branches against upstream stable releases. The workflow integrates with the existing sync workflow to create an end-to-end pipeline that automatically detects stable branch updates, performs rebases, builds and tests kernels, and creates pull requests with detailed results.

Changes:

  • Modified sync.yml to detect when stable branches are updated and trigger the rebase workflow via repository_dispatch
  • Added clk-rebase.yml workflow that performs automated rebasing, kernel building with virtme-ng configuration, selftest execution, and PR creation with test results and metrics tracking

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 13 comments.

File Description
.github/workflows/sync.yml Added logic to detect changes after rebase and trigger CLK rebase workflow for stable branches via repository_dispatch API
.github/workflows/clk-rebase.yml New comprehensive workflow that automates CLK kernel branch rebasing, building, testing, and PR creation with metrics tracking

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +78 to +84
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/dispatches \
-d "{\"event_type\":\"stable-branch-updated\",\"client_payload\":{\"branch\":\"${{ matrix.branch }}\"}}"
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repository_dispatch API call doesn't check for errors. If the curl command fails (e.g., network issues, authentication problems), the workflow will continue silently without triggering the rebase workflow. Consider adding error handling to check the HTTP response status or use the -f flag with curl to fail on HTTP errors, combined with proper error checking.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a terrible idea

Comment on lines +317 to +324
# Create the PR
gh pr create \
--title "[CIQ ${CLK_VERSION}] Rebase to v${STABLE_VERSION}" \
--body-file /tmp/pr_body.md \
--base ${CLK_NEXT_BRANCH} \
--head ${TMP_CLK_NEXT_BRANCH} \
--reviewer bmastbergen

Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gh pr create command doesn't handle the case where a PR from TMP_CLK_NEXT_BRANCH to CLK_NEXT_BRANCH already exists. If the workflow runs multiple times before a PR is merged, subsequent runs will fail at this step with an error about a PR already existing. Consider adding logic to check for existing PRs and either update them or skip PR creation with a message.

Suggested change
# Create the PR
gh pr create \
--title "[CIQ ${CLK_VERSION}] Rebase to v${STABLE_VERSION}" \
--body-file /tmp/pr_body.md \
--base ${CLK_NEXT_BRANCH} \
--head ${TMP_CLK_NEXT_BRANCH} \
--reviewer bmastbergen
# Check for an existing open PR from TMP_CLK_NEXT_BRANCH to CLK_NEXT_BRANCH
EXISTING_PR_NUMBER=$(gh pr list \
--base "${CLK_NEXT_BRANCH}" \
--head "${TMP_CLK_NEXT_BRANCH}" \
--state open \
--json number \
--jq '.[0].number' || true)
if [ -n "${EXISTING_PR_NUMBER}" ]; then
echo "Found existing PR #${EXISTING_PR_NUMBER} from ${TMP_CLK_NEXT_BRANCH} to ${CLK_NEXT_BRANCH}; updating title and body."
gh pr edit "${EXISTING_PR_NUMBER}" \
--title "[CIQ ${CLK_VERSION}] Rebase to v${STABLE_VERSION}" \
--body-file /tmp/pr_body.md
else
echo "No existing PR from ${TMP_CLK_NEXT_BRANCH} to ${CLK_NEXT_BRANCH}; creating a new one."
gh pr create \
--title "[CIQ ${CLK_VERSION}] Rebase to v${STABLE_VERSION}" \
--body-file /tmp/pr_body.md \
--base ${CLK_NEXT_BRANCH} \
--head ${TMP_CLK_NEXT_BRANCH} \
--reviewer bmastbergen
fi

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a terrible idea

@bmastbergen bmastbergen requested a review from a team January 27, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants