Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | saveenv=$- |
| 4 | set -e |
Brian Haley | 4f97149 | 2020-02-17 16:40:33 -0500 | [diff] [blame] | 5 | |
| 6 | # install_octavia_tempest_plugin |
| 7 | function install_octavia_tempest_plugin { |
| 8 | setup_dev_lib "octavia-tempest-plugin" |
| 9 | } |
| 10 | |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 11 | function 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 Johnson | 2735735 | 2020-11-13 13:55:09 -0800 | [diff] [blame] | 19 | sudo mkdir -m755 -p /opt/octavia-tempest-plugin |
| 20 | sudo chown $STACK_USER /opt/octavia-tempest-plugin |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 21 | CGO_ENABLED=0 GOOS=linux go build \ |
Michael Johnson | 2735735 | 2020-11-13 13:55:09 -0800 | [diff] [blame] | 22 | -a -ldflags '-s -w -extldflags -static' \ |
| 23 | -o /opt/octavia-tempest-plugin/test_server.bin \ |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 24 | ${DEST}/octavia-tempest-plugin/octavia_tempest_plugin/contrib/test_server/test_server.go |
| 25 | } |
| 26 | |
Brian Haley | 4f97149 | 2020-02-17 16:40:33 -0500 | [diff] [blame] | 27 | if [[ "$1" == "stack" ]]; then |
| 28 | case "$2" in |
| 29 | install) |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 30 | # Install dev library if |
Brian Haley | 0818205 | 2020-11-18 12:17:30 -0500 | [diff] [blame^] | 31 | # - 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 Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 34 | # - or the user explicitly requests it (INSTALL_TEMPEST=True) |
Brian Haley | 0818205 | 2020-11-18 12:17:30 -0500 | [diff] [blame^] | 35 | if [[ ! "$DEVSTACK_SERIES" =~ (stein|train) ]] || [[ "$(trueorfalse False INSTALL_TEMPEST)" == "True" ]]; then |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 36 | 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 Haley | 4f97149 | 2020-02-17 16:40:33 -0500 | [diff] [blame] | 43 | ;; |
| 44 | esac |
| 45 | fi |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 46 | |
| 47 | if [[ $saveenv =~ e ]]; then |
| 48 | set -e |
| 49 | else |
| 50 | set +e |
| 51 | fi |