cd063e2e620eded47156d88967b08960dcfee7ee
[releng/builder.git] / jjb / packaging / include-raw-test-puppet.sh
1 #!/bin/bash
2
3 # Options:
4 #   -x: Echo commands
5 #   -e: Fail on errors
6 #   -o pipefail: Fail on errors in scripts this calls, give stacktrace
7 set -ex -o pipefail
8
9 # Adapted from puppet-opendaylight/Vagrantfile
10 # https://github.com/dfarrell07/puppet-opendaylight/blob/master/Vagrantfile
11
12 # Install system-wide dependencies
13 # TODO: Are all of these still needed?
14 sudo yum install -y ruby-devel gcc-c++ zlib-devel patch redhat-rpm-config make rubygems
15
16 # Install RVM to help build recent version of Ruby
17 # The ruby_dep gem requires >=2.2.5, 2.0.0 is the latest pre-packaged for CentOS
18 gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
19 curl -L get.rvm.io | bash -s stable
20 # Expected by RVM, seems required to make RVM functions (`rvm use`) available
21 # shellcheck disable=SC1090
22 source "$HOME/.rvm/scripts/rvm"
23 rvm install 2.4.0
24 ruby --version
25 # This has to be done as a login shell to get rvm fns
26 # https://rvm.io/support/faq#what-shell-login-means-bash-l
27 # http://superuser.com/questions/306530/run-remote-ssh-command-with-full-login-shell
28 bash -lc "rvm use 2.4.0 --default"
29 ruby --version
30
31 # Install gems dependencies of puppet-opendaylight via Bundler
32 gem install bundler
33 echo export PATH="\\$PATH:/usr/local/bin" >> "$HOME/.bashrc"
34 pushd "$WORKSPACE/puppet"
35 bundle install
36 bundle update
37
38 # Execute set of tests passed as param from job
39 bundle exec rake "$TEST_SUITE"