blob: 4b7e5d7e63c3ed002ce0bbb6bf35b9157c82f6cd [file] [log] [blame]
Thomas Vachuska4702a262016-03-02 15:31:52 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Validates that the local environment is ready to commence release process.
4# -----------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7
8GERRIT_USER=${GERRIT_USER:-$USER}
Brian O'Connor156c4802016-03-02 15:50:38 -08009WIKI_USER=${WIKI_USER:-$USER}
Thomas Vachuska4702a262016-03-02 15:31:52 -080010
11set -e
12
13# Test access to Gerrit (Administrator)
14function testGerritAccess {
15 trap "echo 'FAILED'" ERR
Brian O'Connor156c4802016-03-02 15:50:38 -080016 printf "Checking Gerrit ONOS Release group access... "
17 ssh -p 29418 gerrit.onosproject.org gerrit ls-members "ONOS\ Release"\
18 --recursive | grep -q $GERRIT_USER
19
Thomas Vachuska4702a262016-03-02 15:31:52 -080020 echo "OK"
21}
22
23# Test access to wiki.onosproject.org
24function testWikiAccess {
25 trap "echo 'FAILED'" ERR
26 printf "Checking Wiki access... "
Brian O'Connor156c4802016-03-02 15:50:38 -080027 ssh $WIKI_USER@wiki.onosproject.org "test -w /var/www/api/index.html"
Thomas Vachuska4702a262016-03-02 15:31:52 -080028 echo "OK"
29}
30
31# Test access to EC2
32function testEC2Access {
33 aux=$(mktemp)
34 trap "cat $aux; rm -f $aux; echo 'FAILED'" ERR
35 printf "Checking EC2 access... "
36 uploadToS3.py -v 1>$aux 2>&1
37 rm -f $aux
38 echo "OK"
39}
40
41# Sonatype account must be created & ~/.m2/settings.xml must be configured
42# Test by "releasing" a fake project setup for that purpose to validate access.
43function testSonatypeAccess {
44 aux=$(mktemp)
45 trap "cat $aux; rm -f $aux; echo 'FAILED'" ERR
46 printf "Checking Sonatype access... "
47 pushd $ONOS_ROOT/tools/build/release-test >/dev/null
48 # TODO: Figure out how to supress the GPG note
49 mvn -Prelease clean deploy org.sonatype.plugins:nexus-staging-maven-plugin:drop \
50 1>$aux 2>&1 </dev/null
51 mvn clean >/dev/null
52 rm -f $aux
53 popd >/dev/null
54 echo "OK"
55}
56
57testGerritAccess
58testWikiAccess
59testEC2Access
60testSonatypeAccess
61
62echo "Ready to commence release process!"
63