update scripts to be executable
[rec.git] / workflows / robot_test_ric.sh
1 #!/bin/bash\r
2 #-----------Pre-modification------------------------------\r
3 cd RIC\r
4 git clone https://gerrit.o-ran-sc.org/r/it/test\r
5 cp test/ric_robot_suite/helm/robot_install.sh /home/cloudadmin/RIC/dep/generated/ricplt\r
6 \r
7 #-----------Changing the repo location to rec.io-----------\r
8 sed -i 's,snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001,registry.kube-system.svc.rec.io:5555,g' test/ric_robot_suite/helm/ric-robot/values.yaml\r
9 sed -ri '/nodePort: 30209/d' test/ric_robot_suite/helm/ric-robot/values.yaml\r
10 sed -ri 's/^(\s*)(type\s*:\s*NodePort\s*$)/\1type: ClusterIP/' test/ric_robot_suite/helm/ric-robot/values.yaml\r
11 sed -i 's/  tag: latest/  tag: 0.1.0-SNAPSHOT-20190318152929/' test/ric_robot_suite/helm/ric-robot/values.yaml\r
12 cd dep/generated/ricplt\r
13 \r
14 #-----------Doing the Docker pull--------------------------\r
15 #echo "docker" | docker login -u docker --password-stdin snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001\r
16 #docker pull snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001/test/ric-robot:latest\r
17 docker pull rancodev/ric-robot:0.1.0-SNAPSHOT-20190318152929\r
18 #docker logout snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001\r
19 \r
20 \r
21 #-----------Retagging---------------------------------------\r
22 docker tag  rancodev/ric-robot:0.1.0-SNAPSHOT-20190318152929 registry.kube-system.svc.rec.io:5555/test/ric-robot:0.1.0-SNAPSHOT-20190318152929\r
23 docker push  registry.kube-system.svc.rec.io:5555/test/ric-robot:0.1.0-SNAPSHOT-20190318152929\r
24 \r
25 \r
26 #----------- robot_install----------------------------------\r
27 #  Note:\r
28 #  This file needs to be in the it/dep/generated/ricplt directory with ric_install.sh/ric_uninstall.sh\r
29 #  so that it can use the same dist/packages as the ricplt install\r
30 #\r
31 #  ricplt is in:     it/dep/geneated/ricplt\r
32 #  ric-robot is in:  it/test/ric_robot_suite\r
33 #\r
34 if [ ! -e ric-robot ]; then\r
35     ln  -s ../../../test/ric_robot_suite/helm/ric-robot  ric-robot\r
36 fi\r
37 \r
38 \r
39 helm repo add localric http://127.0.0.1:8879/charts\r
40 helm package -d dist/packages ric-robot\r
41 pkill helm\r
42 helm serve --repo-path dist/packages &\r
43 sleep 2\r
44 helm repo update\r
45 \r
46 # if you need to override the repo change the image.repository line for deployment\r
47 # helm install local/ric-robot --namespace ricplatform --name ric-robot --set image.repository=snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001/test/ric-robot\r
48 #\r
49 helm install localric/ric-robot --namespace ricplatform --name ric-robot\r
50 helm repo update\r
51 #cd ../../../\r
52 ric_robot_pod=$(kubectl get pods -l app.kubernetes.io/instance=ric-robot -n ricplatform -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')\r
53 kubectl exec -n ricplatform -it $ric_robot_pod -- sed -i '17,19 s/^/#/' /var/opt/RIC/robot/testsuites/health-check.robot\r
54 \r
55 #---------show the test cases------------------------------\r
56 cd /home/cloudadmin/RIC/test/ric_robot_suite/helm/ric-robot/\r
57 bash ete-k8s.sh ricplatform health\r
58 #----------checking the status of the pods------------------\r
59 command="$(kubectl get po --no-headers --namespace=ricplatform --field-selector status.phase!=Running 2> /dev/null)"\r
60 if [[ $command != "" ]]; then\r
61   exit 1\r
62 fi\r