From 958fe1ed75fb96cc6a874a829ceb478774d71538 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 1 Oct 2025 09:54:16 +0200 Subject: [PATCH 1/2] OC PhySim deployment: always undeploy safely This fixes basically two problems. First, remove "set -e", which leads to the script exiting on error. For instance, there was the sleep which should account for the time of the pod being in "ContainerCreating", but might not be enough. In that case, the script would exit, leaving the pod deployed. Second, a fixed time is not good, as it can be too short and unduly prolong waiting time. Replace with a loop. --- ci-scripts/scripts/oc-deploy-physims.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci-scripts/scripts/oc-deploy-physims.sh b/ci-scripts/scripts/oc-deploy-physims.sh index 19c1940ba1..c0b4e388c1 100755 --- a/ci-scripts/scripts/oc-deploy-physims.sh +++ b/ci-scripts/scripts/oc-deploy-physims.sh @@ -1,7 +1,5 @@ #!/bin/bash -set -e - function die() { echo $@; exit 1; } [ $# -eq 4 ] || die "usage: $0 " @@ -15,7 +13,11 @@ oc project ${OC_NS} > /dev/null oc tag oaicicd-ran/oai-physim:${IMG_TAG} ${OC_NS}/oai-physim:${IMG_TAG} helm install ${OC_RELEASE} ${OAI_DIR}/charts/${OC_RELEASE} --set global.image.version=${IMG_TAG} --wait --timeout 120s POD_ID=$(oc get pods | grep oai-${OC_RELEASE} | awk '{print $1}') -sleep 30 +wait_creating=30 +while [[ $(oc describe pod "$POD_ID" | grep "ContainerCreating") && ${wait_creating} > 0 ]]; do + sleep 1; + let wait_creating=$wait_creating-1 +done echo "Monitoring logs for 'FINISHED' in pod '$POD_ID'" oc logs -f -n ${OC_NS} "$POD_ID" | while read -r line; do if [[ "$line" == *"FINISHED"* ]]; then From bd1dadaa79943096361b2829dfb7e482dfaa165a Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Wed, 1 Oct 2025 10:07:25 +0200 Subject: [PATCH 2/2] OC PhySim deployment: log bash script commands Also, don't use "set -x" debugging for oc login command: ci-scripts/cls_cmd.py:242 sets BASH_XTRACEFD=1, which makes that all "set -x" output is in stdout, leading to a redirect to the file into which we redirect. This would lead to the following error with unsuccessfull oc login: error: You are not a member of project "****-core-for-ci-ran". Error from server (Forbidden): imagestreams.image.openshift.io "oai-physim" is forbidden: User "system:anonymous" cannot get resource "imagestreams" in API group "image.openshift.io" in the namespace "****-ran" --- ci-scripts/scripts/oc-deploy-physims.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci-scripts/scripts/oc-deploy-physims.sh b/ci-scripts/scripts/oc-deploy-physims.sh index c0b4e388c1..29812a8980 100755 --- a/ci-scripts/scripts/oc-deploy-physims.sh +++ b/ci-scripts/scripts/oc-deploy-physims.sh @@ -9,9 +9,11 @@ IMG_TAG=${3} OAI_DIR=${4} cat /opt/oc-password | oc login -u oaicicd --server https://api.oai.cs.eurecom.fr:6443 > /dev/null +set -x oc project ${OC_NS} > /dev/null oc tag oaicicd-ran/oai-physim:${IMG_TAG} ${OC_NS}/oai-physim:${IMG_TAG} helm install ${OC_RELEASE} ${OAI_DIR}/charts/${OC_RELEASE} --set global.image.version=${IMG_TAG} --wait --timeout 120s +set +x POD_ID=$(oc get pods | grep oai-${OC_RELEASE} | awk '{print $1}') wait_creating=30 while [[ $(oc describe pod "$POD_ID" | grep "ContainerCreating") && ${wait_creating} > 0 ]]; do @@ -29,6 +31,7 @@ oc logs -f -n ${OC_NS} "$POD_ID" | while read -r line; do break fi done +set -x oc logs -n ${OC_NS} "$POD_ID" >> ${OAI_DIR}/physim_log.txt oc describe pod $POD_ID >> ${OAI_DIR}/physim_log.txt helm uninstall ${OC_RELEASE} --wait