Make WordPress Core

Changeset 53947


Ignore:
Timestamp:
08/26/2022 07:19:11 PM (20 months ago)
Author:
desrosj
Message:

Build/Test Tools: Automatically rerun a workflow the first time it fails.

There are several common reoccurring issues that sometimes cause GitHub Action workflows to fail (connection timeouts to WordPress.org or the Docker container registry, npm install failures, Chromium issues, etc.). Except when there are service level outages, most of these issues can be resolved by simply rerunning the workflow.

This introduces a new step within each of Core’s GitHub Action workflows that attempts to rerun the failed jobs within the workflow that encountered a failure if they are running for the first time. Since a workflow is not allowed to restart itself, a new failed-workflow.yml callable workflow is being introduced.

Other related adjustments in this changeset:

  • The actions/github-script 3rd-party action is also now updated to the latest version (v6.2.0).
  • A new secret, GHA_WORKFLOW_DISPATCH, has been introduced. This will replace the current one in use (GHA_OLD_BRANCH_DISPATCH) with a less specific name.

Props jorbin, desrosj.
Fixes #56407.

Location:
trunk/.github/workflows
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/coding-standards.yml

    r53940 r53947  
    174174      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    175175      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     176
     177  failed-workflow:
     178    name: Failed workflow tasks
     179    runs-on: ubuntu-latest
     180    needs: [ phpcs, jshint, slack-notifications ]
     181    if: |
     182      always() &&
     183      github.repository == 'WordPress/wordpress-develop' &&
     184      github.event_name != 'pull_request' &&
     185      github.run_number < 2 &&
     186      (
     187        needs.phpcs.result == 'cancelled' || needs.phpcs.result == 'failure' ||
     188        needs.jshint.result == 'cancelled' || needs.jshint.result == 'failure'
     189      )
     190
     191    steps:
     192      - name: Dispatch workflow run
     193        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
     194        with:
     195          github-token: ${{ secrets.GHA_WORKFLOW_DISPATCH }}
     196          script: |
     197            github.rest.actions.createWorkflowDispatch({
     198              owner: context.repo.owner,
     199              repo: context.repo.repo,
     200              workflow_id: 'failed-workflow.yml',
     201              ref: '${{ github.ref_name }}',
     202              inputs: {
     203                run_id: '${{ github.run_id }}'
     204              }
     205            });
  • trunk/.github/workflows/end-to-end-tests.yml

    r53940 r53947  
    131131      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    132132      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     133
     134  failed-workflow:
     135    name: Failed workflow tasks
     136    runs-on: ubuntu-latest
     137    needs: [ e2e-tests, slack-notifications ]
     138    if: |
     139      always() &&
     140      github.repository == 'WordPress/wordpress-develop' &&
     141      github.event_name != 'pull_request' &&
     142      github.run_number < 2 &&
     143      (
     144        needs.e2e-tests.result == 'cancelled' || needs.e2e-tests.result == 'failure'
     145      )
     146
     147    steps:
     148      - name: Dispatch workflow run
     149        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
     150        with:
     151          github-token: ${{ secrets.GHA_WORKFLOW_DISPATCH }}
     152          script: |
     153            github.rest.actions.createWorkflowDispatch({
     154              owner: context.repo.owner,
     155              repo: context.repo.repo,
     156              workflow_id: 'failed-workflow.yml',
     157              ref: '${{ github.ref_name }}',
     158              inputs: {
     159                run_id: '${{ github.run_id }}'
     160              }
     161            });
  • trunk/.github/workflows/javascript-tests.yml

    r53940 r53947  
    9999      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    100100      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     101
     102  failed-workflow:
     103    name: Failed workflow tasks
     104    runs-on: ubuntu-latest
     105    needs: [ test-js, slack-notifications ]
     106    if: |
     107      always() &&
     108      github.repository == 'WordPress/wordpress-develop' &&
     109      github.event_name != 'pull_request' &&
     110      github.run_number < 2 &&
     111      (
     112        needs.test-js.result == 'cancelled' || needs.test-js.result == 'failure'
     113      )
     114
     115    steps:
     116      - name: Dispatch workflow run
     117        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
     118        with:
     119          github-token: ${{ secrets.GHA_WORKFLOW_DISPATCH }}
     120          script: |
     121            github.rest.actions.createWorkflowDispatch({
     122              owner: context.repo.owner,
     123              repo: context.repo.repo,
     124              workflow_id: 'failed-workflow.yml',
     125              ref: '${{ github.ref_name }}',
     126              inputs: {
     127                run_id: '${{ github.run_id }}'
     128              }
     129            });
  • trunk/.github/workflows/php-compatibility.yml

    r53940 r53947  
    115115      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    116116      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     117
     118  failed-workflow:
     119    name: Failed workflow tasks
     120    runs-on: ubuntu-latest
     121    needs: [ php-compatibility, slack-notifications ]
     122    if: |
     123      always() &&
     124      github.repository == 'WordPress/wordpress-develop' &&
     125      github.event_name != 'pull_request' &&
     126      github.run_number < 2 &&
     127      (
     128        needs.php-compatibility.result == 'cancelled' || needs.php-compatibility.result == 'failure'
     129      )
     130
     131    steps:
     132      - name: Dispatch workflow run
     133        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
     134        with:
     135          github-token: ${{ secrets.GHA_WORKFLOW_DISPATCH }}
     136          script: |
     137            github.rest.actions.createWorkflowDispatch({
     138              owner: context.repo.owner,
     139              repo: context.repo.repo,
     140              workflow_id: 'failed-workflow.yml',
     141              ref: '${{ github.ref_name }}',
     142              inputs: {
     143                run_id: '${{ github.run_id }}'
     144              }
     145            });
  • trunk/.github/workflows/phpunit-tests.yml

    r53940 r53947  
    247247      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    248248      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     249
     250  failed-workflow:
     251    name: Failed workflow tasks
     252    runs-on: ubuntu-latest
     253    needs: [ test-php, slack-notifications ]
     254    if: |
     255      always() &&
     256      github.repository == 'WordPress/wordpress-develop' &&
     257      github.event_name != 'pull_request' &&
     258      github.run_number < 2 &&
     259      (
     260        needs.test-php.result == 'cancelled' || needs.test-php.result == 'failure'
     261      )
     262
     263    steps:
     264      - name: Dispatch workflow run
     265        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
     266        with:
     267          github-token: ${{ secrets.GHA_WORKFLOW_DISPATCH }}
     268          script: |
     269            github.rest.actions.createWorkflowDispatch({
     270              owner: context.repo.owner,
     271              repo: context.repo.repo,
     272              workflow_id: 'failed-workflow.yml',
     273              ref: '${{ github.ref_name }}',
     274              inputs: {
     275                run_id: '${{ github.run_id }}'
     276              }
     277            });
  • trunk/.github/workflows/slack-notifications.yml

    r53940 r53947  
    5454      - name: Determine the status of the previous attempt
    5555        id: previous-attempt-result
    56         uses: actions/github-script@d50f485531ba88479582bc2da03ff424389af5c1 # v6.1.1
     56        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
    5757        with:
    5858          script: |
     
    117117      - name: Get the commit message
    118118        id: current-commit-message
    119         uses: actions/github-script@d50f485531ba88479582bc2da03ff424389af5c1 # v6.1.1
     119        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
    120120        if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
    121121        with:
  • trunk/.github/workflows/test-coverage.yml

    r53940 r53947  
    194194      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    195195      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     196
     197  failed-workflow:
     198    name: Failed workflow tasks
     199    runs-on: ubuntu-latest
     200    needs: [ test-coverage-report, slack-notifications ]
     201    if: |
     202      always() &&
     203      github.repository == 'WordPress/wordpress-develop' &&
     204      github.event_name != 'pull_request' &&
     205      github.run_number < 2 &&
     206      (
     207        needs.test-coverage-report.result == 'cancelled' || needs.test-coverage-report.result == 'failure'
     208      )
     209
     210    steps:
     211      - name: Dispatch workflow run
     212        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
     213        with:
     214          github-token: ${{ secrets.GHA_WORKFLOW_DISPATCH }}
     215          script: |
     216            github.rest.actions.createWorkflowDispatch({
     217              owner: context.repo.owner,
     218              repo: context.repo.repo,
     219              workflow_id: 'failed-workflow.yml',
     220              ref: '${{ github.ref_name }}',
     221              inputs: {
     222                run_id: '${{ github.run_id }}'
     223              }
     224            });
  • trunk/.github/workflows/test-npm.yml

    r53940 r53947  
    172172      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    173173      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     174
     175  failed-workflow:
     176    name: Failed workflow tasks
     177    runs-on: ubuntu-latest
     178    needs: [ test-npm, test-npm-macos, slack-notifications ]
     179    if: |
     180      always() &&
     181      github.repository == 'WordPress/wordpress-develop' &&
     182      github.event_name != 'pull_request' &&
     183      github.run_number < 2 &&
     184      (
     185        needs.test-npm.result == 'cancelled' || needs.test-npm.result == 'failure' ||
     186        needs.test-npm-macos.result == 'cancelled' || needs.test-npm-macos.result == 'failure'
     187      )
     188
     189    steps:
     190      - name: Dispatch workflow run
     191        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
     192        with:
     193          github-token: ${{ secrets.GHA_WORKFLOW_DISPATCH }}
     194          script: |
     195            github.rest.actions.createWorkflowDispatch({
     196              owner: context.repo.owner,
     197              repo: context.repo.repo,
     198              workflow_id: 'failed-workflow.yml',
     199              ref: '${{ github.ref_name }}',
     200              inputs: {
     201                run_id: '${{ github.run_id }}'
     202              }
     203            });
  • trunk/.github/workflows/test-old-branches.yml

    r53940 r53947  
    6868    steps:
    6969      - name: Dispatch workflow run
    70         uses: actions/github-script@d50f485531ba88479582bc2da03ff424389af5c1 # v6.1.1
     70        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
    7171        if: ${{ github.event_name == 'push' || github.event.schedule == '0 0 15 * *' || matrix.branch == '6.0' }}
    7272        with:
    73           github-token: ${{ secrets.GHA_OLD_BRANCH_DISPATCH }}
     73          github-token: ${{ secrets.GHA_WORKFLOW_DISPATCH }}
    7474          script: |
    7575            github.rest.actions.createWorkflowDispatch({
Note: See TracChangeset for help on using the changeset viewer.