9db4c0b918da13fbc83d0f29c136966cf6d64bac
[ci-management.git] / iec-compass-deploy.sh
1 #!/bin/bash
2 set -ex
3
4 cd compass4nfv
5
6 config_vm(){
7   # Create 3 virtual machine
8   echo -e "  - name: host3\n    roles:\n      - kube_node" >> deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml
9   # Remove useless code
10   # The ansible-kubernetes.yml file contains the list of softwares which will
11   # be installed on VM. But for IEC projects, some parts are not essnetial. So
12   # useless part will be removed.
13   # Delete some contents from line 28 to end.
14   sed -i '28,$d' deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml
15
16   export ADAPTER_OS_PATTERN='(?i)ubuntu-16.04.*arm.*'
17   export OS_VERSION="xenial"
18   export KUBERNETES_VERSION="v1.13.0"
19
20   export DHA="deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml"
21   export NETWORK="deploy/conf/vm_environment/network.yml"
22   export VIRT_NUMBER=3 VIRT_CPUS=4 VIRT_MEM=12288 VIRT_DISK=50G
23 }
24
25 modify_workdir(){
26   # When deploying the OS by compass, long path will cause the deploying system failed.
27   # we will create a soft link to walk around this problem.
28   COMPASS_WORK_DIR=${HOME}/compass-work
29
30   ln -sfn $(pwd)/work $COMPASS_WORK_DIR
31
32   sed -i "s#\$COMPASS_DIR/work#$COMPASS_WORK_DIR#g" deploy/launch.sh
33
34   # Fix docker-compose -> requests version mismatch with other
35   # Akraino CI jobs (installed requests should be >= 2.12)
36   sed -i "s/\(docker-compose\)==1.14.0/\1==1.24.1/g" deploy/prepare.sh
37 }
38
39 config_vm
40
41 modify_workdir
42
43 ./deploy.sh
44
45 echo "Compass Deploy successful"
46
47 rm -rf "$COMPASS_WORK_DIR"
48 rm -rf work
49 exit 0