From 2f654ce851cd688aae6667fb8f7f43732643860e Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 16 May 2024 13:21:27 +0000 Subject: [PATCH 1/2] ci-consistency as external check --- .github/workflows/ci.yml | 33 ++++++++++++++++++++++++++++++ .github/workflows/setup-runner.yml | 24 ---------------------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aeab526ec8..32441242a88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,39 @@ jobs: username: ${{ github.event.pull_request.user.login || github.actor }} runner_type: builder-x86 secrets: inherit + # job just to alert that you *might* hit missing CI files, but if not you can continue + + ci-consistency: + runs-on: ubuntu-latest + # Only check PRs for consistency (not master) + if: ${{ github.event.pull_request.head.sha != '' }} + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Checkout Merge Pipeline Files + uses: actions/checkout@v4 + with: + path: merge-commit-pipeline-files + sparse-checkout: | + .github/workflows/ci.yml + .github/workflows/setup-runner.yml + + - name: Ensure CI Consistency + if: ${{ github.event.pull_request.head.sha != '' }} + run: | + # Compare the checked-out CI configuration files with the reference files + if ! git diff --no-index .github/workflows/ci.yml merge-commit-pipeline-files/.github/workflows/ci.yml; then + echo "Error: ci.yml changes in master (or PR base). *Usually* you can continue just fine. If you hit trouble with missing files, please merge these changes. This is to alert about potential surprises from Github Action's merge behavior." + exit 1 + fi + if ! git diff --no-index .github/workflows/setup-runner.yml merge-commit-pipeline-files/.github/workflows/setup-runner.yml; then + echo "Error: setup-runner.yml changes in master (or PR base). *Usually* you can continue just fine. If you hit trouble with missing files, please merge these changes. This is to alert about potential surprises from Github Action's merge behavior." + exit 1 + fi + build: needs: setup runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 diff --git a/.github/workflows/setup-runner.yml b/.github/workflows/setup-runner.yml index de6a0d6e893..3434e3432b3 100644 --- a/.github/workflows/setup-runner.yml +++ b/.github/workflows/setup-runner.yml @@ -53,30 +53,6 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - - name: Checkout Merge Pipeline Files - uses: actions/checkout@v4 - # Only check PRs for consistency (not master) - if: ${{ github.event.pull_request.head.sha != '' }} - with: - path: merge-commit-pipeline-files - sparse-checkout: | - .github/workflows/ci.yml - .github/workflows/setup-runner.yml - - - name: Ensure CI Consistency - # Only check PRs for consistency (not master) - if: ${{ github.event.pull_request.head.sha != '' }} - run: | - # Compare the checked-out CI configuration files with the reference files - if ! git diff --no-index .github/workflows/ci.yml merge-commit-pipeline-files/.github/workflows/ci.yml; then - echo "Error: ci.yml changes in master (or PR base). Please merge these changes. This is to prevent surprises from Github Action's merge behavior." - exit 1 - fi - if ! git diff --no-index .github/workflows/setup-runner.yml merge-commit-pipeline-files/.github/workflows/setup-runner.yml; then - echo "Error: setup-runner.yml changes in master (or PR base). Please merge these changes. This is to prevent surprises from Github Action's merge behavior." - exit 1 - fi - - name: Start EC2 runner uses: ./.github/ensure-builder with: From 8903009b37a50ef74f1d6682e263bb4b3f5e9ddb Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 16 May 2024 15:26:49 +0000 Subject: [PATCH 2/2] spot retry fix --- .github/spot-runner-action/dist/index.js | 3 +++ .github/spot-runner-action/src/ec2.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/spot-runner-action/dist/index.js b/.github/spot-runner-action/dist/index.js index b34f8c07dc9..88bf44b6b03 100644 --- a/.github/spot-runner-action/dist/index.js +++ b/.github/spot-runner-action/dist/index.js @@ -138,6 +138,9 @@ class Ec2Instance { this.client = new aws_sdk_1.default.EC2({ credentials: credentials, region: this.config.awsRegion, + maxRetries: 3, + // base 10 seconds for the exponential backoff, up to 3 times + retryDelayOptions: { base: 10000 } }); } return this.client; diff --git a/.github/spot-runner-action/src/ec2.ts b/.github/spot-runner-action/src/ec2.ts index 83211f7bba4..37026ed131e 100644 --- a/.github/spot-runner-action/src/ec2.ts +++ b/.github/spot-runner-action/src/ec2.ts @@ -51,6 +51,9 @@ export class Ec2Instance { this.client = new AWS.EC2({ credentials: credentials, region: this.config.awsRegion, + maxRetries: 3, + // base 10 seconds for the exponential backoff, up to 3 times + retryDelayOptions: {base: 10000} }); } return this.client;