From 85cc3619d372418937084764a9381ea1cd7cf6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Fei?= Date: Mon, 5 Oct 2026 17:59:12 +0200 Subject: [PATCH] test: use CNPG released versions instead of testing release branches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Niccolò Fei --- .github/workflows/bake_targets.yml | 18 ++++++++++++++---- Taskfile.yml | 12 ++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/bake_targets.yml b/.github/workflows/bake_targets.yml index bb372bd4..829921c3 100644 --- a/.github/workflows/bake_targets.yml +++ b/.github/workflows/bake_targets.yml @@ -114,14 +114,24 @@ jobs: outputs: versions: ${{ steps.versions.outputs.versions }} steps: - # main plus the latest and previous supported minor release branches. + # main plus the latest released patch of the latest and previous supported minors. - name: Compute CNPG release matrix id: versions env: - # renovate: datasource=github-tags depName=cloudnative-pg/cloudnative-pg versioning=semver-coerced extractVersion=^v(?\d+\.\d+)\.\d+$ - LATEST_RELEASE: "1.30" + # renovate: datasource=github-tags depName=cloudnative-pg/cloudnative-pg versioning=semver-coerced extractVersion=^v(?\d+\.\d+\.\d+)$ + LATEST_RELEASE: "1.30.1" run: | - PREVIOUS_RELEASE=$(awk -F. '{print $1"."$2-1}' <<< "$LATEST_RELEASE") + LATEST_MINOR="${LATEST_RELEASE%.*}" + PREVIOUS_MINOR=$(awk -F. '{print $1"."$2-1}' <<< "$LATEST_MINOR") + # Highest stable patch release of the previous minor + PREVIOUS_RELEASE=$(git ls-remote --tags --refs https://github.com/cloudnative-pg/cloudnative-pg "refs/tags/v${PREVIOUS_MINOR}.*" \ + | sed 's|.*refs/tags/v||' \ + | grep -E "^${PREVIOUS_MINOR//./\\.}\.[0-9]+$" \ + | sort -V | tail -n1) + if [ -z "$PREVIOUS_RELEASE" ]; then + echo "No release found for CNPG ${PREVIOUS_MINOR}" >&2 + exit 1 + fi versions=$(jq -cn --arg latest "$LATEST_RELEASE" --arg previous "$PREVIOUS_RELEASE" \ '["main", $previous, $latest]') echo "versions=$versions" >> "$GITHUB_OUTPUT" diff --git a/Taskfile.yml b/Taskfile.yml index 4f8e37cf..8e43879e 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -24,8 +24,8 @@ vars: KIND_NODE_VERSION: v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5 K8S_VERSION: '{{ regexReplaceAll "^v([0-9.]+).*" .KIND_NODE_VERSION "$1" }}' KIND_CLUSTER_NAME: pg-extensions-{{ .K8S_VERSION }} - # renovate: datasource=github-tags depName=cloudnative-pg/cloudnative-pg versioning=semver-coerced extractVersion=^v(?\d+\.\d+)\.\d+$ - CNPG_RELEASE_DEFAULT: '1.30' + # renovate: datasource=github-tags depName=cloudnative-pg/cloudnative-pg versioning=semver-coerced extractVersion=^v(?\d+\.\d+\.\d+)$ + CNPG_RELEASE_DEFAULT: '1.30.1' DOCKER_SOCKET: sh: docker context inspect -f {{`'{{json .Endpoints.docker.Host}}'`}} $(docker context show) @@ -308,10 +308,14 @@ tasks: KUBECTL_VERSION: 1.37.1@sha256:b57b3bd3cd9f4f02dd444281857126aa78efa4b7b7e6ec57579dd927bf146fc3 CNPG_MANIFEST: sh: | - if [ "{{ .CNPG_RELEASE }}" = "main" ]; then + release="{{ .CNPG_RELEASE }}" + if [ "${release}" = "main" ]; then echo "https://raw.githubusercontent.com/cloudnative-pg/artifacts/main/manifests/operator-manifest.yaml" + elif echo "${release}" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then + echo "https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-${release%.*}/releases/cnpg-${release}.yaml" else - echo "https://raw.githubusercontent.com/cloudnative-pg/artifacts/release-{{ .CNPG_RELEASE }}/manifests/operator-manifest.yaml" + echo "CNPG_RELEASE must be 'main' or a full version like 1.30.1, got '${release}'" >&2 + exit 1 fi env: _EXPERIMENTAL_DAGGER_RUNNER_HOST: container://{{ .DAGGER_ENGINE_NAME }}