Skip to content

Commit 064ac88

Browse files
committed
ci(pr_test_build_images): Test that the changed product sharding works
1 parent 9fce9a3 commit 064ac88

File tree

5 files changed

+62
-2
lines changed

5 files changed

+62
-2
lines changed

.github/workflows/pr_test_build_images.yaml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,52 @@ on:
99
# paths: []
1010

1111
jobs:
12-
dummy:
12+
# The set of paths for changed files (eg: airflow/Dockerfile, zookeeper/stackable/jmx/server.yaml)
13+
# ... limited to the product-paths (eg: airflow, zookeeper) that have a versions.py
14+
# Then for each _product_, shard based on product versions that have the "test" indicator
15+
generate_matrix:
16+
name: Generate Products and Versions Matrix
1317
runs-on: ubuntu-latest
1418
steps:
15-
- run: echo TODO
19+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
20+
- id: shard
21+
shell: bash
22+
run: |
23+
set -euo pipefail
24+
[ -n "$GITHUB_DEBUG" ] && set -x
25+
26+
PRODUCT_VERSION_PAIRS=$(
27+
# shellcheck disable=SC2016
28+
git diff --name-only \
29+
| cut --delimiter=/ --fields=1 | xargs -I {} find {} -type f -maxdepth 1 -name versions.toml \
30+
| xargs -r dirname \
31+
| xargs -I {} tomlq --raw-output --arg product "{}" '{$product: .versions | map_values(select(.build_on_pr)) | keys[]}' {}/versions.toml \
32+
| jq --slurp --compact-output '.'
33+
)
34+
echo "product_version_pairs=$PRODUCT_VERSION_PAIRS" | tee -a "$GITHUB_OUTPUT"
35+
36+
outputs:
37+
product_version_pairs: ${{ steps.shard.outputs.product_version_pairs }}
38+
39+
build:
40+
name: Build/Publish ${{ matrix.product_version_pairs.name }}-${{ matrix.product_version_pairs.version }}-${{ matrix.runner.arch }} Image
41+
needs: [generate_matrix]
42+
permissions:
43+
id-token: write
44+
runs-on: ${{ matrix.runner.name }}
45+
strategy:
46+
matrix:
47+
runner:
48+
- {name: "ubuntu-latest", arch: "amd64"}
49+
- {name: "ubicloud-standard-8-arm", arch: "arm64"}
50+
# Eg: [{"name":"airflow","version":"2.10.2"},{"name":"airflow","version":"2.9.3"},{"name":"zookeeper","version":"3.9.2"}]
51+
product_version_pairs: ${{ fromJson(needs.generate_matrix.outputs.product_version_pairs) }}
52+
steps:
53+
- name: Checkout Repository
54+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
55+
- env:
56+
PRODUCT_NAME: ${{ matrix.product_version_pairs.name }}
57+
PRODUCT_VERSION: ${{ matrix.product_version_pairs.version }}
58+
run: |
59+
echo "PRODUCT_NAME=$PRODUCT_NAME"
60+
echo "PRODUCT_VERSION=$PRODUCT_VERSION"

airflow/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ ARG TINI
8282
ARG TARGETARCH
8383
ARG STACKABLE_USER_UID
8484

85+
# Example change
86+
8587
LABEL name="Apache Airflow" \
8688
maintainer="[email protected]" \
8789
vendor="Stackable GmbH" \

airflow/versions.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[versions."2.9.2"]
2+
3+
[versions."2.9.3"]
4+
5+
[versions."2.10.2"]
6+
build_on_pr = true
7+
# This will come later. See: https://github.com/stackabletech/docker-images/issues/770
8+
# dependencies = { ... }

zookeeper/stackable/jmx/server.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
rules:
3+
# Example change
34
# replicated Zookeeper
45
- pattern: "org.apache.ZooKeeperService<name0=ReplicatedServer_id(\\d+)><>(\\w+)"
56
name: "zookeeper_$2"

zookeeper/versions.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[versions."3.9.2"]
2+
build_on_pr = true
3+
# This will come later. See: https://github.com/stackabletech/docker-images/issues/770
4+
# dependencies = { ... }

0 commit comments

Comments
 (0)