@@ -1111,17 +1111,36 @@ jobs:
11111111 echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}"
11121112 } >> "${GITHUB_STATE}"
11131113
1114- - name : Install psql
1115- run : |
1116- sudo apt-get update
1117- sudo apt-get install --yes --no-install-recommends \
1118- postgresql-client \
1119- ca-certificates \
1120- openssl
1121-
1122- - name : Install Python dependencies
1114+ - name : Image env sanitize
11231115 run : |
1124- pip3 install -r cicd/requirements.txt
1116+ BUILD_IMAGE_REQUIRED="true"
1117+ PUSH_IMAGE_REQUIRED="false"
1118+ # shellcheck disable=SC2235
1119+ if ( \
1120+ [ "${{ github.repository }}" = "stackql/stackql" ] \
1121+ || [ "${{ github.repository }}" != "stackql/stackql-devel" ] \
1122+ ) \
1123+ && [ "${{ vars.CI_SKIP_DOCKER_PUSH }}" != "true" ] \
1124+ && ( \
1125+ [ "${{ github.ref_type }}" = "branch" ] \
1126+ && [ "${{ github.ref_name }}" = "main" ] \
1127+ && [ "${{ github.event_name }}" = "push" ] \
1128+ ) \
1129+ || ( \
1130+ [ "${{ github.ref_type }}" = "tag" ] \
1131+ && [ "$( grep '^build-release.*' <<< '${{ github.ref_name }}' )" != "" ] \
1132+ ); \
1133+ then
1134+ PUSH_IMAGE_REQUIRED="true"
1135+ fi
1136+ if [ "${{ matrix.platform }}" == "linux/arm64" ] && [ "${PUSH_IMAGE_REQUIRED}" = "false" ]; then
1137+ BUILD_IMAGE_REQUIRED="false"
1138+ fi
1139+ {
1140+ echo "IMAGE_PLATFORM_SAN=$( sed 's/\//_/g' <<< '${{ matrix.platform }}' )";
1141+ echo "PUSH_IMAGE_REQUIRED=${PUSH_IMAGE_REQUIRED}";
1142+ echo "BUILD_IMAGE_REQUIRED=${BUILD_IMAGE_REQUIRED}";
1143+ } | tee -a "${GITHUB_ENV}"
11251144
11261145 - name : Extract Build Info and Persist
11271146 env :
@@ -1157,20 +1176,38 @@ jobs:
11571176 echo "GID=${GID}"
11581177 } >> "${GITHUB_ENV}"
11591178
1179+ - name : Install psql
1180+ if : env.BUILD_IMAGE_REQUIRED == 'true'
1181+ run : |
1182+ sudo apt-get update
1183+ sudo apt-get install --yes --no-install-recommends \
1184+ postgresql-client \
1185+ ca-certificates \
1186+ openssl
1187+
1188+ - name : Install Python dependencies
1189+ if : env.BUILD_IMAGE_REQUIRED == 'true'
1190+ run : |
1191+ pip3 install -r cicd/requirements.txt
1192+
11601193 - name : Generate rewritten registry for simulations
1194+ if : env.BUILD_IMAGE_REQUIRED == 'true'
11611195 run : |
11621196 python3 test/python/registry-rewrite.py --replacement-host=host.docker.internal
11631197
11641198 - name : Pull Docker base images for cache purposes
1199+ if : env.BUILD_IMAGE_REQUIRED == 'true'
11651200 run : |
11661201 docker pull golang:1.18.4-bullseye
11671202 docker pull ubuntu:22.04
11681203
11691204 - name : Pull Docker image for cache purposes
1205+ if : env.BUILD_IMAGE_REQUIRED == 'true'
11701206 run : |
11711207 docker pull stackql/stackql:latest || echo 'could not pull image for cache purposes'
11721208
11731209 - name : Create certificates for robot tests
1210+ if : env.BUILD_IMAGE_REQUIRED == 'true'
11741211 run : |
11751212 openssl req -x509 -keyout test/server/mtls/credentials/pg_server_key.pem -out test/server/mtls/credentials/pg_server_cert.pem -config test/server/mtls/openssl.cnf -days 365
11761213 openssl req -x509 -keyout test/server/mtls/credentials/pg_client_key.pem -out test/server/mtls/credentials/pg_client_cert.pem -config test/server/mtls/openssl.cnf -days 365
@@ -1180,41 +1217,11 @@ jobs:
11801217 openssl req -x509 -keyout cicd/vol/srv/credentials/pg_rubbish_key.pem -out cicd/vol/srv/credentials/pg_rubbish_cert.pem -config test/server/mtls/openssl.cnf -days 365
11811218
11821219 - name : Build image precursors
1220+ if : env.BUILD_IMAGE_REQUIRED == 'true'
11831221 run : |
11841222 docker compose -f docker-compose-credentials.yml build credentialsgen
11851223 docker compose build mockserver
11861224
1187- - name : Image env sanitize
1188- run : |
1189- BUILD_IMAGE_REQUIRED="true"
1190- PUSH_IMAGE_REQUIRED="false"
1191- # shellcheck disable=SC2235
1192- if ( \
1193- [ "${{ github.repository }}" = "stackql/stackql" ] \
1194- || [ "${{ github.repository }}" != "stackql/stackql-devel" ] \
1195- ) \
1196- && [ "${{ vars.CI_SKIP_DOCKER_PUSH }}" != "true" ] \
1197- && ( \
1198- [ "${{ github.ref_type }}" = "branch" ] \
1199- && [ "${{ github.ref_name }}" = "main" ] \
1200- && [ "${{ github.event_name }}" = "push" ] \
1201- ) \
1202- || ( \
1203- [ "${{ github.ref_type }}" = "tag" ] \
1204- && [ "$( grep '^build-release.*' <<< '${{ github.ref_name }}' )" != "" ] \
1205- ); \
1206- then
1207- PUSH_IMAGE_REQUIRED="true"
1208- fi
1209- if [ "${{ matrix.platform }}" == "linux/arm64" ] && [ "${PUSH_IMAGE_REQUIRED}" = "false" ]; then
1210- BUILD_IMAGE_REQUIRED="false"
1211- fi
1212- {
1213- echo "IMAGE_PLATFORM_SAN=$( sed 's/\//_/g' <<< '${{ matrix.platform }}' )";
1214- echo "PUSH_IMAGE_REQUIRED=${PUSH_IMAGE_REQUIRED}";
1215- echo "BUILD_IMAGE_REQUIRED=${BUILD_IMAGE_REQUIRED}";
1216- } | tee -a "${GITHUB_ENV}"
1217-
12181225 - name : Build Stackql image with buildx
12191226 uses : docker/build-push-action@v6
12201227 if : env.BUILD_IMAGE_REQUIRED == 'true'
@@ -1338,19 +1345,47 @@ jobs:
13381345 - linux/amd64
13391346 - linux/arm64
13401347 steps :
1348+
13411349 - name : Image env sanitize
13421350 run : |
1351+ BUILD_IMAGE_REQUIRED="true"
1352+ PUSH_IMAGE_REQUIRED="false"
1353+ # shellcheck disable=SC2235
1354+ if ( \
1355+ [ "${{ github.repository }}" = "stackql/stackql" ] \
1356+ || [ "${{ github.repository }}" != "stackql/stackql-devel" ] \
1357+ ) \
1358+ && [ "${{ vars.CI_SKIP_DOCKER_PUSH }}" != "true" ] \
1359+ && ( \
1360+ [ "${{ github.ref_type }}" = "branch" ] \
1361+ && [ "${{ github.ref_name }}" = "main" ] \
1362+ && [ "${{ github.event_name }}" = "push" ] \
1363+ ) \
1364+ || ( \
1365+ [ "${{ github.ref_type }}" = "tag" ] \
1366+ && [ "$( grep '^build-release.*' <<< '${{ github.ref_name }}' )" != "" ] \
1367+ ); \
1368+ then
1369+ PUSH_IMAGE_REQUIRED="true"
1370+ fi
1371+ if [ "${{ matrix.platform }}" == "linux/arm64" ] && [ "${PUSH_IMAGE_REQUIRED}" = "false" ]; then
1372+ BUILD_IMAGE_REQUIRED="false"
1373+ fi
13431374 {
1344- echo "IMAGE_PLATFORM_SAN=$( sed 's/\//_/g' <<< '${{ matrix.platform }}' )"
1345- } >> "${GITHUB_ENV}"
1375+ echo "IMAGE_PLATFORM_SAN=$( sed 's/\//_/g' <<< '${{ matrix.platform }}' )";
1376+ echo "PUSH_IMAGE_REQUIRED=${PUSH_IMAGE_REQUIRED}";
1377+ echo "BUILD_IMAGE_REQUIRED=${BUILD_IMAGE_REQUIRED}";
1378+ } | tee -a "${GITHUB_ENV}"
13461379
13471380 - name : Download artifact
13481381 uses : actions/download-artifact@v4
1382+ if : env.PUSH_IMAGE_REQUIRED == 'true'
13491383 with :
13501384 name : myimage-${{ env.IMAGE_PLATFORM_SAN }}
13511385 path : ${{ runner.temp }}
13521386
13531387 - name : Load image
1388+ if : env.PUSH_IMAGE_REQUIRED == 'true'
13541389 run : |
13551390 docker load --input ${{ runner.temp }}/myimage-${{ env.IMAGE_PLATFORM_SAN }}.tar
13561391 docker image ls -a
@@ -1390,14 +1425,14 @@ jobs:
13901425 } >> "${GITHUB_ENV}"
13911426
13921427 - name : Login to Docker Hub
1393- 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') ) }}
1428+ if : env.PUSH_IMAGE_REQUIRED == 'true'
13941429 uses : docker/login-action@v2
13951430 with :
13961431 username : ${{ secrets.DOCKERHUB_USERNAME }}
13971432 password : ${{ secrets.DOCKERHUB_TOKEN }}
13981433
13991434 - name : Push stackql image to Docker Hub
1400- 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') ) }}
1435+ if : env.PUSH_IMAGE_REQUIRED == 'true'
14011436 uses : docker/build-push-action@v6
14021437 with :
14031438 context : .
0 commit comments