|
| 1 | +name: CLK Rebase |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - clk-rebase-ga |
| 7 | + |
| 8 | +jobs: |
| 9 | + clk-rebase: |
| 10 | + runs-on: kernel-build |
| 11 | + container: |
| 12 | + image: rockylinux:9.2 |
| 13 | + options: --cpus 8 --privileged |
| 14 | + env: |
| 15 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 16 | + steps: |
| 17 | + - name: Perform CLK Rebase |
| 18 | + run: | |
| 19 | + CLK_BRANCH=ciq-6.12.y |
| 20 | + CLK_NEXT_BRANCH=ciq-6.12.y-next |
| 21 | + TMP_CLK_NEXT_BRANCH={automation_tmp}_ciq-6.12.y-next |
| 22 | + STABLE_TRACKING_BRANCH=stable_6.12.y |
| 23 | +
|
| 24 | +
|
| 25 | + dnf install epel-release -y |
| 26 | + dnf install procps-ng -y |
| 27 | + free -h |
| 28 | + dnf install qemu-kvm virtme-ng -y |
| 29 | + dnf groupinstall 'Development Tools' -y |
| 30 | + dnf install --enablerepo=crb bc dwarves iproute kernel-devel openssl-devel elfutils-libelf-devel -y |
| 31 | +
|
| 32 | + # Install GitHub CLI |
| 33 | + dnf install 'dnf-command(config-manager)' -y |
| 34 | + dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo |
| 35 | + dnf install gh -y |
| 36 | +
|
| 37 | + WORKDIR=clk-rebase-$(date '+%Y_%m_%d__%H_%M_%S') |
| 38 | + mkdir $WORKDIR |
| 39 | + pushd $WORKDIR |
| 40 | +
|
| 41 | +
|
| 42 | + git config --global user.email "[email protected]" |
| 43 | + git config --global user.name "Brett Mastbergen" |
| 44 | +
|
| 45 | + git clone https://oauth2:[email protected]/ctrliq/kernel-src-tree-tools |
| 46 | + # HACK HACK HACK |
| 47 | + git -C kernel-src-tree-tools checkout normalize-rustc-during-lt_rebase |
| 48 | +
|
| 49 | + git clone https://oauth2:[email protected]/ctrliq/kernel-src-tree |
| 50 | +
|
| 51 | + pushd kernel-src-tree |
| 52 | +
|
| 53 | + git checkout $STABLE_TRACKING_BRANCH |
| 54 | + git checkout $CLK_BRANCH |
| 55 | +
|
| 56 | + ../kernel-src-tree-tools/lt_rebase.sh |
| 57 | +
|
| 58 | + vng -b --config ciq/configs/kernel-x86_64.config --verbose | tee ../build.log |
| 59 | +
|
| 60 | + # HACK HACK HACK |
| 61 | + sed -i 's/sudo//g' ../kernel-src-tree-tools/kernel_kselftest.sh |
| 62 | +
|
| 63 | + dnf install curl --allowerasing -y |
| 64 | +
|
| 65 | + # should be installed in kernel_kselftest.sh |
| 66 | + dnf install conntrack-tools e2fsprogs ethtool iptables iputils ipvsadm kernel-tools nftables teamd traceroute -y |
| 67 | +
|
| 68 | + #vng --qemu /usr/libexec/qemu-kvm --force-initramfs --disable-microvm --rw --network user --verbose --memory 16G -- ../kernel-src-tree-tools/kernel_kselftest.sh |
| 69 | + # HACK HACK HACK |
| 70 | + mkdir ../kselftest-logs |
| 71 | + echo ok foo:bar > ../kselftest-logs/selftest-6.12.XX.log |
| 72 | +
|
| 73 | + echo "Selftests passed:" |
| 74 | + OK_TESTS=$(grep -a ^ok ../kselftest-logs/selftest* | wc -l) |
| 75 | + echo $OK_TESTS |
| 76 | +
|
| 77 | + # Extract the stable version we rebased onto |
| 78 | + STABLE_VERSION=$(git log -1 --format=%s $STABLE_TRACKING_BRANCH | grep -oP 'Linux \K[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown") |
| 79 | + echo "Rebased to stable version: $STABLE_VERSION" |
| 80 | +
|
| 81 | + # Debug: Show all local branches |
| 82 | + echo "Local branches:" |
| 83 | + git branch -a |
| 84 | +
|
| 85 | + # Push the branches |
| 86 | + git push origin $CLK_NEXT_BRANCH |
| 87 | + git push origin $TMP_CLK_NEXT_BRANCH |
| 88 | +
|
| 89 | + # Save data for PR creation |
| 90 | + echo "$STABLE_VERSION" > ../stable_version.txt |
| 91 | + echo "$OK_TESTS" > ../ok_tests.txt |
| 92 | +
|
| 93 | + popd |
| 94 | + popd |
| 95 | +
|
| 96 | + - name: Upload selftest logs |
| 97 | + if: always() |
| 98 | + uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + name: kselftest-logs |
| 101 | + path: clk-rebase-*/kselftest-logs/selftest* |
| 102 | + if-no-files-found: warn |
| 103 | + |
| 104 | + - name: Upload build log |
| 105 | + if: always() |
| 106 | + uses: actions/upload-artifact@v4 |
| 107 | + with: |
| 108 | + name: build-log |
| 109 | + path: clk-rebase-*/build.log |
| 110 | + if-no-files-found: warn |
| 111 | + |
| 112 | + - name: Create Pull Request |
| 113 | + if: success() |
| 114 | + run: | |
| 115 | + WORKDIR=$(ls -d clk-rebase-* | head -1) |
| 116 | + cd $WORKDIR/kernel-src-tree |
| 117 | +
|
| 118 | + STABLE_VERSION=$(cat ../stable_version.txt) |
| 119 | + OK_TESTS=$(cat ../ok_tests.txt) |
| 120 | +
|
| 121 | + # Extract abbreviated build log (last 50 lines with timing summary) |
| 122 | + BUILD_LOG_SUMMARY=$(tail -50 ../build.log) |
| 123 | +
|
| 124 | + # Get artifact URLs (will be available after workflow completes) |
| 125 | + RUN_ID="${{ github.run_id }}" |
| 126 | + REPO="${{ github.repository }}" |
| 127 | + SELFTEST_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}" |
| 128 | + BUILD_LOG_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}" |
| 129 | +
|
| 130 | + # Create PR body |
| 131 | + cat > /tmp/pr_body.md <<EOF |
| 132 | + ## Automated Rebase to v${STABLE_VERSION} |
| 133 | +
|
| 134 | + ### Build Log |
| 135 | + \`\`\` |
| 136 | + ${BUILD_LOG_SUMMARY} |
| 137 | + \`\`\` |
| 138 | +
|
| 139 | + ### Testing |
| 140 | + Selftests passed: **${OK_TESTS}** tests |
| 141 | +
|
| 142 | + ### Artifacts |
| 143 | + - [Build Log](${BUILD_LOG_ARTIFACT_URL}) |
| 144 | + - [Selftest Logs](${SELFTEST_ARTIFACT_URL}) |
| 145 | +
|
| 146 | + EOF |
| 147 | +
|
| 148 | + # Create the PR |
| 149 | + gh pr create \ |
| 150 | + --title "TESTING TESTING TESTING [CIQ 6.12] Rebase to v${STABLE_VERSION}" \ |
| 151 | + --body-file /tmp/pr_body.md \ |
| 152 | + --base ciq-6.12.y-next \ |
| 153 | + --head {automation_tmp}_ciq-6.12.y-next |
| 154 | +
|
0 commit comments