Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions .github/scripts/resolve-capi-version.sh

This file was deleted.

30 changes: 30 additions & 0 deletions .github/scripts/resolve-latest-capi-chart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Prints the newest version of the capi Helm chart (ghcr.io/cloudfoundry/helm/capi) that
# kind-deployment deploys. Needs only curl and python3, the registry allows anonymous pulls.
#
# Only release versions (1.252.0) and chart revisions of a release (1.252.1-1) count. Other tags,
# such as 1.237.1-fix1, are skipped.
set -euo pipefail

repository="cloudfoundry/helm/capi"
token="$(curl -fsSL --retry 3 "https://ghcr.io/token?scope=repository:$repository:pull" |
python3 -c 'import json, sys; print(json.load(sys.stdin)["token"])')"

headers="$(mktemp)"
trap 'rm -f "$headers"' EXIT
tags="$(curl -fsSL --retry 3 -D "$headers" -H "Authorization: Bearer $token" "https://ghcr.io/v2/$repository/tags/list?n=10000" |
python3 -c 'import json, sys; print("\n".join(json.load(sys.stdin)["tags"] or []))')"

# The registry lists the tags in push order, so a truncated (paginated) list would miss the newest
if grep -qi '^link:.*rel="next"' "$headers"; then
echo "The tag list of ghcr.io/$repository is paginated, which this script doesn't support" >&2
exit 1
fi

# grep fails without a match, which would end the script (pipefail) before the error below
version="$(printf '%s\n' "$tags" | { grep -E '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$' || true; } | sort -V | tail -1)"

[ -n "$version" ] || { echo "No capi chart version found in ghcr.io/$repository" >&2; exit 1; }

echo "latest capi chart -> $version" >&2
echo "$version"
83 changes: 51 additions & 32 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
required: false
default: '[17, 21]'
preview:
description: 'Deploy the latest cf-deployment versions instead of the default ones'
description: 'Deploy the latest cf-deployment versions and capi chart instead of the default ones (v3 job only)'
type: boolean
required: false
default: false
Expand All @@ -23,7 +23,7 @@ on:
required: false
default: '[17, 21]'
preview:
description: 'Deploy the latest cf-deployment versions instead of the default ones'
description: 'Deploy the latest cf-deployment versions and capi chart instead of the default ones (v3 job only)'
type: boolean
required: false
default: false
Expand All @@ -45,59 +45,77 @@ jobs:
integration-test:
if: ${{ github.event_name != 'schedule' || github.repository == 'cloudfoundry/cf-java-client' }}
runs-on: ubuntu-latest
timeout-minutes: 120
# The v2 job runs about three quarters of the tests and takes about 1h40m.
timeout-minutes: ${{ matrix.api == 'v2' && 150 || 60 }}
strategy:
fail-fast: false
matrix:
java: ${{ fromJSON(inputs.java-versions || (github.event_name == 'schedule' && '[21]' || '[17, 21]')) }}
name: Java ${{ matrix.java }} integration test${{ (inputs.preview || github.event_name == 'schedule') && ' (preview)' || '' }}
api: [v2, v3]
include:
# Newer CAPI releases disable the CC v2 API, so the v2 tests (@RequiresV2Api, JUnit tag
# "v2") run against a dedicated, pinned CAPI. The capi chart 1.249.0 is the last one that
# serves v2: from 1.249.1-1 on, v2 is behind cloudController.config.temporaryEnableV2,
# which kind-deployment v0.26.0 doesn't set. Newer kind-deployment versions don't deploy
# these older charts any more (their capi values schema changed with 1.249.1-1).
# Keep capi-version in sync with SUPPORTED_API_VERSION (2.299.0) in CloudFoundryClient.java.
- api: v2
kind-deployment-ref: b42a88a35756595bd4108d2b525ded5b014a9515 # v0.26.0
capi-version: 1.249.0
test-selection: -Dgroups=v2
skip-v2-tests: 'false'
# All other tests run with v2 disabled, against the capi chart of SUPPORTED_API_VERSION_V3
# (3.237.0, capi-release 1.252.0), so that a new capi chart can't break validation runs.
# Preview runs deploy the latest capi chart instead.
# Keep capi-version in sync with SUPPORTED_API_VERSION_V3 in CloudFoundryClient.java.
- api: v3
kind-deployment-ref: 6b6882c54a23bfd23982299052ae681f481ad231 # main, 2026-11-13
capi-version: 1.252.1-1
test-selection: -DexcludedGroups=v2
skip-v2-tests: 'true'
name: Java ${{ matrix.java }} ${{ matrix.api }} integration test${{ matrix.api == 'v3' && (inputs.preview || github.event_name == 'schedule') && ' (preview)' || '' }}
steps:
- 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') }}
env:
CAPI_VERSION: ${{ matrix.capi-version }}
# The v2 job stays on its pinned version, preview runs only affect the v3 job
USE_LATEST_CAPI: ${{ matrix.api == 'v3' && (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"
if [ "$USE_LATEST_CAPI" = true ]; then
# separate assignment, so that a failing resolver fails the step
CAPI_VERSION="$(.github/scripts/resolve-latest-capi-chart.sh)"
fi
echo "version=$CAPI_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
# test run.
# The capi chart version overrides the one of kind-deployment (merged last by Helmfile), also in
# preview runs.
- name: Write values override
env:
CAPI_VERSION: ${{ steps.capi.outputs.version }}
run: |
cat > "$RUNNER_TEMP/cf-values.yaml" <<EOF
postgresql:
primary:
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.
- name: Write CAPI values override
if: ${{ steps.capi.outputs.version != '' }}
env:
MIN_CAPI_VERSION: 1.241.0
MATCHED_CAPI_VERSION: ${{ steps.capi.outputs.version }}
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" <<EOF
charts:
capi:
version: $version
version: $CAPI_VERSION
EOF
# Every job gets its own Cloud Foundry on KinD, so the matrix can run in parallel.
# The action of kind-deployment main also deploys v0.26.0 (ref), but unlike the v0.26.0 one, it
# masks the generated admin credentials, which the step logs show otherwise.
- name: Set up Cloud Foundry
uses: cloudfoundry/kind-deployment/.github/actions/setup-cf@b42a88a35756595bd4108d2b525ded5b014a9515 # v0.26.0
uses: cloudfoundry/kind-deployment/.github/actions/setup-cf@6b6882c54a23bfd23982299052ae681f481ad231 # main, 2026-11-13
with:
ref: b42a88a35756595bd4108d2b525ded5b014a9515
use-latest-versions: ${{ (inputs.preview || github.event_name == 'schedule') }}
ref: ${{ matrix.kind-deployment-ref }}
# The v2 job stays on its pinned versions, preview runs only affect the v3 job
use-latest-versions: ${{ matrix.api == 'v3' && (inputs.preview || github.event_name == 'schedule') }}
github-token: ${{ github.token }}
additional-values-files: ${{ runner.temp }}/cf-values.yaml
- name: Set up Java
Expand All @@ -121,6 +139,7 @@ jobs:
TEST_ADMIN_CLIENTSECRET: ${{ env.UAA_ADMIN_SECRET }}
TEST_SKIPSSLVALIDATION: 'true'
TEST_QUOTAS_ROUTES_RESERVED_PORTS: '50'
SKIP_V2_TESTS: ${{ matrix.skip-v2-tests }}
# kind-deployment has no metric registrar, which the log-cache metric tests need
SKIP_METRIC_REGISTRAR_TESTS: 'true'
run: ./mvnw -B -Pintegration-test test -Dgpg.skip
run: ./mvnw -B -Pintegration-test test -Dgpg.skip ${{ matrix.test-selection }}
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public interface CloudFoundryClient {
/**
* The currently supported Cloud Controller API version
*/
String SUPPORTED_API_VERSION = "2.291.0";
String SUPPORTED_API_VERSION = "2.299.0";

String SUPPORTED_API_VERSION_V3 = "3.225.0";
String SUPPORTED_API_VERSION_V3 = "3.237.0";

/**
* Main entry point to the Cloud Foundry Application Usage Events Client API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,19 @@ public void destroy() {
void clean() {
if (!RUN_V2_CLEANUP) {
LOGGER.info("Skipping V2 API cleanup operations (SKIP_V2_TESTS=true)");
// Only run V3 and UAA cleanup operations
// Only run V3, UAA and networking cleanup operations
Flux.empty()
.thenMany(
Mono.when( // No prerequisites - V3/UAA only
Mono.when( // No prerequisites - V3/UAA/networking only
cleanClients(this.uaaClient, this.nameFactory),
cleanGroups(this.uaaClient, this.nameFactory),
cleanIdentityProviders(this.uaaClient, this.nameFactory),
cleanIdentityZones(this.uaaClient, this.nameFactory)))
cleanIdentityZones(this.uaaClient, this.nameFactory),
cleanNetworkingPolicies(
this.networkingClient,
this.nameFactory,
this.serverVersion),
cleanUsersV3(this.cloudFoundryClient, this.nameFactory)))
.thenMany(
Mono.when(
cleanApplicationsV3(this.cloudFoundryClient, this.nameFactory),
Expand Down
Loading
Loading