Use newer bluval images
[icn.git] / ci / jjb / shell / bluval.sh
1 #!/usr/bin/env bash
2
3 # Ensure we fail the job if any steps fail
4 # Disable 'globbing'
5 set -eux -o pipefail
6
7 SCRIPT_DIR="$(readlink -f $(dirname ${BASH_SOURCE[0]}))"
8
9 echo "[ICN] Downloading ICN"
10 git clone "https://gerrit.akraino.org/r/icn"
11
12 echo "[ICN] Bringing up test cluster"
13 function clean_vm {
14     pushd ${SCRIPT_DIR}/icn
15     vagrant destroy -f
16     popd
17 }
18 trap clean_vm EXIT
19 pushd icn
20 # TODO Improve VM performance by only using cores on the same node
21 #sed -i -e '/^\s\+libvirt.cpus/!b' -e "h;s/\S.*/libvirt.cpuset = '0-21,44-65'/;H;g" Vagrantfile
22 vagrant destroy -f
23 vagrant up --no-parallel
24 vagrant ssh jump -c "
25 set -exuf
26 cd /icn
27 sudo su -c 'make jump_server vm_cluster'
28 "
29 popd
30
31 echo "[ICN] Installing jenkins identity into test cluster"
32 cp ${SCRIPT_DIR}/icn/deploy/site/vm/id_rsa site-vm-rsa
33 chmod 0600 site-vm-rsa
34 ssh-keygen -f ${CLUSTER_SSH_KEY} -y > ${CLUSTER_SSH_KEY}.pub
35 ssh-copy-id -i ${CLUSTER_SSH_KEY} -f ${CLUSTER_SSH_USER}@${CLUSTER_MASTER_IP} -o IdentityFile=site-vm-rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
36
37 echo "[ICN] Patching kube-hunter image location"
38 cat <<'EOF' | patch -p1
39 diff --git a/tests/variables.yaml b/tests/variables.yaml
40 index fa3fe71..c54f37f 100644
41 --- a/tests/variables.yaml
42 +++ b/tests/variables.yaml
43 @@ -82,3 +82,7 @@ dns_domain: cluster.local                     # cluster's DNS domain
44  # NONE, WARN, INFO, DEBUG, and TRACE.
45  # Default is INFO
46  loglevel: INFO
47 +
48 +kube_hunter:
49 +  path: 'aquasec'
50 +  name: 'kube-hunter:edge'
51 EOF
52
53 echo "[ICN] Downloading run_bluval.sh from upstream ci-management"
54 wget --read-timeout=10 --timeout=10 --waitretry=10 -t 10 https://raw.githubusercontent.com/akraino-edge-stack/ci-management/master/jjb/shell/run_bluval.sh
55
56 echo "[ICN] Patching run_bluval.sh"
57 cat <<'EOF' | patch -p3
58 diff --git a/jjb/shell/run_bluval.sh b/jjb/shell/run_bluval.sh
59 index 75d20eb..dbfad03 100755
60 --- a/jjb/shell/run_bluval.sh
61 +++ b/jjb/shell/run_bluval.sh
62 @@ -177,6 +177,7 @@ if [ "$pull" == "true" ] || [ "$PULL" == "yes" ]
63  then
64      options+=" -P"
65  fi
66 +options+=" -t amd64-latest"
67
68  set +e
69  if python3 --version > /dev/null; then
70 @@ -209,4 +210,3 @@ else
71      rm results.zip
72  fi
73
74 -rm -f ~/.netrc
75 EOF
76
77 echo "[ICN] Executing run_bluval.sh"
78 /bin/bash run_bluval.sh