Brian Freeman | 48d3054 | 2019-08-20 13:13:58 -0500 | [diff] [blame] | 1 | --- |
| 2 | |
| 3 | - job-template: |
| 4 | name: '{env}-resilience-healthdist' |
| 5 | disabled: '{obj:disabled_var}' |
| 6 | project-type: freestyle |
| 7 | lab-name: '' |
| 8 | tenant-name: '' |
| 9 | scm: |
| 10 | - git-integration: |
| 11 | branch: "{integration-branch}" |
| 12 | wrappers: |
| 13 | - timestamps |
| 14 | parameters: |
| 15 | - string: |
| 16 | name: POD_TO_DELETE |
| 17 | description: 'Name of pod to delete. This string will be grepped against the pod list and used to delete the pod.' |
| 18 | properties: |
| 19 | - build-blocker: |
| 20 | blocking-jobs: |
| 21 | - "{env}-deploy" |
| 22 | - "{env}-healthcheck" |
| 23 | builders: |
| 24 | - shell: | |
| 25 | #!/bin/bash |
| 26 | set +x |
| 27 | . $WORKSPACE/deployment/heat/onap-rke/env/{lab-name}/{tenant-name}-openrc |
| 28 | . $JENKINS_HOME/onap-lab-ci/labs/{lab-name}-openrc |
| 29 | source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh |
| 30 | |
| 31 | set -x |
| 32 | rm -rf $WORKSPACE/archives |
| 33 | mkdir -p $WORKSPACE/archives |
| 34 | |
| 35 | SSH_KEY=~/.ssh/onap_key |
| 36 | STACK_NAME="{stack-name}" |
| 37 | NFS_IP=$(openstack stack output show $STACK_NAME nfs_vm_ip -c output_value -f value) |
| 38 | K8S_IP=$(openstack stack output show $STACK_NAME k8s_01_vm_ip -c output_value -f value) |
| 39 | ssh-keygen -R $NFS_IP |
| 40 | |
| 41 | echo "kubectl top nodes" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 42 | echo "kubectl get pods -n onap | grep -vE 'Completed|Error|1/1|2/2|3/3'" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 43 | |
| 44 | ROBOT_POD=$(echo "kubectl -n onap get pods | grep robot | sed 's/ .*//'" | ssh -i $SSH_KEY -o StrictHostKeychecking=no ubuntu@$NFS_IP sudo su) |
| 45 | if [ "$ROBOT_POD" == "" ]; then |
| 46 | exit 1 |
| 47 | fi |
| 48 | |
| 49 | POD_TO_KILL=$(echo "kubectl -n onap get pods | grep $POD_TO_DELETE | sed 's/ .*//' | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su) |
| 50 | echo "kubectl -n onap delete pod $POD_TO_KILL" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 51 | for n in $(seq 1 180); do |
| 52 | sleep 30 |
| 53 | RESULT=$(ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -c "kubectl -n onap get pods"' | grep -vE 'NAME|Completed|Error|1/1|2/2|3/3' | wc -l) |
| 54 | if [[ $? -eq 0 && $RESULT -eq 0 ]]; then |
| 55 | break |
| 56 | fi |
| 57 | done |
| 58 | |
| 59 | ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap healthdist"' |
| 60 | retval=$? |
| 61 | |
| 62 | LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep healthdist | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su) |
| 63 | if [ "$LOG_DIR" == "" ]; then |
| 64 | exit 1 |
| 65 | fi |
| 66 | |
| 67 | rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/ |
| 68 | |
| 69 | echo "kubectl top nodes" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 70 | echo "kubectl get pods -n onap | grep -vE 'Completed|Error|1/1|2/2|3/3'" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 71 | |
| 72 | echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/" |
| 73 | |
| 74 | exit 0 |
| 75 | publishers: |
| 76 | - integration-robot |
| 77 | - archive-logs |
| 78 | |
| 79 | - job-template: |
| 80 | name: '{env}-resilience-instantiateDemoVFWCL' |
| 81 | disabled: '{obj:disabled_var}' |
| 82 | project-type: freestyle |
| 83 | lab-name: '' |
| 84 | tenant-name: '' |
| 85 | scm: |
| 86 | - git-integration: |
| 87 | branch: "{integration-branch}" |
| 88 | wrappers: |
| 89 | - timestamps |
| 90 | parameters: |
| 91 | - string: |
| 92 | name: POD_TO_DELETE |
| 93 | description: 'Name of pod to delete. This string will be grepped against the pod list and used to delete the pod.' |
| 94 | properties: |
| 95 | - build-blocker: |
| 96 | blocking-jobs: |
| 97 | - "{env}-deploy" |
| 98 | - "{env}-healthcheck" |
| 99 | builders: |
| 100 | - shell: | |
| 101 | #!/bin/bash |
| 102 | set +x |
| 103 | . $WORKSPACE/deployment/heat/onap-rke/env/{lab-name}/{tenant-name}-openrc |
| 104 | . $JENKINS_HOME/onap-lab-ci/labs/{lab-name}-openrc |
| 105 | source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh |
| 106 | |
| 107 | set -x |
| 108 | rm -rf $WORKSPACE/archives |
| 109 | mkdir -p $WORKSPACE/archives |
| 110 | |
| 111 | SSH_KEY=~/.ssh/onap_key |
| 112 | STACK_NAME="{stack-name}" |
| 113 | NFS_IP=$(openstack stack output show $STACK_NAME nfs_vm_ip -c output_value -f value) |
| 114 | K8S_IP=$(openstack stack output show $STACK_NAME k8s_01_vm_ip -c output_value -f value) |
| 115 | ssh-keygen -R $NFS_IP |
| 116 | |
| 117 | echo "kubectl top nodes" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 118 | echo "kubectl get pods -n onap | grep -vE 'Completed|Error|1/1|2/2|3/3'" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 119 | |
| 120 | ROBOT_POD=$(echo "kubectl -n onap get pods | grep robot | sed 's/ .*//'" | ssh -i $SSH_KEY -o StrictHostKeychecking=no ubuntu@$NFS_IP sudo su) |
| 121 | if [ "$ROBOT_POD" == "" ]; then |
| 122 | exit 1 |
| 123 | fi |
| 124 | |
| 125 | POD_TO_KILL=$(echo "kubectl -n onap get pods | grep $POD_TO_DELETE | sed 's/ .*//' | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su) |
| 126 | echo "kubectl -n onap delete pod $POD_TO_KILL" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 127 | for n in $(seq 1 180); do |
| 128 | sleep 30 |
| 129 | RESULT=$(ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -c "kubectl -n onap get pods"' | grep -vE 'NAME|Completed|Error|1/1|2/2|3/3' | wc -l) |
| 130 | if [[ $? -eq 0 && $RESULT -eq 0 ]]; then |
| 131 | break |
| 132 | fi |
| 133 | done |
| 134 | |
| 135 | ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap instantiateDemoVFWCL"' |
| 136 | retval=$? |
| 137 | |
| 138 | LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep instantiateDemoVFWCL | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su) |
| 139 | if [ "$LOG_DIR" == "" ]; then |
| 140 | exit 1 |
| 141 | fi |
| 142 | |
| 143 | rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/ |
| 144 | |
| 145 | echo "kubectl top nodes" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 146 | echo "kubectl get pods -n onap | grep -vE 'Completed|Error|1/1|2/2|3/3'" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 147 | |
| 148 | echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/" |
| 149 | |
| 150 | # clean up demo stacks |
| 151 | DEMO_STACKS=$(openstack stack list -f value -c "Stack Name" --sort creation_time:desc | grep Vfmodule_Demo_ ) |
| 152 | if [ ! -z "$DEMO_STACKS" ]; then |
| 153 | openstack stack delete -y $DEMO_STACKS |
| 154 | fi |
| 155 | |
| 156 | # clean up vVG VNFs |
| 157 | VVG_SERVERS=$(openstack server list -f value -c Name --sort creation_time:desc | grep vVG_) |
| 158 | if [ ! -z "$VVG_SERVERS" ]; then |
| 159 | openstack server delete $VVG_SERVERS |
| 160 | fi |
| 161 | |
| 162 | exit 0 |
| 163 | publishers: |
| 164 | - integration-robot |
| 165 | - archive-logs |
| 166 | |
| 167 | - job-template: |
| 168 | name: '{env}-resilience-vfwclosedloop' |
| 169 | disabled: '{obj:disabled_var}' |
| 170 | project-type: freestyle |
| 171 | lab-name: '' |
| 172 | tenant-name: '' |
| 173 | scm: |
| 174 | - git-integration: |
| 175 | branch: "{integration-branch}" |
| 176 | wrappers: |
| 177 | - timestamps |
| 178 | parameters: |
| 179 | - string: |
| 180 | name: POD_TO_DELETE |
| 181 | description: 'Name of pod to delete. This string will be grepped against the pod list and used to delete the pod.' |
| 182 | properties: |
| 183 | - build-blocker: |
| 184 | blocking-jobs: |
| 185 | - "{env}-deploy" |
| 186 | - "{env}-healthcheck" |
| 187 | builders: |
| 188 | - shell: | |
| 189 | #!/bin/bash |
| 190 | set +x |
| 191 | . $WORKSPACE/deployment/heat/onap-rke/env/{lab-name}/{tenant-name}-openrc |
| 192 | . $JENKINS_HOME/onap-lab-ci/labs/{lab-name}-openrc |
| 193 | source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh |
| 194 | |
| 195 | set -x |
| 196 | rm -rf $WORKSPACE/archives |
| 197 | mkdir -p $WORKSPACE/archives |
| 198 | |
| 199 | SSH_KEY=~/.ssh/onap_key |
| 200 | STACK_NAME="{stack-name}" |
| 201 | NFS_IP=$(openstack stack output show $STACK_NAME nfs_vm_ip -c output_value -f value) |
| 202 | K8S_IP=$(openstack stack output show $STACK_NAME k8s_01_vm_ip -c output_value -f value) |
| 203 | ssh-keygen -R $NFS_IP |
| 204 | |
| 205 | echo "kubectl top nodes" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 206 | echo "kubectl get pods -n onap | grep -vE 'Completed|Error|1/1|2/2|3/3'" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 207 | |
| 208 | ROBOT_POD=$(echo "kubectl -n onap get pods | grep robot | sed 's/ .*//'" | ssh -i $SSH_KEY -o StrictHostKeychecking=no ubuntu@$NFS_IP sudo su) |
| 209 | if [ "$ROBOT_POD" == "" ]; then |
| 210 | exit 1 |
| 211 | fi |
| 212 | |
| 213 | POD_TO_KILL=$(echo "kubectl -n onap get pods | grep $POD_TO_DELETE | sed 's/ .*//' | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su) |
| 214 | echo "kubectl -n onap delete pod $POD_TO_KILL" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 215 | for n in $(seq 1 180); do |
| 216 | sleep 30 |
| 217 | RESULT=$(ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -c "kubectl -n onap get pods"' | grep -vE 'NAME|Completed|Error|1/1|2/2|3/3' | wc -l) |
| 218 | if [[ $? -eq 0 && $RESULT -eq 0 ]]; then |
| 219 | break |
| 220 | fi |
| 221 | done |
| 222 | |
| 223 | PKG_STACK=$(openstack stack list -f value -c "Stack Name" --sort creation_time:desc | grep Vfmodule_Demo_vFWCLvPKG | head -1) |
| 224 | PUBLIC_NET_ID=$(openstack stack show $STACK_NAME -f json | jq -r '.parameters.public_net_id') |
| 225 | PUBLIC_NET_NAME=$(openstack network show $PUBLIC_NET_ID -f value -c name) |
| 226 | PKG_IP=$(openstack stack resource show $PKG_STACK vpg_server_0 -f json | jq -r ".attributes.addresses.$PUBLIC_NET_NAME[0].addr") |
| 227 | |
| 228 | for n in $(seq 1 10); do |
| 229 | echo "Wait for vfwclosedloop count $n of 10" |
| 230 | echo "/root/oom/kubernetes/robot/demo-k8s.sh onap vfwclosedloop $PKG_IP" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 231 | RESULT=$? |
| 232 | if [[ $RESULT -eq 0 ]]; then |
| 233 | break |
| 234 | fi |
| 235 | done |
| 236 | |
| 237 | LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep vfwclosedloop | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su) |
| 238 | if [ "$LOG_DIR" == "" ]; then |
| 239 | exit 1 |
| 240 | fi |
| 241 | |
| 242 | rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/ |
| 243 | |
| 244 | echo "kubectl top nodes" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 245 | echo "kubectl get pods -n onap | grep -vE 'Completed|Error|1/1|2/2|3/3'" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 246 | |
| 247 | echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/" |
| 248 | |
| 249 | exit 0 |
| 250 | publishers: |
| 251 | - integration-robot |
| 252 | - archive-logs |
| 253 | |
| 254 | |
| 255 | - job-template: |
| 256 | disabled_var: |
| 257 | name: '{env}-stability72hr' |
| 258 | disabled: '{obj:disabled_var}' |
| 259 | project-type: freestyle |
| 260 | lab-name: '' |
| 261 | tenant-name: '' |
| 262 | scm: |
| 263 | - git-integration: |
| 264 | branch: "{integration-branch}" |
| 265 | wrappers: |
| 266 | - timestamps |
| 267 | triggers: |
| 268 | - timed: '0 * * * *' |
| 269 | properties: |
| 270 | - build-blocker: |
| 271 | blocking-jobs: |
| 272 | - "{env}-deploy" |
| 273 | - "{env}-healthcheck" |
| 274 | - "{env}-instantiate" |
| 275 | - "{env}-manual" |
| 276 | - "{env}-staging-manual" |
| 277 | builders: |
| 278 | - shell: | |
| 279 | #!/bin/bash |
| 280 | set +x |
| 281 | . $WORKSPACE/deployment/heat/onap-rke/env/{lab-name}/{tenant-name}-openrc |
| 282 | . $JENKINS_HOME/onap-lab-ci/labs/{lab-name}-openrc |
| 283 | source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh |
| 284 | |
| 285 | set -x |
| 286 | rm -rf $WORKSPACE/archives |
| 287 | mkdir -p $WORKSPACE/archives |
| 288 | |
| 289 | SSH_KEY=~/.ssh/onap_key |
| 290 | STACK_NAME="{stack-name}" |
| 291 | NFS_IP=$(openstack stack output show $STACK_NAME nfs_vm_ip -c output_value -f value) |
| 292 | K8S_IP=$(openstack stack output show $STACK_NAME k8s_01_vm_ip -c output_value -f value) |
| 293 | ssh-keygen -R $NFS_IP |
| 294 | |
| 295 | echo "kubectl top nodes" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 296 | echo "kubectl get pods -n onap | grep -vE 'Completed|Error|1/1|2/2|3/3'" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 297 | |
| 298 | ROBOT_POD=$(echo "kubectl -n onap get pods | grep robot | sed 's/ .*//'" | ssh -i $SSH_KEY -o StrictHostKeychecking=no ubuntu@$NFS_IP sudo su) |
| 299 | if [ "$ROBOT_POD" == "" ]; then |
| 300 | exit 1 |
| 301 | fi |
| 302 | |
| 303 | ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap stability72hr"' |
| 304 | retval=$? |
| 305 | |
| 306 | LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep stability72hr | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su) |
| 307 | if [ "$LOG_DIR" == "" ]; then |
| 308 | exit 1 |
| 309 | fi |
| 310 | |
| 311 | rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/ |
| 312 | |
| 313 | echo "kubectl top nodes" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 314 | echo "kubectl get pods -n onap | grep -vE 'Completed|Error|1/1|2/2|3/3'" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 315 | |
| 316 | echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/" |
| 317 | |
| 318 | # clean up demo stacks |
| 319 | DEMO_STACKS=$(openstack stack list -f value -c "Stack Name" --sort creation_time:desc | grep Vfmodule_Ete_ ) |
| 320 | if [ ! -z "$DEMO_STACKS" ]; then |
| 321 | openstack stack delete -y $DEMO_STACKS |
| 322 | fi |
| 323 | |
| 324 | # clean up vVG VNFs |
| 325 | VVG_SERVERS=$(openstack server list -f value -c Name --sort creation_time:desc | grep vVG_) |
| 326 | if [ ! -z "$VVG_SERVERS" ]; then |
| 327 | openstack server delete $VVG_SERVERS |
| 328 | fi |
| 329 | |
| 330 | exit 0 |
| 331 | publishers: |
| 332 | - integration-robot |
| 333 | - archive-logs |
| 334 | |
| 335 | - job-template: |
| 336 | disabled_var: |
| 337 | name: '{env}-vfwclosedloop' |
| 338 | disabled: '{obj:disabled_var}' |
| 339 | project-type: freestyle |
| 340 | lab-name: '' |
| 341 | tenant-name: '' |
| 342 | scm: |
| 343 | - git-integration: |
| 344 | branch: "{integration-branch}" |
| 345 | wrappers: |
| 346 | - timestamps |
| 347 | triggers: |
| 348 | - timed: '0 * * * *' |
| 349 | properties: |
| 350 | - build-blocker: |
| 351 | blocking-jobs: |
| 352 | - "{env}-deploy" |
| 353 | - "{env}-healthcheck" |
| 354 | - "{env}-instantiate" |
| 355 | - "{env}-manual" |
| 356 | - "{env}-staging-manual" |
| 357 | builders: |
| 358 | - shell: | |
| 359 | #!/bin/bash |
| 360 | set +x |
| 361 | . $WORKSPACE/deployment/heat/onap-rke/env/{lab-name}/{tenant-name}-openrc |
| 362 | . $JENKINS_HOME/onap-lab-ci/labs/{lab-name}-openrc |
| 363 | source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh |
| 364 | |
| 365 | set -x |
| 366 | rm -rf $WORKSPACE/archives |
| 367 | mkdir -p $WORKSPACE/archives |
| 368 | |
| 369 | SSH_KEY=~/.ssh/onap_key |
| 370 | STACK_NAME="{stack-name}" |
| 371 | NFS_IP=$(openstack stack output show $STACK_NAME nfs_vm_ip -c output_value -f value) |
| 372 | K8S_IP=$(openstack stack output show $STACK_NAME k8s_01_vm_ip -c output_value -f value) |
| 373 | ssh-keygen -R $NFS_IP |
| 374 | |
| 375 | echo "kubectl top nodes" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 376 | echo "kubectl get pods -n onap | grep -vE 'Completed|Error|1/1|2/2|3/3'" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 377 | |
| 378 | ROBOT_POD=$(echo "kubectl -n onap get pods | grep robot | sed 's/ .*//'" | ssh -i $SSH_KEY -o StrictHostKeychecking=no ubuntu@$NFS_IP sudo su) |
| 379 | if [ "$ROBOT_POD" == "" ]; then |
| 380 | exit 1 |
| 381 | fi |
| 382 | |
| 383 | PKG_STACK=$(openstack stack list -f value -c "Stack Name" --sort creation_time:desc | grep Vfmodule_Demo_vFWCLvPKG | head -1) |
| 384 | PUBLIC_NET_ID=$(openstack stack show $STACK_NAME -f json | jq -r '.parameters.public_net_id') |
| 385 | PUBLIC_NET_NAME=$(openstack network show $PUBLIC_NET_ID -f value -c name) |
| 386 | PKG_IP=$(openstack stack resource show $PKG_STACK vpg_server_0 -f json | jq -r ".attributes.addresses.$PUBLIC_NET_NAME[0].addr") |
| 387 | |
| 388 | |
| 389 | echo "/root/oom/kubernetes/robot/demo-k8s.sh onap vfwclosedloop $PKG_IP" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 390 | retval=$? |
| 391 | |
| 392 | LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep vfwclosedloop | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su) |
| 393 | if [ "$LOG_DIR" == "" ]; then |
| 394 | exit 1 |
| 395 | fi |
| 396 | |
| 397 | rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/ |
| 398 | |
| 399 | echo "kubectl top nodes" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 400 | echo "kubectl get pods -n onap | grep -vE 'Completed|Error|1/1|2/2|3/3'" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su |
| 401 | |
| 402 | echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/" |
| 403 | |
| 404 | exit 0 |
| 405 | publishers: |
| 406 | - integration-robot |
| 407 | - archive-logs |
| 408 | |
| 409 | |
| 410 | - job-template: |
| 411 | name: 'oom-verify' |
| 412 | project-type: freestyle |
| 413 | parameters: |
| 414 | - string: |
| 415 | name: GERRIT_PROJECT |
| 416 | default: 'oom' |
| 417 | description: 'GERRIT_PROJECT parameter if not given by trigger' |
| 418 | - string: |
| 419 | name: GERRIT_BRANCH |
| 420 | default: '{branch}' |
| 421 | description: 'JJB configured GERRIT_BRANCH parameter' |
| 422 | - string: |
| 423 | name: GERRIT_REFSPEC |
| 424 | default: 'refs/heads/{branch}' |
| 425 | description: 'GERRIT_REFSPEC parameter if not given by trigger' |
| 426 | scm: |
| 427 | - gerrit-trigger-scm |
| 428 | triggers: |
| 429 | - gerrit: |
| 430 | server-name: 'gerrit.onap.org' |
| 431 | trigger-on: |
| 432 | - patchset-created-event: |
| 433 | exclude-drafts: 'false' |
| 434 | exclude-trivial-rebase: 'false' |
| 435 | exclude-no-code-change: 'false' |
| 436 | - draft-published-event |
| 437 | - comment-added-contains-event: |
| 438 | comment-contains-value: 'recheck' |
| 439 | projects: |
| 440 | - project-compare-type: 'ANT' |
| 441 | project-pattern: 'oom' |
| 442 | branches: |
| 443 | - branch-compare-type: 'ANT' |
| 444 | branch-pattern: '**/{branch}' |
| 445 | file-paths: |
| 446 | - compare-type: 'ANT' |
| 447 | pattern: 'kubernetes/**/*.yaml' |
| 448 | - project-compare-type: 'ANT' |
| 449 | project-pattern: '*/oom' |
| 450 | branches: |
| 451 | - branch-compare-type: 'ANT' |
| 452 | branch-pattern: '**/{branch}' |
| 453 | file-paths: |
| 454 | - compare-type: 'ANT' |
| 455 | pattern: '**/*.yaml' |
| 456 | wrappers: |
| 457 | - timestamps |
| 458 | - timeout: |
| 459 | timeout: 720 |
| 460 | fail: true |
| 461 | builders: |
| 462 | - shell: | |
| 463 | #!/bin/bash |
| 464 | |
| 465 | set +e |
| 466 | set -x |
| 467 | rm -rf $WORKSPACE/archives |
| 468 | mkdir -p $WORKSPACE/archives |
| 469 | |
| 470 | NEXUS_RELEASE_PREFIX="https://nexus3.onap.org/repository/docker.release/v2" |
| 471 | RELEASE_TAGS_PATH="/tmp/onap-docker-release" |
| 472 | err=0 |
| 473 | |
| 474 | # if no files changed, will scan all files |
| 475 | CHANGED_FILES="" |
| 476 | if [ $(git rev-parse HEAD) != $(git rev-parse origin/master) ]; then |
| 477 | CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r HEAD) |
| 478 | fi |
| 479 | IMAGES_FILE=$WORKSPACE/archives/images.txt |
| 480 | rgrep --exclude-dir=pnda -n -E ':\s*onap/.*:.*' $CHANGED_FILES | awk '{{$1=$1}};1' | sort > $IMAGES_FILE |
| 481 | |
| 482 | set +x |
| 483 | while read line; do |
| 484 | location=$(echo $line | cut -d: -f-2) |
| 485 | image_tag=$(echo $line | cut -d: -f3- | awk '{{$1=$1}};1' | cut -d' ' -f2) |
| 486 | image=$(echo $image_tag | cut -d : -f 1) |
| 487 | tag=$(echo $image_tag | cut -d : -f 2) |
| 488 | |
| 489 | case $tag in |
| 490 | *STAGING*) |
| 491 | echo "[ERROR] $location: $image:$tag not released" |
| 492 | (( err++ )) |
| 493 | ;; |
| 494 | *SNAPSHOT*) |
| 495 | echo "[ERROR] $location: $image:$tag not released" |
| 496 | (( err++ )) |
| 497 | ;; |
| 498 | *latest*) |
| 499 | echo "[ERROR] $location: $image:$tag not released" |
| 500 | (( err++ )) |
| 501 | ;; |
| 502 | *) |
| 503 | TAGS_FILE=$RELEASE_TAGS_PATH/$image/tags.txt |
| 504 | mkdir -p $RELEASE_TAGS_PATH/$image |
| 505 | touch $TAGS_FILE |
| 506 | grep -q "^$tag\$" $TAGS_FILE |
| 507 | if [ $? -ne 0 ]; then |
| 508 | # not found; download latest |
| 509 | curl -s $NEXUS_RELEASE_PREFIX/$image/tags/list | jq -r '.tags[]' > $TAGS_FILE 2> /dev/null |
| 510 | grep -q "^$tag\$" $TAGS_FILE |
| 511 | if [ $? -ne 0 ]; then |
| 512 | echo "[ERROR] $location: $image:$tag not released" |
| 513 | (( err++ )) |
| 514 | fi |
| 515 | fi |
| 516 | ;; |
| 517 | esac |
| 518 | done < $IMAGES_FILE |
| 519 | echo $err unreleased images found. |
| 520 | exit $err |
| 521 | |
| 522 | publishers: |
| 523 | - archive-logs |