Switch AMI build back to simple approach with runner cleanup #10
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: AMI Prebuild | |
| # Schedule to run every 15 days to keep runner agent up to date | |
| # GitHub stops routing jobs to runners with agents older than 30 days | |
| on: | |
| # TODO: Remove push trigger after testing | |
| push: | |
| branches: [ji/ami-prebuild] | |
| paths: | |
| - ".github/workflows/ami-prebuild.yml" | |
| - ".github/packer/**" | |
| schedule: | |
| # Run at 00:00 UTC on the 1st and 16th of each month (~15 days apart) | |
| - cron: "0 0 1,16 * *" | |
| workflow_dispatch: | |
| inputs: | |
| arch: | |
| description: "Architecture to build (leave empty for both)" | |
| required: false | |
| type: choice | |
| options: | |
| - "" | |
| - x64 | |
| - arm64 | |
| retention-days: | |
| description: "Days until AMI deprecation" | |
| required: false | |
| type: number | |
| default: 30 | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| id-token: write | |
| env: | |
| AWS_REGION: eu-west-1 | |
| jobs: | |
| # Build AMI by running on a runs-on instance and creating an image from it | |
| build-x64: | |
| name: "Build AMI (x64)" | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.arch == '' || github.event.inputs.arch == 'x64' }} | |
| runs-on: | |
| - runs-on=${{ github.run_id }} | |
| - runner=2cpu-linux-x64 | |
| - family=m7i+m7i-flex+m7a | |
| - tag=ami-build-x64 | |
| timeout-minutes: 60 | |
| outputs: | |
| ami-id: ${{ steps.build-ami.outputs.ami-id }} | |
| ami-name: ${{ steps.build-ami.outputs.ami-name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::375504701696:role/GitHubBenchmarkRole | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Build AMI | |
| id: build-ami | |
| uses: ./.github/actions/build-ami | |
| with: | |
| arch: x64 | |
| ami-prefix: vortex-ci | |
| retention-days: ${{ inputs.retention-days || '30' }} | |
| - name: Summary | |
| run: | | |
| echo "## AMI Build Complete (x64)" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **AMI ID:** ${{ steps.build-ami.outputs.ami-id }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **AMI Name:** ${{ steps.build-ami.outputs.ami-name }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Deprecation:** ${{ inputs.retention-days || '30' }} days" >> $GITHUB_STEP_SUMMARY | |
| build-arm64: | |
| name: "Build AMI (arm64)" | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.arch == '' || github.event.inputs.arch == 'arm64' }} | |
| runs-on: | |
| - runs-on=${{ github.run_id }} | |
| - runner=2cpu-linux-arm64 | |
| - family=m7g | |
| - tag=ami-build-arm64 | |
| timeout-minutes: 60 | |
| outputs: | |
| ami-id: ${{ steps.build-ami.outputs.ami-id }} | |
| ami-name: ${{ steps.build-ami.outputs.ami-name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::375504701696:role/GitHubBenchmarkRole | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Build AMI | |
| id: build-ami | |
| uses: ./.github/actions/build-ami | |
| with: | |
| arch: arm64 | |
| ami-prefix: vortex-ci | |
| retention-days: ${{ inputs.retention-days || '30' }} | |
| - name: Summary | |
| run: | | |
| echo "## AMI Build Complete (arm64)" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **AMI ID:** ${{ steps.build-ami.outputs.ami-id }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **AMI Name:** ${{ steps.build-ami.outputs.ami-name }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Deprecation:** ${{ inputs.retention-days || '30' }} days" >> $GITHUB_STEP_SUMMARY | |
| # Test the newly built AMI | |
| test-x64: | |
| name: "Test AMI (x64)" | |
| needs: build-x64 | |
| runs-on: | |
| - runs-on=${{ github.run_id }} | |
| - family=m7i+m7i-flex+m7a | |
| - cpu=4 | |
| - image=vortex-ci-amd64 | |
| - tag=test-ami-x64 | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Verify tools are installed | |
| run: | | |
| echo "Checking installed tools..." | |
| cargo --version | |
| rustc --version | |
| rustup show | |
| protoc --version | |
| flatc --version | |
| - name: Run cargo check | |
| run: cargo check --locked | |
| test-arm64: | |
| name: "Test AMI (arm64)" | |
| needs: build-arm64 | |
| runs-on: | |
| - runs-on=${{ github.run_id }} | |
| - family=m7g | |
| - cpu=4 | |
| - image=vortex-ci-arm64 | |
| - tag=test-ami-arm64 | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Verify tools are installed | |
| run: | | |
| echo "Checking installed tools..." | |
| cargo --version | |
| rustc --version | |
| rustup show | |
| protoc --version | |
| flatc --version | |
| - name: Run cargo check | |
| run: cargo check --locked |