Repository navigation
Flaky Fix Backport Check #8
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
| name: Flaky Fix Backport Check | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| since_days: | |
| description: 'How many days back to scan upstream (default: 7)' | |
| required: false | |
| type: string | |
| default: '7' | |
| pattern: | |
| description: 'Commit subject pattern to match (case-insensitive)' | |
| required: false | |
| type: string | |
| default: 'fix flaky' | |
| upstream_ref: | |
| description: 'Upstream branch/ref to scan' | |
| required: false | |
| type: string | |
| default: 'master' | |
| create_pr: | |
| description: 'Cherry-pick missing commits and open a backport PR' | |
| required: false | |
| type: boolean | |
| default: false | |
| schedule: | |
| - cron: '0 10 * * 1' # Every Monday at 06:00 EDT (10:00 UTC) | |
| jobs: | |
| setup: | |
| runs-on: [self-hosted, altinity-on-demand, altinity-style-checker] | |
| outputs: | |
| branches: ${{ steps.set_branches.outputs.branches }} | |
| steps: | |
| - id: set_branches | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "branches=[\"${{ github.ref_name }}\"]" >> $GITHUB_OUTPUT | |
| else | |
| echo "branches=[\"antalya-26.3\", \"stable-26.3\", \"antalya-26.6\"]" >> $GITHUB_OUTPUT | |
| fi | |
| check: | |
| needs: setup | |
| runs-on: [self-hosted, altinity-on-demand, altinity-style-checker] | |
| strategy: | |
| matrix: | |
| branch: ${{ fromJSON(needs.setup.outputs.branches) }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| filter: blob:none | |
| - name: Checkout target branch | |
| run: git checkout ${{ matrix.branch }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Check for missing flaky-fix backports | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| python3 tests/ci/check_for_flaky_fixes.py \ | |
| --since-days "${{ github.event.inputs.since_days || '7' }}" \ | |
| --pattern "${{ github.event.inputs.pattern || 'fix flaky' }}" \ | |
| --upstream-ref "${{ github.event.inputs.upstream_ref || 'master' }}" \ | |
| --md-output flaky_fix_report_${{ matrix.branch }}.md \ | |
| --json-output flaky_fix_${{ matrix.branch }}.json | |
| - name: Write summary | |
| if: always() | |
| run: cat flaky_fix_report_${{ matrix.branch }}.md >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload check results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: flaky-fix-check-${{ matrix.branch }} | |
| path: | | |
| flaky_fix_report_${{ matrix.branch }}.md | |
| flaky_fix_${{ matrix.branch }}.json | |
| backport: | |
| needs: [check, setup] | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.create_pr == true }} | |
| strategy: | |
| matrix: | |
| branch: ${{ fromJSON(needs.setup.outputs.branches) }} | |
| runs-on: [self-hosted, altinity-on-demand, altinity-style-checker] | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| filter: blob:none | |
| - name: Checkout target branch | |
| run: git checkout ${{ matrix.branch }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Download check results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: flaky-fix-check-${{ matrix.branch }} | |
| - name: Configure git identity | |
| run: | | |
| git config user.name altinity-robot | |
| git config user.email altinity-robot@users.noreply.github.com | |
| - name: Add upstream promisor remote | |
| run: | | |
| git remote add upstream https://github.com/ClickHouse/ClickHouse.git | |
| git config remote.upstream.promisor true | |
| git config remote.upstream.partialclonefilter blob:none | |
| - name: Cherry-pick and open PR | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| python3 tests/ci/backport_flaky_fixes.py \ | |
| --json-file flaky_fix_${{ matrix.branch }}.json \ | |
| --repo "${{ github.repository }}" |