From 089f45208e4586c44c926473b3299a27137c208b Mon Sep 17 00:00:00 2001 From: Pascal Zimmermann Date: Wed, 18 Nov 2026 22:07:03 +0100 Subject: [PATCH] feat: Set the V2 integrationtest version --- .github/scripts/resolve-capi-version.sh | 48 ------------------- .github/workflows/integration-test.yml | 31 ++++-------- .../client/CloudFoundryClient.java | 4 +- 3 files changed, 11 insertions(+), 72 deletions(-) delete mode 100755 .github/scripts/resolve-capi-version.sh diff --git a/.github/scripts/resolve-capi-version.sh b/.github/scripts/resolve-capi-version.sh deleted file mode 100755 index 5ff2dfec33..0000000000 --- a/.github/scripts/resolve-capi-version.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -# Prints the newest capi-release version whose CC API (v2) version equals SUPPORTED_API_VERSION -# from CloudFoundryClient.java. Needs only git and curl, no GitHub API and so no token. -# -# A capi-release tag pins cloud_controller_ng as a submodule, and that repo records its v2 API -# version in config/version_v2. The release notes aren't reliable for this. The v2 version only -# grows with the tags, so a binary search over the sorted tags is enough. -set -euo pipefail - -source_file="$(dirname "$0")/../../cloudfoundry-client/src/main/java/org/cloudfoundry/client/CloudFoundryClient.java" -target="$(sed -n 's/.*String SUPPORTED_API_VERSION = "\([0-9.]*\)";.*/\1/p' "$source_file")" -[ -n "$target" ] || { echo "SUPPORTED_API_VERSION not found in $source_file" >&2; exit 1; } - -workdir="$(mktemp -d)" -trap 'rm -rf "$workdir"' EXIT -# commits and trees only, which is all it takes to read the submodule commit of a tag -git clone --quiet --bare --filter=blob:none https://github.com/cloudfoundry/capi-release.git "$workdir/capi-release" - -mapfile -t tags < <(git -C "$workdir/capi-release" tag -l | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V) - -v2_version() { - local sha - sha="$(git -C "$workdir/capi-release" ls-tree "$1" src/cloud_controller_ng | awk '{print $3}')" - curl -fsSL --retry 3 "https://raw.githubusercontent.com/cloudfoundry/cloud_controller_ng/$sha/config/version_v2" | tr -d '[:space:]' -} - -# highest index whose v2 version is <= target -lo=0 -hi=$((${#tags[@]} - 1)) -found=-1 -while [ "$lo" -le "$hi" ]; do - mid=$(((lo + hi) / 2)) - v="$(v2_version "${tags[$mid]}")" - if [ "$(printf '%s\n%s\n' "$v" "$target" | sort -V | tail -1)" = "$target" ]; then - found=$mid - lo=$((mid + 1)) - else - hi=$((mid - 1)) - fi -done - -if [ "$found" -lt 0 ] || [ "$(v2_version "${tags[$found]}")" != "$target" ]; then - echo "No capi-release found for CC API version $target" >&2 - exit 1 -fi - -echo "CC API $target -> capi-release ${tags[$found]}" >&2 -echo "${tags[$found]}" diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index c27d202142..eb73173595 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -9,7 +9,7 @@ on: required: false default: '[8, 11, 17, 21]' preview: - description: 'Deploy the latest cf-deployment versions instead of the default ones' + description: 'Deploy the latest cf-deployment versions instead of the default ones (CAPI stays pinned)' type: boolean required: false default: false @@ -23,7 +23,7 @@ on: required: false default: '[8, 11, 17, 21]' preview: - description: 'Deploy the latest cf-deployment versions instead of the default ones' + description: 'Deploy the latest cf-deployment versions instead of the default ones (CAPI stays pinned)' type: boolean required: false default: false @@ -55,15 +55,6 @@ jobs: - uses: actions/checkout@v7 with: submodules: recursive - # Validation runs deploy the capi-release that matches SUPPORTED_API_VERSION. Preview runs - # (scheduled, or started by hand with `preview`) keep the latest versions. - - name: Resolve CAPI version - id: capi - if: ${{ !(inputs.preview || github.event_name == 'schedule') }} - run: | - # separate assignment, so that a failing resolver fails the step - version="$(.github/scripts/resolve-capi-version.sh)" - echo "version=$version" >> "$GITHUB_OUTPUT" # All components share one Postgres, which runs out of its default 100 connections during a full # test run. Written first, the CAPI override below appends to the same file. - name: Write PostgreSQL values override @@ -74,23 +65,19 @@ jobs: extendedConfiguration: | max_connections = 500 EOF - # Overrides the capi chart version of kind-deployment (merged last by Helmfile). - # kind-deployment's helmfile passes cloudController.appDomains, which the capi chart only - # accepts from 1.241.0 on (1.240.0 fails its values schema), so older matches are raised to it. + # Pins the capi chart of kind-deployment (merged last by Helmfile) for every run, preview runs + # included, because 5.x.x needs the CC v2 API. 1.249.0 is the last capi chart that serves v2: + # from 1.249.1-1 on, v2 is behind cloudController.config.temporaryEnableV2, which defaults to + # false. Keep CAPI_VERSION in sync with SUPPORTED_API_VERSION (2.299.0) and + # SUPPORTED_API_VERSION_V3 (3.234.0) in CloudFoundryClient.java. - name: Write CAPI values override - if: ${{ steps.capi.outputs.version != '' }} env: - MIN_CAPI_VERSION: 1.241.0 - MATCHED_CAPI_VERSION: ${{ steps.capi.outputs.version }} + CAPI_VERSION: 1.249.0 run: | - version="$(printf '%s\n%s\n' "$MIN_CAPI_VERSION" "$MATCHED_CAPI_VERSION" | sort -V | tail -1)" - if [ "$version" != "$MATCHED_CAPI_VERSION" ]; then - echo "::warning::capi-release $MATCHED_CAPI_VERSION matches SUPPORTED_API_VERSION but is too old for kind-deployment, deploying $version" - fi cat >> "$RUNNER_TEMP/cf-values.yaml" <