blob: 5eac133c96a56303e33dd55d337263c5e3639bc3 [file] [log] [blame]
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +02001#!/usr/bin/env bash
2
3saveenv=$-
4set -e
Brian Haley4f971492020-02-17 16:40:33 -05005
6# install_octavia_tempest_plugin
7function install_octavia_tempest_plugin {
8 setup_dev_lib "octavia-tempest-plugin"
9}
10
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +020011function build_backend_test_server {
12 if is_fedora || is_ubuntu; then
13 install_package golang
14 else
15 die "Distribution not supported. Supported distributions are: RHEL, CentOS, Fedora, Ubuntu"
16 fi
17
18 go_path=$(find $DEST/tempest/.tox/tempest/ -name test_server.go)
Michael Johnson27357352020-11-13 13:55:09 -080019 sudo mkdir -m755 -p /opt/octavia-tempest-plugin
20 sudo chown $STACK_USER /opt/octavia-tempest-plugin
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +020021 CGO_ENABLED=0 GOOS=linux go build \
Michael Johnson27357352020-11-13 13:55:09 -080022 -a -ldflags '-s -w -extldflags -static' \
23 -o /opt/octavia-tempest-plugin/test_server.bin \
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +020024 ${DEST}/octavia-tempest-plugin/octavia_tempest_plugin/contrib/test_server/test_server.go
25}
26
Brian Haley4f971492020-02-17 16:40:33 -050027if [[ "$1" == "stack" ]]; then
28 case "$2" in
29 install)
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +020030 # Install dev library if
Brian Haley08182052020-11-18 12:17:30 -050031 # - the release is more recent than train (devstack in train would
32 # try to install it in a python2 env, but octavia-tempest-plugin
33 # is now a python3-only project)
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +020034 # - or the user explicitly requests it (INSTALL_TEMPEST=True)
Brian Haley08182052020-11-18 12:17:30 -050035 if [[ ! "$DEVSTACK_SERIES" =~ (stein|train) ]] || [[ "$(trueorfalse False INSTALL_TEMPEST)" == "True" ]]; then
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +020036 echo_summary "Installing octavia-tempest-plugin"
37 install_octavia_tempest_plugin
38 fi
39 ;;
40 test-config)
41 echo_summary "Building backend test server"
42 build_backend_test_server
Brian Haley4f971492020-02-17 16:40:33 -050043 ;;
44 esac
45fi
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +020046
47if [[ $saveenv =~ e ]]; then
48 set -e
49else
50 set +e
51fi