osel/tools/test-setup.sh
Nate Johnston ca0e1ca769 Initial import of osel code
This is an initial import of the osel codebase.  The osel tool is a tool that
initiates external security scans (initially through Qualys) upon reciept of
AMQP events that indicate certain sensitive events have occurred, like a
security group rule change.

The commit history had to be thrown away because it contained some non-public
data, so I would like to call out the following contributors:

This uses go 1.10 and vgo for dependency management.

Co-Authored-By: Charles Bitter <Charles_Bitter@cable.comcast.com>
Co-Authored-By: Olivier Gagnon <Olivier_Gagnon@cable.comcast.com>
Co-Authored-By: Joseph Sleiman <Joseph_Sleiman@comcast.com>

Change-Id: Ib6abe2024fd91978b783ceee4cff8bb4678d7b15
2018-03-24 15:30:57 +00:00

60 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# You cannot go build-time dependency fetching from projects hosted on github
# without a github token, otherwise you get restricted by API throttling.
# See: https://github.com/golang/go/issues/23955
echo "machine api.github.com login openstackzuul password dba1634cb701f1c514f3268784b1d0a6512c12d4" >> $HOME/.netrc
mkdir -p /home/zuul/go/src/v 2>/dev/null
# Setup the environment prior to testing.
export PATH=$PATH:$GOPATH/bin
# Get OS
case $(uname -s) in
Darwin)
OS=darwin
;;
Linux)
if LSB_RELEASE=$(which lsb_release); then
OS=$($LSB_RELEASE -s -c)
else
# No lsb-release, trya hack or two
if which dpkg 1>/dev/null; then
OS=debian
elif which yum 1>/dev/null || which dnf 1>/dev/null; then
OS=redhat
else
echo "Linux distro not yet supported"
exit 1
fi
fi
;;
*)
echo "Unsupported OS"
exit 1
;;
esac
echo "Depected OS is '$OS'"
echo | sudo -S /bin/true 2>/dev/null
if [ $? != 0 ]; then
echo "Sudo does not work, so packages can not be installed"
exit 1
fi
# Now install go
case $OS in
xenial)
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt-get update
sudo apt-get install -y golang-go golint
;;
esac
# Install vgo https://github.com/golang/go/wiki/vgo
if which go 1>/dev/null; then
sudo go get -u -v golang.org/x/vgo
else
echo "go not found, install golang from source?"
fi