Fix the error when deploying VM by compass
[ci-management.git] / jjb / iec / 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
35 config_vm
36
37 modify_workdir
38
39 ./deploy.sh
40
41 echo "Compass Deploy successful"
42
43 rm -rf "$COMPASS_WORK_DIR"
44 exit 0