@@ -1069,12 +1069,30 @@ jobs:
10691069 with :
10701070 name : stackql_darwin_arm64
10711071 path : build/stackql
1072-
1072+
1073+ # # Docker Build and Push Jobs
1074+ # # based loosely on patterns described in:
1075+ # # - https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
1076+ # # - https://docs.docker.com/build/ci/github-actions/share-image-jobs/
10731077 dockerbuild :
10741078 name : Docker Build
10751079 runs-on : ubuntu-latest-m
10761080 timeout-minutes : ${{ vars.DEFAULT_JOB_TIMEOUT_MIN == '' && 120 || vars.DEFAULT_JOB_TIMEOUT_MIN }}
1077- steps :
1081+ strategy :
1082+ fail-fast : false
1083+ matrix :
1084+ platform :
1085+ - linux/amd64
1086+ - linux/arm64
1087+
1088+ steps :
1089+
1090+ - name : Docker meta
1091+ id : meta
1092+ uses : docker/metadata-action@v5
1093+ with :
1094+ images : |
1095+ ${{ env.STACKQL_IMAGE_NAME }}
10781096
10791097 - name : Check out code into the Go module directory
10801098@@ -1174,18 +1192,26 @@ jobs:
11741192 docker compose build mockserver
11751193
11761194 - name : Build Stackql image with buildx
1177- uses : docker/build-push-action@v5
1195+ uses : docker/build-push-action@v6
11781196 with :
11791197 context : .
11801198 build-args : |
11811199 BUILDMAJORVERSION=${{env.BUILDMAJORVERSION}}
11821200 BUILDMINORVERSION=${{env.BUILDMINORVERSION}}
11831201 BUILDPATCHVERSION=${{env.BUILDPATCHVERSION}}
11841202 push : false
1203+ platforms : ${{ matrix.platform }}
11851204 target : app
11861205 no-cache : ${{ vars.CI_DOCKER_BUILD_NO_CACHE == 'true' && true || false }}
11871206 load : true
1188- tags : ${{ env.STACKQL_IMAGE_NAME }}:${{github.sha}},${{ env.STACKQL_IMAGE_NAME }}:v${{env.BUILDMAJORVERSION}}.${{env.BUILDMINORVERSION}}.${{env.BUILDPATCHVERSION}},${{ env.STACKQL_IMAGE_NAME }}:latest
1207+ tags : ${{ env.STACKQL_IMAGE_NAME }}:${{ github.sha }},${{ env.STACKQL_IMAGE_NAME }}:v${{env.BUILDMAJORVERSION}}.${{env.BUILDMINORVERSION}}.${{env.BUILDPATCHVERSION}},${{ env.STACKQL_IMAGE_NAME }}
1208+ outputs : type=docker,dest=${{ runner.temp }}/myimage-${{ matrix.platform }}.tar
1209+
1210+ - name : Upload artifact
1211+ uses : actions/upload-artifact@v4
1212+ with :
1213+ name : myimage-${{ matrix.platform }}
1214+ path : ${{ runner.temp }}/myimage-${{ matrix.platform }}.tar
11891215
11901216 - name : Debug info
11911217 run : |
@@ -1223,13 +1249,13 @@ jobs:
12231249 echo ""
12241250
12251251 - name : Run robot mocked functional tests
1226- if : success() && env.CI_IS_EXPRESS != 'true'
1252+ if : success() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64'
12271253 timeout-minutes : ${{ vars.DEFAULT_STEP_TIMEOUT_MIN == '' && 20 || vars.DEFAULT_STEP_TIMEOUT_MIN }}
12281254 run : |
12291255 python cicd/python/build.py --robot-test --config='{ "variables": { "EXECUTION_PLATFORM": "docker" } }'
12301256
12311257 - name : Run POSTGRES BACKEND robot mocked functional tests
1232- if : success() && env.CI_IS_EXPRESS != 'true'
1258+ if : success() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64'
12331259 timeout-minutes : ${{ vars.DEFAULT_STEP_TIMEOUT_MIN == '' && 20 || vars.DEFAULT_STEP_TIMEOUT_MIN }}
12341260 run : |
12351261 echo "## Stray flask apps to be killed before robot tests ##"
@@ -1249,12 +1275,12 @@ jobs:
12491275 python cicd/python/build.py --robot-test --config='{ "variables": { "EXECUTION_PLATFORM": "docker", "SHOULD_RUN_DOCKER_EXTERNAL_TESTS": true, "SQL_BACKEND": "postgres_tcp" } }'
12501276
12511277 - name : Output from mocked functional tests
1252- if : always() && env.CI_IS_EXPRESS != 'true'
1278+ if : always() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64'
12531279 run : |
12541280 cat ./test/robot/reports/output.xml
12551281
12561282 - name : Run robot integration tests
1257- if : env.AZURE_CLIENT_SECRET != '' && startsWith(env.STATE_SOURCE_TAG, 'build-release')
1283+ if : env.AZURE_CLIENT_SECRET != '' && startsWith(env.STATE_SOURCE_TAG, 'build-release') && matrix.platform == 'linux/amd64'
12581284 env :
12591285 AZURE_CLIENT_ID : ${{ secrets.AZURE_CLIENT_ID }}
12601286 AZURE_CLIENT_SECRET : ${{ secrets.AZURE_CLIENT_SECRET }}
@@ -1266,24 +1292,45 @@ jobs:
12661292 echo "## End ##"
12671293 python cicd/python/build.py --robot-test-integration --config='{ "variables": { "EXECUTION_PLATFORM": "docker" } }'
12681294
1295+ # - name: Hack to avoid docker buildx failures
1296+ # run: |
1297+ # sudo rm -rf cicd/vol/postgres/persist
1298+
1299+ dockerpush :
1300+ runs-on : ubuntu-latest
1301+ needs : dockerbuild
1302+ strategy :
1303+ fail-fast : false
1304+ matrix :
1305+ platform :
1306+ - linux/amd64
1307+ - linux/arm64
1308+ steps :
1309+ - name : Download artifact
1310+ uses : actions/download-artifact@v4
1311+ with :
1312+ name : myimage-${{ matrix.platform }}
1313+ path : ${{ runner.temp }}/myimage-${{ matrix.platform }}.tar
1314+
1315+ - name : Load image
1316+ run : |
1317+ docker load --input ${{ runner.temp }}/myimage-${{ matrix.platform }}.tar
1318+ docker image ls -a
1319+
12691320 - name : Login to Docker Hub
12701321 if : ${{ ( success() && github.ref_type == 'branch' && github.ref_name == 'main' && github.repository == 'stackql/stackql' && github.event_name == 'push' ) || ( success() && github.ref_type == 'tag' && startsWith(github.ref_name, 'build-release') ) }}
12711322 uses : docker/login-action@v2
12721323 with :
12731324 username : ${{ secrets.DOCKERHUB_USERNAME }}
12741325 password : ${{ secrets.DOCKERHUB_TOKEN }}
12751326
1276- - name : Hack to avoid docker buildx failures
1277- run : |
1278- sudo rm -rf cicd/vol/postgres/persist
1279-
12801327 - name : Push stackql image to Docker Hub
12811328 if : ${{ (github.repository == 'stackql/stackql' || github.repository == 'stackql/stackql-devel') && vars.CI_SKIP_DOCKER_PUSH != 'true' && ( success() && github.ref_type == 'branch' && github.ref_name == 'main' && github.event_name == 'push' ) || ( success() && github.ref_type == 'tag' && startsWith(github.ref_name, 'build-release') ) }}
1282- uses : docker/build-push-action@v5
1329+ uses : docker/build-push-action@v6
12831330 with :
12841331 context : .
12851332 no-cache : ${{ vars.CI_DOCKER_BUILD_NO_CACHE == 'true' && true || false }}
1286- platforms : linux/arm64,linux/amd64
1333+ platforms : ${{ matrix.platform }}
12871334 build-args : |
12881335 BUILDMAJORVERSION=${{env.BUILDMAJORVERSION}}
12891336 BUILDMINORVERSION=${{env.BUILDMINORVERSION}}
0 commit comments