From da8e8d09a1b7475118a3d91e465a9c833b0b9bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Tue, 19 May 2026 18:10:48 +0200 Subject: [PATCH] openstack-test: migrate CI config to OTE (openshift-tests-extension) Update the openstack-test main CI configuration to support the OTE migration in openshift/openstack-test#260. Changes: - binary_build_commands: build OTE extension binary via 'make tests-ext-build', package as tar.gz, and place at /usr/bin/ for payload discovery by openshift-tests - build test: verify the extension binary with --help instead of the removed openstack-tests binary - test/ccpmso jobs: use new openstack-test-openstack-ote step ref - dualstack jobs: override test phase with openshift-e2e-test + openstack-test-openstack-ote (replacing the old chain that used openstack-test-openstack) New step registry ref openstack-test-openstack-ote: - Runs from 'tests' image (openshift-tests) instead of 'openstack-tests' - Discovers the openstack-test extension from the release payload - Grants image-puller access for extension discovery - Supports same env vars: OS_CLOUD, OPENSTACK_TEST_SKIPS, CONFIG_TYPE - Runs 'openshift-tests run openstack-test/all' suite The old openstack-test-openstack step ref is preserved for older release branches that still use the standalone openstack-tests binary. --- .../openshift-openstack-test-main.yaml | 14 +++-- .../openstack/test/openstack-ote/OWNERS | 4 ++ .../openstack-test-openstack-ote-commands.sh | 56 +++++++++++++++++++ ...stack-test-openstack-ote-ref.metadata.json | 11 ++++ .../openstack-test-openstack-ote-ref.yaml | 33 +++++++++++ .../openstack-test-openstack-commands.sh | 2 +- 6 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 ci-operator/step-registry/openstack/test/openstack-ote/OWNERS create mode 100755 ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-commands.sh create mode 100644 ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-ref.metadata.json create mode 100644 ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-ref.yaml diff --git a/ci-operator/config/openshift/openstack-test/openshift-openstack-test-main.yaml b/ci-operator/config/openshift/openstack-test/openshift-openstack-test-main.yaml index 2cf5c3e8e45e9..dd5c50a279cf6 100644 --- a/ci-operator/config/openshift/openstack-test/openshift-openstack-test-main.yaml +++ b/ci-operator/config/openshift/openstack-test/openshift-openstack-test-main.yaml @@ -1,4 +1,4 @@ -binary_build_commands: go build -o /bin/openstack-tests ./cmd/openshift-tests +binary_build_commands: make tests-ext-build && cp bin/openstack-test-tests-ext /usr/bin/ build_root: from_repository: true use_build_cache: true @@ -28,7 +28,7 @@ resources: memory: 200Mi tests: - as: build - commands: openstack-tests --help + commands: ./bin/openstack-test-tests-ext --help container: from: bin - as: verify @@ -41,7 +41,7 @@ tests: env: CONFIG_TYPE: minimal test: - - ref: openstack-test-openstack + - ref: openstack-test-openstack-ote workflow: openshift-e2e-openstack-ipi - always_run: false as: e2e-openstack-ccpmso @@ -61,13 +61,16 @@ tests: requests: cpu: 100m timeout: 7h0m0s - - ref: openstack-test-openstack + - ref: openstack-test-openstack-ote workflow: openshift-e2e-openstack-ipi - always_run: false as: e2e-openstack-dualstack optional: true steps: cluster_profile: openstack-hwoffload + test: + - ref: openshift-e2e-test + - ref: openstack-test-openstack-ote workflow: openshift-e2e-openstack-dualstack - always_run: false as: e2e-openstack-dualstack-v6primary @@ -76,6 +79,9 @@ tests: cluster_profile: openstack-hwoffload env: CONFIG_TYPE: dualstack-v6primary + test: + - ref: openshift-e2e-test + - ref: openstack-test-openstack-ote workflow: openshift-e2e-openstack-dualstack zz_generated_metadata: branch: main diff --git a/ci-operator/step-registry/openstack/test/openstack-ote/OWNERS b/ci-operator/step-registry/openstack/test/openstack-ote/OWNERS new file mode 100644 index 0000000000000..f47a23f53a78f --- /dev/null +++ b/ci-operator/step-registry/openstack/test/openstack-ote/OWNERS @@ -0,0 +1,4 @@ +approvers: +- openstack-approvers +reviewers: +- openstack-reviewers diff --git a/ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-commands.sh b/ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-commands.sh new file mode 100755 index 0000000000000..199b849cae95f --- /dev/null +++ b/ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-commands.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +export OS_CLIENT_CONFIG_FILE="${SHARED_DIR}/clouds.yaml" +export PATH=/usr/libexec/origin:$PATH + +declare TEST_ARGS='' + +# Force the IPv6 endpoint +if [[ "${CONFIG_TYPE}" == *"singlestackv6"* ]]; then + export OS_CLOUD="${OS_CLOUD}-ipv6" +fi + +# For disconnected or otherwise unreachable environments, we want to +# have steps use an HTTP(S) proxy to reach the API server. This proxy +# configuration file should export HTTP_PROXY, HTTPS_PROXY, and NO_PROXY +# environment variables, as well as their lowercase equivalents (note +# that libcurl doesn't recognize the uppercase variables). +if test -f "${SHARED_DIR}/proxy-conf.sh" +then + # shellcheck disable=SC1090 + source "${SHARED_DIR}/proxy-conf.sh" +fi + +# Set up the test provider for OpenStack +if test -n "${HTTP_PROXY:-}" -o -n "${HTTPS_PROXY:-}"; then + export TEST_PROVIDER='{"type":"openstack","disconnected":true}' +else + export TEST_PROVIDER='{"type":"openstack"}' +fi + +# In order for openshift-tests to pull external binary images from the +# payload, we need access enabled to the images on the build farm. In +# order to do that, we need to unset the KUBECONFIG so we talk to the +# build farm, not the cluster under test. +echo "Granting access for image pulling from the build farm..." +KUBECONFIG_BAK=$KUBECONFIG +unset KUBECONFIG +oc adm policy add-role-to-group system:image-puller system:unauthenticated --namespace "${NAMESPACE}" || echo "Warning: Failed to grant image puller access, continuing..." +export KUBECONFIG=$KUBECONFIG_BAK + +TEST_SUITE="openstack-test/all" + +if [[ -n "${OPENSTACK_TEST_SKIPS}" ]]; then + TESTS="$(openshift-tests run --dry-run --provider "${TEST_PROVIDER}" "${TEST_SUITE}")" + echo "${TESTS}" | grep -v "${OPENSTACK_TEST_SKIPS}" >/tmp/tests + echo "Skipping tests:" + echo "${TESTS}" | grep "${OPENSTACK_TEST_SKIPS}" || { exit_code=$?; echo 'Error: no tests were found matching the OPENSTACK_TEST_SKIPS regex:'; echo "$OPENSTACK_TEST_SKIPS"; exit $exit_code; } + TEST_ARGS="${TEST_ARGS:-} --file /tmp/tests" +fi + +openshift-tests run "${TEST_SUITE}" ${TEST_ARGS:-} \ + --provider "${TEST_PROVIDER}" \ + --junit-dir "${ARTIFACT_DIR}/junit" \ + -o "${ARTIFACT_DIR}/e2e.log" diff --git a/ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-ref.metadata.json b/ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-ref.metadata.json new file mode 100644 index 0000000000000..9e55f030eb853 --- /dev/null +++ b/ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-ref.metadata.json @@ -0,0 +1,11 @@ +{ + "path": "openstack/test/openstack-ote/openstack-test-openstack-ote-ref.yaml", + "owners": { + "approvers": [ + "openstack-approvers" + ], + "reviewers": [ + "openstack-reviewers" + ] + } +} \ No newline at end of file diff --git a/ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-ref.yaml b/ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-ref.yaml new file mode 100644 index 0000000000000..59fa790267c5a --- /dev/null +++ b/ci-operator/step-registry/openstack/test/openstack-ote/openstack-test-openstack-ote-ref.yaml @@ -0,0 +1,33 @@ +ref: + as: openstack-test-openstack-ote + from: tests + cli: latest + commands: openstack-test-openstack-ote-commands.sh + resources: + requests: + cpu: "3" + memory: 600Mi + limits: + memory: 10Gi + env: + - name: OS_CLOUD + default: "openstack" + documentation: Name of cloud to use from ${SHARED_DIR}/clouds.yaml file + - name: OPENSTACK_TEST_SKIPS + default: "" + documentation: | + Regular expression (POSIX basic regular expression) of tests to skip. + It is suggested to test the regex to make sure that it matches with the available tests. + Tests can be listed by using 'openshift-tests run --dry-run (...)'. Sometimes, the tests + that are printed in Prow won't exactly match the list returned by openshift-tests. + - name: CONFIG_TYPE + default: '' + documentation: | + The type of config for the environment to deploy. + + * 'dualstack' - Configure the install-config to enable dualstack clusters. + * 'singlestackv6' - Configure the install-config to enable single-stack v6 clusters. + documentation: |- + Runs the OpenShift OpenStack-specific tests using the OTE (OpenShift Tests Extension) + framework. Tests are discovered and run through openshift-tests which loads the + openstack-test extension from the release payload. diff --git a/ci-operator/step-registry/openstack/test/openstack/openstack-test-openstack-commands.sh b/ci-operator/step-registry/openstack/test/openstack/openstack-test-openstack-commands.sh index df3f97cfddef2..817a49385f17c 100644 --- a/ci-operator/step-registry/openstack/test/openstack/openstack-test-openstack-commands.sh +++ b/ci-operator/step-registry/openstack/test/openstack/openstack-test-openstack-commands.sh @@ -26,7 +26,7 @@ if [[ -n "${OPENSTACK_TEST_SKIPS}" ]]; then TESTS="$(openstack-tests run --dry-run openshift/openstack)" echo "${TESTS}" | grep -v "${OPENSTACK_TEST_SKIPS}" >/tmp/tests echo "Skipping tests:" - echo "${TESTS}" | grep "${OPENSTACK_TEST_SKIPS}" || { exit_code=$?; echo 'Error: no tests were found matching the OPENSTACK_TEST_SKIPS regex:'; echo "$OPENSTACK_TEST_SKIPS"; return $exit_code; } + echo "${TESTS}" | grep "${OPENSTACK_TEST_SKIPS}" || { exit_code=$?; echo 'Error: no tests were found matching the OPENSTACK_TEST_SKIPS regex:'; echo "$OPENSTACK_TEST_SKIPS"; exit $exit_code; } TEST_ARGS="${TEST_ARGS:-} --file /tmp/tests" fi