From a3e016c2d623999ddef5e1f40116ac3ab9cd732b Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Mon, 11 Sep 2023 16:49:29 -0600 Subject: [PATCH] Add nightly rebase of branches with upstream julia (#42) * Add nightly rebase of branches with upstream julia * Update .github/workflows/nightly-rebase-upstream.yml Co-authored-by: Nick Robinson * Update .github/workflows/nightly-rebase-upstream.yml Co-authored-by: Nick Robinson * Update .github/workflows/nightly-rebase-upstream.yml Co-authored-by: Nick Robinson * Updates --------- Co-authored-by: Nick Robinson --- .github/workflows/nightly-rebase-upstream.yml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/nightly-rebase-upstream.yml diff --git a/.github/workflows/nightly-rebase-upstream.yml b/.github/workflows/nightly-rebase-upstream.yml new file mode 100644 index 0000000000000..f1140413f05a2 --- /dev/null +++ b/.github/workflows/nightly-rebase-upstream.yml @@ -0,0 +1,62 @@ +# Every night, rebase the Julia branches on top of raicode `master`. +name: NightlyRebaseUpstream +on: + schedule: + # every night at 11 PM, raicode nightly rebase runs at midnight + - cron: 0 23 * * * + workflow_dispatch: +permissions: + contents: write + pull-requests: write +jobs: + NightlyRebaseUpstream: + runs-on: ubuntu-latest + strategy: + fail-fast: false # run all jobs in the matrix even if one fails + matrix: + julia_branch: + - { name: "backports-release-1.9+RAI", upstream: "backports-release-1.9", comp_pr: "https://github.com/RelationalAI/julia/pull/45"} + - { name: "backports-release-1.10+RAI", upstream: "backports-release-1.10", comp_pr: "https://github.com/RelationalAI/julia/pull/46"} + - { name: "master+RAI", upstream: "master", comp_pr: "https://github.com/RelationalAI/julia/pull/47"} + steps: + - name: Checkout the repo and our branch + uses: actions/checkout@v3 + with: + ref: ${{ matrix.julia_branch.name }} + # Needed to make rebasing work (https://github.com/actions/checkout/issues/372) + fetch-depth: 0 + - name: Attempt the rebase + id: attempt_the_rebase + run: | + git config --global user.email "julia-engineering@relational.ai" + git config --global user.name "RAI CI (GitHub Action Automation)" + + git remote add upstream https://github.com/JuliaLang/julia + git fetch --quiet upstream ${{ matrix.julia_branch.upstream }}} + git rebase upstream/${{ matrix.julia_branch.upstream }} + continue-on-error: true + - name: On rebase success, push + if: steps.attempt_the_rebase.outcome == 'success' + run: | + git push --force origin ${{ matrix.julia_branch.name }} # force-push, because of the rebase. + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: On rebase failure, checkout jira-incident action + if: steps.attempt_the_rebase.outcome != 'success' + id: checkout-jira-indicent-action + uses: actions/checkout@v3 + with: + repository: RelationalAI/raicloud-deployment + ssh-key: ${{ secrets.DELVECI_SSH }} + path: deployment-repo + - name: On rebase failure, create Jira incident + if: steps.attempt_the_rebase.outcome != 'success' + id: create-jira-indicent + uses: ./deployment-repo/.github/actions/create-jira-incident + with: + affected_service: Engineering - Julia Upgrades - Medium Priority Only + summary: "Nightly rebase failed for RelationalAI/julia branch `${{ matrix.julia_branch.name }}`" + description: "Failed to rebase RelationalAI/julia branch `${{ matrix.julia_branch.name }}` branch on top of `${{ matrix.julia_branch.upstream}}`.\nPlease manually rebase ${{ matrix.julia_branch.name }}\nSee current diff between upstream branch here: ${{ matrix.julia_branch.comp_pr }}" + user_email: ${{ secrets.JIRA_API_USER_EMAIL }} + jira_api_token: ${{ secrets.JIRA_API_TOKEN }} + priority: "Medium"