From a4ab9e5f089d38630c75871f2d7c34eed8b56b90 Mon Sep 17 00:00:00 2001 From: Sam Stewart Date: Mon, 16 Dec 2024 15:37:32 -0800 Subject: [PATCH 1/5] Create ec2-runner.yml --- .github/workflows/ec2-runner.yml | 83 ++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .github/workflows/ec2-runner.yml diff --git a/.github/workflows/ec2-runner.yml b/.github/workflows/ec2-runner.yml new file mode 100644 index 00000000000..a9716eba74d --- /dev/null +++ b/.github/workflows/ec2-runner.yml @@ -0,0 +1,83 @@ +name: EC2 Runner for All Workflows + +on: + workflow_dispatch: + +jobs: + setup-and-run: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Start EC2 runner + id: start-ec2-runner + uses: machulav/ec2-github-runner@v2 + with: + mode: start + github-token: ${{ secrets.GITHUB_TOKEN }} + ec2-image-id: ami-xxxxxxxxxxxxxxxxx # Replace with an appropriate AMI ID + ec2-instance-type: ${{ secrets.EC2_INSTANCE_TYPE }} + subnet-id: ${{ secrets.SUBNET_ID }} + security-group-id: ${{ secrets.SECURITY_GROUP_ID }} + + - name: Trigger all workflows in parallel + if: success() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RUNNER_LABEL: ${{ steps.start-ec2-runner.outputs.label }} + run: | + for workflow in .github/workflows/*.yml + do + if [[ "$workflow" != *"ec2-runner.yml"* ]]; then + echo "Triggering workflow: $workflow" + gh workflow run $(basename $workflow) --ref ${{ github.ref }} -f runner_label=$RUNNER_LABEL & + fi + done + wait + + - name: Wait for workflows to complete + run: | + while true; do + running=$(gh run list --workflow-name '.*' --json status --jq '.[] | select(.status=="in_progress") | .status' | wc -l) + if [ $running -eq 0 ]; then + echo "All workflows completed" + break + fi + echo "Workflows still running: $running" + sleep 60 + done + + - name: Collect results + run: | + mkdir -p test-results + for workflow in .github/workflows/*.yml + do + if [[ "$workflow" != *"ec2-runner.yml"* ]]; then + workflow_name=$(basename $workflow .yml) + echo "Collecting results for: $workflow_name" + gh run list --workflow=$workflow_name --json durationMs,conclusion,createdAt --jq '.[] | select(.conclusion != null) | [.createdAt, .conclusion, .durationMs] | @tsv' | sort -r | head -n1 > test-results/$workflow_name.txt + fi + done + + - name: Upload test results + uses: actions/upload-artifact@v2 + with: + name: test-results-${{ secrets.EC2_INSTANCE_TYPE }} + path: test-results/ + + - name: Stop EC2 runner + if: always() + uses: machulav/ec2-github-runner@v2 + with: + mode: stop + github-token: ${{ secrets.GITHUB_TOKEN }} + label: ${{ steps.start-ec2-runner.outputs.label }} + ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} From 5c927707b87f0db469ec8bae5d026577686e82cf Mon Sep 17 00:00:00 2001 From: Sam Stewart Date: Mon, 16 Dec 2024 15:52:20 -0800 Subject: [PATCH 2/5] Delete .github/workflows/ec2-runner.yml --- .github/workflows/ec2-runner.yml | 83 -------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 .github/workflows/ec2-runner.yml diff --git a/.github/workflows/ec2-runner.yml b/.github/workflows/ec2-runner.yml deleted file mode 100644 index a9716eba74d..00000000000 --- a/.github/workflows/ec2-runner.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: EC2 Runner for All Workflows - -on: - workflow_dispatch: - -jobs: - setup-and-run: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION }} - - - name: Start EC2 runner - id: start-ec2-runner - uses: machulav/ec2-github-runner@v2 - with: - mode: start - github-token: ${{ secrets.GITHUB_TOKEN }} - ec2-image-id: ami-xxxxxxxxxxxxxxxxx # Replace with an appropriate AMI ID - ec2-instance-type: ${{ secrets.EC2_INSTANCE_TYPE }} - subnet-id: ${{ secrets.SUBNET_ID }} - security-group-id: ${{ secrets.SECURITY_GROUP_ID }} - - - name: Trigger all workflows in parallel - if: success() - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RUNNER_LABEL: ${{ steps.start-ec2-runner.outputs.label }} - run: | - for workflow in .github/workflows/*.yml - do - if [[ "$workflow" != *"ec2-runner.yml"* ]]; then - echo "Triggering workflow: $workflow" - gh workflow run $(basename $workflow) --ref ${{ github.ref }} -f runner_label=$RUNNER_LABEL & - fi - done - wait - - - name: Wait for workflows to complete - run: | - while true; do - running=$(gh run list --workflow-name '.*' --json status --jq '.[] | select(.status=="in_progress") | .status' | wc -l) - if [ $running -eq 0 ]; then - echo "All workflows completed" - break - fi - echo "Workflows still running: $running" - sleep 60 - done - - - name: Collect results - run: | - mkdir -p test-results - for workflow in .github/workflows/*.yml - do - if [[ "$workflow" != *"ec2-runner.yml"* ]]; then - workflow_name=$(basename $workflow .yml) - echo "Collecting results for: $workflow_name" - gh run list --workflow=$workflow_name --json durationMs,conclusion,createdAt --jq '.[] | select(.conclusion != null) | [.createdAt, .conclusion, .durationMs] | @tsv' | sort -r | head -n1 > test-results/$workflow_name.txt - fi - done - - - name: Upload test results - uses: actions/upload-artifact@v2 - with: - name: test-results-${{ secrets.EC2_INSTANCE_TYPE }} - path: test-results/ - - - name: Stop EC2 runner - if: always() - uses: machulav/ec2-github-runner@v2 - with: - mode: stop - github-token: ${{ secrets.GITHUB_TOKEN }} - label: ${{ steps.start-ec2-runner.outputs.label }} - ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} From 84c194f5538c04333b5a48ffff83abb49cdf99ab Mon Sep 17 00:00:00 2001 From: samgst-amazon Date: Tue, 17 Dec 2024 10:38:53 -0800 Subject: [PATCH 3/5] update runners to codebuild --- .github/workflows/mac.yml | 2 +- .github/workflows/prerelease.yml | 10 +++++----- .github/workflows/qodana-check.yml | 2 +- .github/workflows/stale-issue-cleanup.yml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 6343f27c701..455e56a1bb6 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -13,7 +13,7 @@ jobs: build: name: Mac - runs-on: macos-latest + runs-on: codebuild-JB-linux-runner-${{ github.run_id }}-${{ github.run_attempt }} steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 4e5d0a67b2f..4228cd8e790 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: supported_versions: [ '2024.1', '2024.2', '2024.3' ] - runs-on: ubuntu-latest + runs-on: codebuild-JB-ubuntu-runner-${{ github.run_id }}-${{ github.run_attempt }} steps: - uses: actions/checkout@v4 with: @@ -50,7 +50,7 @@ jobs: strategy: matrix: supported_versions: [ '2024.1', '2024.2', '2024.3' ] - runs-on: ubuntu-latest + runs-on: codebuild-JB-ubuntu-runner-${{ github.run_id }}-${{ github.run_attempt }} steps: - uses: actions/checkout@v4 with: @@ -79,7 +79,7 @@ jobs: strategy: matrix: supported_versions: [ '2024.1', '2024.2', '2024.3' ] - runs-on: ubuntu-latest + runs-on: codebuild-JB-ubuntu-runner-${{ github.run_id }}-${{ github.run_attempt }} steps: - uses: actions/checkout@v4 with: @@ -106,7 +106,7 @@ jobs: retention-days: 1 generate_changelog: - runs-on: ubuntu-latest + runs-on: codebuild-JB-ubuntu-runner-${{ github.run_id }}-${{ github.run_attempt }} outputs: feature: ${{ steps.assign_output.outputs.feature }} tagname: ${{ steps.assign_output.outputs.tagname }} @@ -157,7 +157,7 @@ jobs: AWS_TOOLKIT_VERSION: ${{ needs.generate_changelog.outputs.version }} BRANCH: ${{ github.ref_name }} AWS_TOOLKIT_CHANGES: ${{ needs.generate_changelog.outputs.changes }} - runs-on: ubuntu-latest + runs-on: codebuild-JB-ubuntu-runner-${{ github.run_id }}-${{ github.run_attempt }} permissions: contents: write steps: diff --git a/.github/workflows/qodana-check.yml b/.github/workflows/qodana-check.yml index fef67e81c3c..856811fd73e 100644 --- a/.github/workflows/qodana-check.yml +++ b/.github/workflows/qodana-check.yml @@ -13,7 +13,7 @@ concurrency: jobs: qodana: - runs-on: ubuntu-latest + runs-on: codebuild-JB-ubuntu-runner-${{ github.run_id }}-${{ github.run_attempt }} permissions: contents: read # PR check diff --git a/.github/workflows/stale-issue-cleanup.yml b/.github/workflows/stale-issue-cleanup.yml index ce1ed2b33c9..561ac0b3514 100644 --- a/.github/workflows/stale-issue-cleanup.yml +++ b/.github/workflows/stale-issue-cleanup.yml @@ -13,7 +13,7 @@ jobs: permissions: issues: write # to label, comment and close issues (aws-actions/stale-issue-cleanup) - runs-on: ubuntu-latest + runs-on: codebuild-JB-ubuntu-runner-${{ github.run_id }}-${{ github.run_attempt }} name: Stale issues steps: - uses: aws-actions/stale-issue-cleanup@v6 From 4ed164642d436dd3c948b7664075963e886d1463 Mon Sep 17 00:00:00 2001 From: samgst-amazon Date: Tue, 17 Dec 2024 11:41:56 -0800 Subject: [PATCH 4/5] undo macos actionRunner --- .github/workflows/mac.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 455e56a1bb6..6343f27c701 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -13,7 +13,7 @@ jobs: build: name: Mac - runs-on: codebuild-JB-linux-runner-${{ github.run_id }}-${{ github.run_attempt }} + runs-on: macos-latest steps: - uses: actions/checkout@v2 From fdf6a120aba4dbe40bacf29d624960f8ee80468c Mon Sep 17 00:00:00 2001 From: samgst-amazon Date: Tue, 17 Dec 2024 13:13:00 -0800 Subject: [PATCH 5/5] retry builds