Skip to content
Merged
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
22 changes: 21 additions & 1 deletion tests/e2e/common-operator-integ-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ initialize_variables() {
IP_FAMILY=${IP_FAMILY:-ipv4}
ISTIO_MANIFEST="chart/samples/istio-sample.yaml"
CI=${CI:-"false"}
USE_INTERNAL_REGISTRY=${USE_INTERNAL_REGISTRY:-"false"}

# Debug logging and fallback for GINKGO_FLAGS
echo "CI environment: ${CI}"
echo "GINKGO_FLAGS received: '${GINKGO_FLAGS:-}'"

# Fallback: Generate GINKGO_FLAGS if empty and CI=true
if [ -z "${GINKGO_FLAGS:-}" ] && [ "${CI}" == "true" ]; then
GINKGO_FLAGS="--no-color"
echo "Generated GINKGO_FLAGS fallback: '${GINKGO_FLAGS}'"
fi

# export to be sure that the variables are available in the subshell
export IMAGE_BASE="${IMAGE_BASE:-sail-operator}"
Expand All @@ -134,9 +145,13 @@ initialize_variables() {
# Handle OCP registry scenarios
# Note: Makefile.core.mk sets HUB=quay.io/sail-dev and TAG=1.29-latest by default
if [ "${OCP}" == "true" ]; then
# Debug output for troubleshooting
echo "DEBUG: CI='${CI}', HUB='${HUB}'"

if [ "${CI}" == "true" ] && [ "${HUB}" == "quay.io/sail-dev" ]; then
# Scenario 2: CI mode with default HUB -> use external registry with proper CI tag
echo "CI mode detected for OCP, using external registry ${HUB}"
export USE_INTERNAL_REGISTRY="false"

# Use PR_NUMBER if available, otherwise generate timestamp tag
if [ -n "${PR_NUMBER:-}" ]; then
Expand All @@ -147,9 +162,14 @@ initialize_variables() {
export TAG
echo "Using timestamp-based tag: ${TAG}"
fi
elif [ "${CI}" == "true" ]; then
# Additional CI mode check - handle CI mode regardless of HUB value
echo "CI mode detected for OCP with custom HUB (${HUB}), using external registry"
export USE_INTERNAL_REGISTRY="false"
elif [ "${HUB}" != "quay.io/sail-dev" ]; then
# Scenario 3: Custom registry provided by user
echo "Using custom registry: ${HUB}"
export USE_INTERNAL_REGISTRY="false"
else
# Scenario 1: Local development -> use internal OCP registry
echo "Local development mode, will use OCP internal registry"
Expand Down Expand Up @@ -304,7 +324,7 @@ if [ "${SKIP_BUILD}" == "false" ]; then
fi
fi

export SKIP_DEPLOY IP_FAMILY ISTIO_MANIFEST NAMESPACE CONTROL_PLANE_NS DEPLOYMENT_NAME MULTICLUSTER ARTIFACTS ISTIO_NAME COMMAND KUBECONFIG ISTIOCTL_PATH SKIP_CLEANUP
export SKIP_DEPLOY IP_FAMILY ISTIO_MANIFEST NAMESPACE CONTROL_PLANE_NS DEPLOYMENT_NAME MULTICLUSTER ARTIFACTS ISTIO_NAME COMMAND KUBECONFIG ISTIOCTL_PATH SKIP_CLEANUP GINKGO_FLAGS

if [ "${OLM}" != "true" ] && [ "${SKIP_DEPLOY}" != "true" ]; then
# shellcheck disable=SC2153
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/integ-suite-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ function check_prerequisites() {
function run_integration_tests() {
echo "Running integration tests"
if [ "${MULTICLUSTER}" == "true" ]; then
ARTIFACTS="${ARTIFACTS}" ISTIOCTL="${ISTIOCTL}" "${ROOT}/tests/e2e/common-operator-integ-suite.sh" --kind --multicluster
ARTIFACTS="${ARTIFACTS}" ISTIOCTL="${ISTIOCTL}" GINKGO_FLAGS="${GINKGO_FLAGS}" "${ROOT}/tests/e2e/common-operator-integ-suite.sh" --kind --multicluster
else
KUBECONFIG="${ARTIFACTS}/config"
ARTIFACTS="${ARTIFACTS}" IP_FAMILY="${IP_FAMILY}" "${ROOT}/tests/e2e/common-operator-integ-suite.sh" --kind
ARTIFACTS="${ARTIFACTS}" IP_FAMILY="${IP_FAMILY}" GINKGO_FLAGS="${GINKGO_FLAGS}" "${ROOT}/tests/e2e/common-operator-integ-suite.sh" --kind
fi
}

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/integ-suite-ocp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ if [ -z "${KUBECONFIG}" ]; then
exit 1
fi

KUBECONFIG="${KUBECONFIG}" ./tests/e2e/common-operator-integ-suite.sh --ocp
KUBECONFIG="${KUBECONFIG}" GINKGO_FLAGS="${GINKGO_FLAGS}" ./tests/e2e/common-operator-integ-suite.sh --ocp
3 changes: 3 additions & 0 deletions tests/e2e/setup/build-and-push-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ build_and_push_operator_image() {

# Main logic
# Only use internal registry for OCP local development (when USE_INTERNAL_REGISTRY is set)
echo "DEBUG: OCP='${OCP}', USE_INTERNAL_REGISTRY='${USE_INTERNAL_REGISTRY:-false}'"
if [ "${OCP}" == "true" ] && [ "${USE_INTERNAL_REGISTRY:-false}" == "true" ]; then
echo "Setting up OCP internal registry for local development..."
get_internal_registry
else
echo "Skipping internal registry setup - using external registry"
fi

echo "Registry: ${HUB}"
Expand Down
Loading