blob: 90629ddaee8f5d6d5a3f166b570f492ad399b859 [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}
9
10set -e
11
12# Test access to Gerrit (Administrator)
13function testGerritAccess {
14 trap "echo 'FAILED'" ERR
15 printf "Checking Gerrit Administrator access... "
16 ssh -p 29418 gerrit.onosproject.org gerrit ls-members Administrators \
17 --recursive | grep -q $GERRIT_USER
18 echo "OK"
19}
20
21# Test access to wiki.onosproject.org
22function testWikiAccess {
23 trap "echo 'FAILED'" ERR
24 printf "Checking Wiki access... "
25 ssh $USER@api.onosproject.org "test -w /var/www/api/index.html"
26 echo "OK"
27}
28
29# Test access to EC2
30function testEC2Access {
31 aux=$(mktemp)
32 trap "cat $aux; rm -f $aux; echo 'FAILED'" ERR
33 printf "Checking EC2 access... "
34 uploadToS3.py -v 1>$aux 2>&1
35 rm -f $aux
36 echo "OK"
37}
38
39# Sonatype account must be created & ~/.m2/settings.xml must be configured
40# Test by "releasing" a fake project setup for that purpose to validate access.
41function testSonatypeAccess {
42 aux=$(mktemp)
43 trap "cat $aux; rm -f $aux; echo 'FAILED'" ERR
44 printf "Checking Sonatype access... "
45 pushd $ONOS_ROOT/tools/build/release-test >/dev/null
46 # TODO: Figure out how to supress the GPG note
47 mvn -Prelease clean deploy org.sonatype.plugins:nexus-staging-maven-plugin:drop \
48 1>$aux 2>&1 </dev/null
49 mvn clean >/dev/null
50 rm -f $aux
51 popd >/dev/null
52 echo "OK"
53}
54
55testGerritAccess
56testWikiAccess
57testEC2Access
58testSonatypeAccess
59
60echo "Ready to commence release process!"
61