From e2a348b95f43460b64ad798f10893ffd0bdf04b9 Mon Sep 17 00:00:00 2001 From: David Zuelke Date: Thu, 16 May 2024 23:04:03 -0400 Subject: [PATCH] Add (multi-arch) heroku-24 to platform-sync.yml GUS-W-14667552 GUS-W-15158300 --- .github/workflows/platform-sync.yml | 40 +++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/platform-sync.yml b/.github/workflows/platform-sync.yml index a5d8eb665..924ced990 100644 --- a/.github/workflows/platform-sync.yml +++ b/.github/workflows/platform-sync.yml @@ -2,7 +2,7 @@ name: Platform packages sync from -develop/ to -stable/ run-name: Sync${{ inputs.dry-run == true && ' dry-run' || '' }} from dist-$STACK-develop/ to dist-$STACK-stable/ env: - stacks_list_for_shell_expansion: "{heroku-20,heroku-22}" + stacks_list_for_shell_expansion: "{heroku-20,heroku-22,heroku-24-amd64,heroku-24-arm64}" on: workflow_dispatch: @@ -17,6 +17,16 @@ on: type: boolean default: true required: false + stack-heroku-24-amd64: + description: 'Sync heroku-24 (amd64) packages' + type: boolean + default: true + required: false + stack-heroku-24-arm64: + description: 'Sync heroku-24 (arm64) packages' + type: boolean + default: true + required: false dry-run: description: 'Only list package changes, without syncing' type: boolean @@ -37,14 +47,14 @@ jobs: run: | echo '## Stacks to sync' >> "$GITHUB_STEP_SUMMARY" set -o pipefail - stacks=(${{ inputs.stack-heroku-20 == true && 'heroku-20' || ''}} ${{ inputs.stack-heroku-22 == true && 'heroku-22' || ''}}) + stacks=(${{ inputs.stack-heroku-20 == true && 'heroku-20' || ''}} ${{ inputs.stack-heroku-22 == true && 'heroku-22' || ''}} ${{ inputs.stack-heroku-24-amd64 == true && 'heroku-24-amd64' || ''}} ${{ inputs.stack-heroku-24-arm64 == true && 'heroku-24-arm64' || ''}}) printf -- "- %s\n" "${stacks[@]}" >> "$GITHUB_STEP_SUMMARY" echo -n "matrix=" >> "$GITHUB_OUTPUT" printf "%s\n" "${stacks[@]}" | jq -jcRn '[inputs|select(length>0)]' >> "$GITHUB_OUTPUT" docker-build: needs: stack-list if: ${{ needs.stack-list.outputs.stacks != '[]' && needs.stack-list.outputs.stacks != '' }} - runs-on: ubuntu-22.04 + runs-on: ${{ endsWith(matrix.stack, '-arm64') && 'pub-hk-ubuntu-22.04-arm-large' || 'ubuntu-22.04' }} strategy: matrix: stack: ${{ fromJSON(needs.stack-list.outputs.stacks) }} @@ -57,12 +67,24 @@ jobs: with: key: docker-cache-heroku-php-build-${{matrix.stack}}.${{github.sha}} path: /tmp/docker-cache.tar.gz + # The beta ARM64 runners don't yet ship with the normal installed tools. + - name: Install Docker (ARM64 only) + if: endsWith(matrix.stack, '-arm64') + run: | + sudo apt-get update --error-on=any + sudo apt-get install -y --no-install-recommends acl docker.io docker-buildx + sudo usermod -aG docker $USER + sudo setfacl --modify user:$USER:rw /var/run/docker.sock - name: Load cached Docker image if: steps.restore-docker.outputs.cache-hit == 'true' run: docker load -i /tmp/docker-cache.tar.gz - name: Build Docker image if: steps.restore-docker.outputs.cache-hit != 'true' - run: docker build --tag heroku-php-build-${{matrix.stack}}:${{github.sha}} --file support/build/_docker/${{matrix.stack}}.Dockerfile . + # our "input" stack might contain a "-amd64" or "-arm64" suffix, which we strip off for the Dockerfile name + run: | + shopt -s extglob + stackname_with_architecture=${{matrix.stack}} + docker build --tag heroku-php-build-${stackname_with_architecture}:${{github.sha}} --file support/build/_docker/${stackname_with_architecture%-?(amd|arm)64}.Dockerfile . - name: Save built Docker image if: steps.restore-docker.outputs.cache-hit != 'true' run: docker save heroku-php-build-${{matrix.stack}}:${{github.sha}} | gzip -1 > /tmp/docker-cache.tar.gz @@ -74,10 +96,10 @@ jobs: path: /tmp/docker-cache.tar.gz sync: needs: [stack-list, docker-build] - runs-on: ubuntu-22.04 strategy: matrix: stack: ${{ fromJSON(needs.stack-list.outputs.stacks) }} + runs-on: ${{ endsWith(matrix.stack, '-arm64') && 'pub-hk-ubuntu-22.04-arm-large' || 'ubuntu-22.04' }} env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -89,6 +111,14 @@ jobs: with: key: docker-cache-heroku-php-build-${{matrix.stack}}.${{github.sha}} path: /tmp/docker-cache.tar.gz + # The beta ARM64 runners don't yet ship with the normal installed tools. + - name: Install Docker (ARM64 only) + if: endsWith(matrix.stack, '-arm64') + run: | + sudo apt-get update --error-on=any + sudo apt-get install -y --no-install-recommends acl docker.io docker-buildx + sudo usermod -aG docker $USER + sudo setfacl --modify user:$USER:rw /var/run/docker.sock - name: Load cached Docker image run: docker load -i /tmp/docker-cache.tar.gz - name: ${{ inputs.dry-run == true && 'Dry-run sync of' || 'Sync' }} changed packages to production bucket