Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ci): resolve ch version from the pr's own ref (#71980)

Raúl Negrón-Oterod8dc43e5bf6a
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index e891f38fa7e8..7ea240cebc0b 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -1932,20 +1932,32 @@ jobs:
# Fully expanded compat matrix (version x shard group)
compat_matrix: ${{ steps.read-versions.outputs.compat_matrix }}
steps:
+ # Merge ref, for turbo-tests: it checks out the merge ref and mounts that config.xml.
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: .github/clickhouse-versions.json
sparse-checkout-cone-mode: false
+ # Head ref, for django: it checks out the PR head and mounts that config.xml. Reading
+ # its version from the merge ref instead would split an atomic version+config bump.
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
+ ref: ${{ github.event.pull_request.head.ref }}
+ sparse-checkout: .github/clickhouse-versions.json
+ sparse-checkout-cone-mode: false
+ path: head-tree
- name: Read ClickHouse versions from JSON
id: read-versions
+ env:
+ DJANGO_VERSIONS: head-tree/.github/clickhouse-versions.json
run: |
compat_shards="2"
echo "Using $compat_shards shard(s) per compat version"
# Oldest supported version for main Django tests (for max compatibility)
- oldest_supported=$(jq -r '.oldest_supported' .github/clickhouse-versions.json)
+ oldest_supported=$(jq -r '.oldest_supported' "$DJANGO_VERSIONS")
if [ -z "$oldest_supported" ] || [ "$oldest_supported" = "null" ]; then
- echo "::error::No oldest_supported version found in .github/clickhouse-versions.json"
+ echo "::error::No oldest_supported version found in $DJANGO_VERSIONS"
exit 1
fi
echo "oldest_supported_image=$oldest_supported" >> $GITHUB_OUTPUT
@@ -1961,15 +1973,15 @@ jobs:
echo "Local dev/hobby image for product tests: $local_image"
# Read all unique versions so we can derive compat coverage.
- all=$(jq -c '[.[]] | unique' .github/clickhouse-versions.json)
+ all=$(jq -c '[.[]] | unique' "$DJANGO_VERSIONS")
if [ "$all" = "[]" ] || [ -z "$all" ]; then
- echo "::error::No versions found in .github/clickhouse-versions.json"
+ echo "::error::No versions found in $DJANGO_VERSIONS"
exit 1
fi
echo "All CH versions found: $all"
# Compat coverage is only needed for non-oldest versions.
- compat_versions=$(jq -c --arg oldest "$oldest_supported" '[.[]] | unique | map(select(. != $oldest))' .github/clickhouse-versions.json)
+ compat_versions=$(jq -c --arg oldest "$oldest_supported" '[.[]] | unique | map(select(. != $oldest))' "$DJANGO_VERSIONS")
echo "Compat versions (excluding oldest): $compat_versions"
compat_count=$(jq -r 'length' <<< "$compat_versions")
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml
index 5f388c728dc0..21754397161f 100644
--- a/.github/workflows/ci-backend.yml
+++ b/.github/workflows/ci-backend.yml
@@ -3000,20 +3000,32 @@ jobs:
# Fully expanded compat matrix (version x shard group)
compat_matrix: ${{ steps.read-versions.outputs.compat_matrix }}
steps:
+ # Merge ref, for turbo-tests: it checks out the merge ref and mounts that config.xml.
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: .github/clickhouse-versions.json
sparse-checkout-cone-mode: false
+ # Head ref, for django: it checks out the PR head and mounts that config.xml. Reading
+ # its version from the merge ref instead would split an atomic version+config bump.
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
+ ref: ${{ github.event.pull_request.head.ref }}
+ sparse-checkout: .github/clickhouse-versions.json
+ sparse-checkout-cone-mode: false
+ path: head-tree
- name: Read ClickHouse versions from JSON
id: read-versions
+ env:
+ DJANGO_VERSIONS: head-tree/.github/clickhouse-versions.json
run: |
compat_shards="2"
echo "Using $compat_shards shard(s) per compat version"
# Oldest supported version for main Django tests (for max compatibility)
- oldest_supported=$(jq -r '.oldest_supported' .github/clickhouse-versions.json)
+ oldest_supported=$(jq -r '.oldest_supported' "$DJANGO_VERSIONS")
if [ -z "$oldest_supported" ] || [ "$oldest_supported" = "null" ]; then
- echo "::error::No oldest_supported version found in .github/clickhouse-versions.json"
+ echo "::error::No oldest_supported version found in $DJANGO_VERSIONS"
exit 1
fi
echo "oldest_supported_image=$oldest_supported" >> $GITHUB_OUTPUT
@@ -3029,15 +3041,15 @@ jobs:
echo "Local dev/hobby image for product tests: $local_image"
# Read all unique versions so we can derive compat coverage.
- all=$(jq -c '[.[]] | unique' .github/clickhouse-versions.json)
+ all=$(jq -c '[.[]] | unique' "$DJANGO_VERSIONS")
if [ "$all" = "[]" ] || [ -z "$all" ]; then
- echo "::error::No versions found in .github/clickhouse-versions.json"
+ echo "::error::No versions found in $DJANGO_VERSIONS"
exit 1
fi
echo "All CH versions found: $all"
# Compat coverage is only needed for non-oldest versions.
- compat_versions=$(jq -c --arg oldest "$oldest_supported" '[.[]] | unique | map(select(. != $oldest))' .github/clickhouse-versions.json)
+ compat_versions=$(jq -c --arg oldest "$oldest_supported" '[.[]] | unique | map(select(. != $oldest))' "$DJANGO_VERSIONS")
echo "Compat versions (excluding oldest): $compat_versions"
compat_count=$(jq -r 'length' <<< "$compat_versions")