Merge "Add bier project system test job"
[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 # Update Int/Pack's puppet-opendaylight submodule to latest master
13 pushd "$WORKSPACE/packaging"
14 git submodule init
15 git submodule update --remote
16
17 # Install system-wide dependencies
18 sudo yum install -y ruby-devel gcc-c++ zlib-devel patch redhat-rpm-config make rubygems
19
20 # Install RVM to help build recent version of Ruby
21 # The ruby_dep gem requires >=2.2.5, 2.0.0 is the latest pre-packaged for CentOS
22 gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
23 curl -L get.rvm.io | bash -s stable
24 # Expected by RVM, seems required to make RVM functions (`rvm use`) available
25 # shellcheck disable=SC1090
26 source "$HOME/.rvm/scripts/rvm"
27 rvm install 2.4.0
28 ruby --version
29 # This has to be done as a login shell to get rvm fns
30 # https://rvm.io/support/faq#what-shell-login-means-bash-l
31 # http://superuser.com/questions/306530/run-remote-ssh-command-with-full-login-shell
32 bash -lc "rvm use 2.4.0 --default"
33 ruby --version
34
35 # Install gems dependencies of puppet-opendaylight via Bundler
36 gem install bundler
37 echo export PATH="\\$PATH:/usr/local/bin" >> "$HOME/.bashrc"
38 pushd "$WORKSPACE/packaging/puppet/puppet-opendaylight"
39 bundle install
40 bundle update
41
42 # Quick+important tests: Linting, rspec and Beaker on CentOS container tests
43 bundle exec rake sanity