2 #------------------nanobot Pre-modification------------------------------------------------------------
3 cd RIC/test/ric_robot_suite
4 #------------------Build the robot suite---------------------------------------------------------------
5 docker build -t nanobot:latest -f docker/Dockerfile.nanobot .
7 #---------pre-create the log file directory- find the value from the values.yaml-----------------------
8 sudo chown -R cloudadmin /opt
9 mkdir -p /opt/ric/robot/log
11 kubectl create namespace rictest
12 kubectl create namespace ricxapp
14 #----------create ricplatform danmnet-------------------------------------------------------------------
15 cat <<! | kubectl apply -f -
16 apiVersion: danm.k8s.io/v1
26 docker tag nanobot:latest registry.kube-system.svc.rec.io:5555/rictest/nanobot:latest
27 docker push registry.kube-system.svc.rec.io:5555/rictest/nanobot:latest
30 #--------edit the values.yaml file in the helm chart for nanobot to point to local registry--------------
31 values_files="$(find . -name values.yaml)"
32 for file in $values_files; do
33 #sed -ri 's/^(\s*)(run\s*:\s*nanobot\s*$)/\1run: registry.kube-system.svc.rec.io:5555/rictest/nanobot/' "$file"
34 sed -i 's/ domain: cluster.local/ domain: rec.io/' "$file"
35 sed -i 's/ repository: .*$/ repository: registry.kube-system.svc.rec.io:5555/' "$file"
36 sed -i 's/ name: test\/nanobot/ name: rictest\/nanobot/' "$file"
40 deployment_files="$(find . -name job-ric-robot-run.yaml)"
41 for file in $deployment_files; do
42 sed -i "/restartPolicy: Never/s//&\\n\ nodeSelector:\n nodename: caas_master1\n/" "$file"
45 #-------------------------add the helm chart to the repo-------------------------------------------------
47 mkdir -p dist/packages
49 helm package -d dist/packages nanobot
50 helm serve --repo-path dist/packages &
54 #-----------------------install the helm chart-----------------------------------------------------------
55 helm install localric/nanobot --namespace rictest --name nanobot
57 nanobot_pod=$(kubectl get pods -n rictest -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
59 kubectl logs $nanobot_pod -n rictest
60 #--------------kill helm---------------------------------------------------------------------
62 #------------checking the status of the rictest pod--------------------------------------
64 command="$(kubectl get po --no-headers --namespace=rictest --field-selector status.phase=Completed 2> /dev/null)"
65 if [[ $command != "" ]]; then