Migrate qcom-build-utils to debusine-action-backed workflows#143
Open
simonbeaudoin0935 wants to merge 4 commits intomainfrom
Open
Migrate qcom-build-utils to debusine-action-backed workflows#143simonbeaudoin0935 wants to merge 4 commits intomainfrom
simonbeaudoin0935 wants to merge 4 commits intomainfrom
Conversation
Add the CI helper scripts needed to generate source packages, prepare releases, configure Debusine-backed installability tests, compute version bumps, and poll Debusine work requests. Rewrite the package build and release reusable workflows around the Debusine model while keeping qcom-build-utils as the package-repo orchestrator.
Introduce qcom-build-utils as the source of truth for package-repository workflow files, add workflow sync automation, and update the docs to describe the Debusine-backed reusable workflow contracts and package-repo integration model.
Refresh AGENTS.md to document the current qcom-build-utils architecture, the Debusine ownership split with debusine-action, the still-live CI helper scripts, and the Debusine-era artifacts that should not be reintroduced.
Use the dev/sbeaudoi branch of qualcomm-linux/debusine-action from the qcom-build-utils Debusine build and release workflows so the end-to-end path can be validated before the upstream action changes land on main.
Comment on lines
+111
to
+116
| run: | | ||
| set -ex | ||
| echo "::group::Prepare release" | ||
| SUITE=${{ inputs.suite }} qcom-build-utils/scripts/ci/prepare-release | ||
| echo "::endgroup::" | ||
|
|
Comment on lines
+119
to
+122
| run: | | ||
| set -ex | ||
| SUITE=${{ inputs.suite }} qcom-build-utils/scripts/ci/generate-source-package | ||
|
|
Comment on lines
+39
to
+238
| run: | | ||
| # Define explicit list of repositories to exclude | ||
| EXCLUDE_REPOS=("pkg-template" \ | ||
| "pkg-example" \ | ||
| "pkg-oss-staging-repo" \ | ||
| "pkg-linux-firmware" \ | ||
| "pkg-camera-service-temp" \ | ||
| "pkg-gst-plugins-imsdk-temp" \ | ||
| "pkg-kernel-fedora" \ | ||
| "pkg-linux-kernel" ) | ||
|
|
||
| # Array to store created PR URLs | ||
| PR_URLS=() | ||
|
|
||
| # Get the list of all repositories that used pkg-template as a template | ||
| repos=$(gh repo list --limit 9999 $ORG --json name --jq '.[] | select(.name | startswith("pkg-")) | .name') | ||
|
|
||
| echo "List of repositories starting with 'pkg-': $repos" | ||
|
|
||
| # pr-pre-post-merge.yml is checked out locally in pkg-workflows/debian/ | ||
| DEBIAN_LATEST_WORKFLOW_FILE="$(pwd)/pkg-template/.github/pkg-workflows/debian/pr-pre-post-merge.yml" | ||
| echo "📄 Using pr-pre-post-merge.yml from pkg-workflows/debian/" | ||
|
|
||
| for repo in $repos; do | ||
| # Skip excluded repositories | ||
| if [[ " ${EXCLUDE_REPOS[@]} " =~ " ${repo} " ]]; then | ||
| echo "⏭️ Skipping excluded repository: $repo" | ||
| continue | ||
| fi | ||
|
|
||
| echo "🔄 Checking repo: $repo" | ||
|
|
||
| # Check if the bot account has write or admin permissions | ||
| echo " 🔍 Checking permissions for $BOT_USERNAME on $repo" | ||
| permission_response=$(gh api repos/$ORG/$repo/collaborators/$BOT_USERNAME/permission 2>/dev/null || echo "") | ||
|
|
||
| if [[ -z "$permission_response" ]]; then | ||
| echo " ⛔ Cannot verify permissions for $BOT_USERNAME on $repo - skipping" | ||
| continue | ||
| fi | ||
|
|
||
| permission_level=$(echo "$permission_response" | jq -r '.permission') | ||
|
|
||
| if [[ "$permission_level" != "admin" && "$permission_level" != "write" ]]; then | ||
| echo " ⛔ $BOT_USERNAME does not have write/admin permissions on $repo (has: $permission_level) - skipping" | ||
| continue | ||
| fi | ||
|
|
||
| echo " ✅ $BOT_USERNAME has $permission_level permissions on $repo" | ||
|
|
||
| # Clone the target repository | ||
| gh repo clone "$ORG/$repo" "$repo" 2>&1 | sed 's/^/ /' | ||
| cd "$repo" | ||
|
|
||
| # Detect the default branch (usually 'main' but some repos use 'master') | ||
| default_branch=$(gh api repos/$ORG/$repo --jq '.default_branch') | ||
| echo " 🌿 Default branch for $repo: $default_branch" | ||
|
|
||
| # Configure git to use gh CLI for authentication | ||
| gh auth setup-git | ||
| git config user.name "$BOT_NAME" | ||
| git config user.email "$BOT_EMAIL" | ||
|
|
||
| # Delete the sync branch if it exists from a previous run | ||
| if git ls-remote --exit-code --heads origin sync/pkg-template-workflows > /dev/null 2>&1; then | ||
| echo " 🧹 Deleting existing sync/pkg-template-workflows branch from remote" | ||
| git push origin --delete sync/pkg-template-workflows 2>&1 | sed 's/^/ /' | ||
| fi | ||
|
|
||
| # Track if changes are needed | ||
| isDirty=false | ||
|
|
||
| # Special case: Remove workflows_sync.yml if it exists in target repo | ||
| if [[ -f ".github/workflows/workflows_sync.yml" ]]; then | ||
| echo " 🗑️ Removing workflows_sync.yml (should not exist in templated repos)" | ||
| rm ".github/workflows/workflows_sync.yml" | ||
| isDirty=true | ||
| fi | ||
|
|
||
| # Compare and sync workflow files | ||
| for workflow in ../pkg-template/.github/pkg-workflows/main/*.yml; do | ||
| workflow_name=$(basename "$workflow") | ||
|
|
||
| target_workflow=".github/workflows/$workflow_name" | ||
|
|
||
| if [[ -f "$target_workflow" ]]; then | ||
| if diff -q "$workflow" "$target_workflow" > /dev/null; then | ||
| echo " ✅ $workflow_name is up to date" | ||
| else | ||
| echo " ❌ $workflow_name differs from template" | ||
| cp "$workflow" "$target_workflow" | ||
| isDirty=true | ||
| fi | ||
| else | ||
| echo " + Creating $workflow_name (missing from $repo)" | ||
| mkdir -p ".github/workflows" | ||
| cp "$workflow" "$target_workflow" | ||
| isDirty=true | ||
| fi | ||
| done | ||
|
|
||
| # Create branch, commit, and push main branch changes if needed | ||
| if [[ "$isDirty" == "true" ]]; then | ||
| echo " 📝 Creating branch and committing main branch changes" | ||
| git checkout -b sync/pkg-template-workflows 2>&1 | sed 's/^/ /' | ||
| git add .github/workflows/ | ||
| git commit -s -m "chore: sync workflows from pkg-template" 2>&1 | sed 's/^/ /' | ||
|
|
||
| if [[ "${{ inputs.confirmation }}" == "true" ]]; then | ||
| echo " 🚀 Pushing changes and creating PR for $default_branch" | ||
| git push origin sync/pkg-template-workflows 2>&1 | sed 's/^/ /' | ||
|
|
||
| pr_url=$(gh pr create --repo "$ORG/$repo" \ | ||
| --title "chore: sync workflows from pkg-template" \ | ||
| --body "This PR syncs the latest workflows from pkg-template." \ | ||
| --head sync/pkg-template-workflows \ | ||
| --base "$default_branch") | ||
|
|
||
| PR_URLS+=("$pr_url") | ||
| echo " ✅ PR created: $pr_url" | ||
| else | ||
| echo " 👀 Dry-run mode - No PR will be created for $default_branch" | ||
| fi | ||
|
|
||
| # Return to default branch before debian/* sync | ||
| git checkout "$default_branch" 2>&1 | sed 's/^/ /' | ||
| else | ||
| echo " ✨ No main branch changes needed for $repo" | ||
| fi | ||
|
|
||
| # Sync pr-pre-post-merge.yml from pkg-template's debian/latest to every debian/* and qcom/debian/* branch | ||
| debian_branches=$(git branch -r | grep -E 'origin/(qcom/)?debian/' | sed 's|.*origin/||' | tr -d ' ') | ||
|
|
||
| for debian_branch in $debian_branches; do | ||
| # Skip debian/latest itself (it's the source) | ||
| if [[ "$debian_branch" == "debian/latest" ]]; then | ||
| continue | ||
| fi | ||
|
|
||
| echo " 🌿 Checking pr-pre-post-merge.yml on branch: $debian_branch" | ||
| safe_branch_name="${debian_branch//\//-}" | ||
| debian_sync_branch="sync/pkg-template-pr-merge-${safe_branch_name}" | ||
|
|
||
| # Delete existing sync branch if from a previous run | ||
| if git ls-remote --exit-code --heads origin "$debian_sync_branch" > /dev/null 2>&1; then | ||
| echo " 🧹 Deleting existing $debian_sync_branch" | ||
| git push origin --delete "$debian_sync_branch" 2>&1 | sed 's/^/ /' | ||
| fi | ||
|
|
||
| git checkout "$debian_branch" 2>&1 | sed 's/^/ /' | ||
|
|
||
| isDebianDirty=false | ||
| if [[ -f ".github/workflows/pr-pre-post-merge.yml" ]]; then | ||
| if diff -q "$DEBIAN_LATEST_WORKFLOW_FILE" ".github/workflows/pr-pre-post-merge.yml" > /dev/null; then | ||
| echo " ✅ pr-pre-post-merge.yml is up to date on $debian_branch" | ||
| else | ||
| echo " ❌ pr-pre-post-merge.yml differs on $debian_branch" | ||
| cp "$DEBIAN_LATEST_WORKFLOW_FILE" ".github/workflows/pr-pre-post-merge.yml" | ||
| isDebianDirty=true | ||
| fi | ||
| else | ||
| echo " + Creating pr-pre-post-merge.yml on $debian_branch (missing)" | ||
| mkdir -p ".github/workflows" | ||
| cp "$DEBIAN_LATEST_WORKFLOW_FILE" ".github/workflows/pr-pre-post-merge.yml" | ||
| isDebianDirty=true | ||
| fi | ||
|
|
||
| if [[ "$isDebianDirty" == "true" ]]; then | ||
| git checkout -b "$debian_sync_branch" 2>&1 | sed 's/^/ /' | ||
| git add .github/workflows/pr-pre-post-merge.yml | ||
| git commit -s -m "chore: sync pr-pre-post-merge.yml from pkg-template debian/latest" 2>&1 | sed 's/^/ /' | ||
|
|
||
| if [[ "${{ inputs.confirmation }}" == "true" ]]; then | ||
| echo " 🚀 Pushing changes and creating PR for $debian_branch" | ||
| git push origin "$debian_sync_branch" 2>&1 | sed 's/^/ /' | ||
|
|
||
| pr_url=$(gh pr create --repo "$ORG/$repo" \ | ||
| --title "chore: sync pr-pre-post-merge.yml from pkg-template debian/latest" \ | ||
| --body "This PR syncs \`pr-pre-post-merge.yml\` from the \`debian/latest\` branch of pkg-template." \ | ||
| --head "$debian_sync_branch" \ | ||
| --base "$debian_branch") | ||
|
|
||
| PR_URLS+=("$pr_url") | ||
| echo " ✅ PR created: $pr_url" | ||
| else | ||
| echo " 👀 Dry-run mode - No PR will be created for $debian_branch" | ||
| fi | ||
| fi | ||
| done | ||
|
|
||
| cd .. | ||
| done | ||
|
|
||
| # Output summary of created PRs | ||
| if [[ "${#PR_URLS[@]}" -gt 0 ]]; then | ||
| echo "🎉 Created PRs for the following repositories:" | ||
| for pr_url in "${PR_URLS[@]}"; do | ||
| echo " - $pr_url" | ||
| done | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate
qcom-build-utilsto the current Debusine-backed package build and release flow, withdebusine-actionhandling the Debusine-specific action logic.What changed
.github/pkg-workflows/AGENTS.mdwith the current ownership split betweenqcom-build-utilsanddebusine-actionqualcomm-linux/debusine-action@dev/sbeaudoifor end-to-end validation before that work lands onmainCommit structure
92e97c3— Implement Debusine-backed build and release workflowsaa0f142— Add package workflow sources and Debusine docsf424ed3— Update repository guidance for AI agents20624c8— Point debusine-action calls at dev/sbeaudoiNotes
qcom-build-utilsnow consumes the Debusine builder images published fromqualcomm-linux/debusine-actionrather than owning a local Debusine image-publishing layer..oldworkflow snapshots were removed during this branch work and are already reflected in the cleaned history.debusine-actionlands onmain.