cps:
image:
repository: "nexus3.onap.org:10003/onap/cps-and-ncmp"
- tag: "latest"
- pullPolicy: Always
+ tag: "" # Overridden by IMAGE_TAG in k6-main.sh (default: latest)
+ pullPolicy: Never # Overridden by IMAGE_PULL_POLICY in k6-main.sh (default: IfNotPresent)
replicas: 2
servicePort: 8080
service:
enabled: true
image:
repository: nexus3.onap.org:10003/onap/dmi-stub
- tag: "1.8.0-SNAPSHOT"
+ tag: "1.8.0-SNAPSHOT" # Overridden by DMI_STUB_VERSION in k6-main.sh (default: 1.8.0-SNAPSHOT)
pullPolicy: IfNotPresent
replicaCount: 1
deployment1:
enabled: true
image:
repository: nexus3.onap.org:10003/onap/policy-executor-stub
- tag: "latest"
- pullPolicy: Always
+ tag: "" # Overridden by POLICY_EXECUTOR_STUB_VERSION in k6-main.sh (default: latest)
+ pullPolicy: Never # Overridden by IMAGE_PULL_POLICY in k6-main.sh (default: IfNotPresent)
replicaCount: 1
service:
type: NodePort
#!/bin/bash
#
-# Copyright 2024-2025 OpenInfra Foundation Europe. All rights reserved.
+# Copyright 2024-2026 OpenInfra Foundation Europe. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
elif [[ "$deploymentType" == "k8sHosts" ]]; then
echo "Test profile: $testProfile, and deployment type: $deploymentType provided for k8s cluster"
+ # Set default values for local development if not provided by Jenkins
+ IMAGE_TAG="${IMAGE_TAG:-latest}"
+ DMI_STUB_VERSION="${DMI_STUB_VERSION:-1.8.0-SNAPSHOT}"
+ POLICY_EXECUTOR_STUB_VERSION="${POLICY_EXECUTOR_STUB_VERSION:-latest}"
+ IMAGE_PULL_POLICY="${IMAGE_PULL_POLICY:-IfNotPresent}"
+
+ # Display image configuration for verification
+ cat << EOF
+==========================================
+IMAGE CONFIGURATION FOR K6 TESTS:
+==========================================
+CPS Image Tag: ${IMAGE_TAG}
+DMI Stub Version: ${DMI_STUB_VERSION}
+Policy Executor Stub Version: ${POLICY_EXECUTOR_STUB_VERSION}
+Image Pull Policy: ${IMAGE_PULL_POLICY}
+==========================================
+EOF
+
# Deploy cps charts for k8s
- helm install cps ../cps-charts
+ helm install cps ../cps-charts \
+ --set cps.image.tag="${IMAGE_TAG}" \
+ --set cps.image.pullPolicy="${IMAGE_PULL_POLICY}" \
+ --set dmiStub.image.tag="${DMI_STUB_VERSION}" \
+ --set policyExecutorStub.image.tag="${POLICY_EXECUTOR_STUB_VERSION}" \
+ --set policyExecutorStub.image.pullPolicy="${IMAGE_PULL_POLICY}"
# Wait for pods and services until becomes ready
echo "Waiting for cps and ncmp pods to be ready..."
kubectl wait --for=condition=available deploy -l app=ncmp --timeout=300s
+ # Verify actual images running in pods
+ cat << EOF
+==========================================
+VERIFYING ACTUAL IMAGES IN RUNNING PODS:
+==========================================
+EOF
+ kubectl get pods -l app=ncmp -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[*].image}{"\n"}{end}' | while read -r pod_name images; do
+ echo "Pod: $pod_name"
+ echo " Images: $images"
+ done
+ echo "=========================================="
+
else
echo "Error: Unsupported deployment type: $deploymentType"
echo "Supported deployment types: dockerHosts, k8sHosts"
# Function to clean Docker images based on CLEAN_DOCKER_IMAGES environment variable
clean_docker_images_if_needed() {
if [[ "${CLEAN_DOCKER_IMAGES:-0}" -eq 1 ]]; then
- echo "Also cleaning up all CPS images"
- remove_cps_images
+ echo "Also cleaning up CPS images"
+ remove_cps_images "$deploymentType"
fi
}
# All CPS docker images:
-# nexus3.onap.org:10003/onap/cps-and-ncmp:latest
-# nexus3.onap.org:10003/onap/dmi-stub:1.8.0-SNAPSHOT
-# nexus3.onap.org:10003/onap/policy-executor-stub:latest
+# nexus3.onap.org:10003/onap/cps-and-ncmp:SNAPSHOT-*
+# nexus3.onap.org:10003/onap/policy-executor-stub:SNAPSHOT-*
+# Note: DMI stub is pulled from Nexus, not built, so we don't clean it
remove_cps_images() {
+ local deployment_type=$1
local cps_image_names=(cps-and-ncmp policy-executor-stub)
+
+ echo "Cleaning up Docker images..."
for cps_image_name in "${cps_image_names[@]}"; do
local image_path="nexus3.onap.org:10003/onap/$cps_image_name"
- # list all images for all tags except 'latest' since it would be in use
- # result will store in snapshot_tags[0], snapshot_tags[1]
- local snapshot_tags=( $(docker images "$image_path" --format '{{.Tag}}' | grep -v '^latest$') )
+
+ # List all images for all tags except 'latest' since it would be in use
+ # For k8sHosts: remove SNAPSHOT-* tags (timestamp-based from Jenkins)
+ # For dockerHosts: remove all non-latest tags
+ if [[ "$deployment_type" == "k8sHosts" ]]; then
+ local snapshot_tags=( $(docker images "$image_path" --format '{{.Tag}}' | grep 'SNAPSHOT-' || true) )
+ else
+ local snapshot_tags=( $(docker images "$image_path" --format '{{.Tag}}' | grep -v '^latest$' || true) )
+ fi
+
if [ ${#snapshot_tags[@]} -gt 0 ]; then
- echo "Removing snapshot images for tags $image_path: ${snapshot_tags[*]}"
- # remove each snapshot image explicitly
+ echo "Removing images for $image_path: ${snapshot_tags[*]}"
for tag in "${snapshot_tags[@]}"; do
- docker rmi "$image_path:$tag"
+ docker rmi "$image_path:$tag" || echo " Warning: Failed to remove $image_path:$tag"
done
+ else
+ echo "No images to remove for $image_path"
fi
done
}
echo "Supported deployment types: k8sHosts, dockerHosts"
exit 1
;;
-esac
\ No newline at end of file
+esac