Thomas Vachuska | 4702a26 | 2016-03-02 15:31:52 -0800 | [diff] [blame] | 1 | #!/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 | |
| 8 | GERRIT_USER=${GERRIT_USER:-$USER} |
Brian O'Connor | 156c480 | 2016-03-02 15:50:38 -0800 | [diff] [blame] | 9 | WIKI_USER=${WIKI_USER:-$USER} |
Thomas Vachuska | 4702a26 | 2016-03-02 15:31:52 -0800 | [diff] [blame] | 10 | |
| 11 | set -e |
| 12 | |
| 13 | # Test access to Gerrit (Administrator) |
| 14 | function testGerritAccess { |
| 15 | trap "echo 'FAILED'" ERR |
Brian O'Connor | 156c480 | 2016-03-02 15:50:38 -0800 | [diff] [blame] | 16 | 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 Vachuska | 4702a26 | 2016-03-02 15:31:52 -0800 | [diff] [blame] | 20 | echo "OK" |
| 21 | } |
| 22 | |
| 23 | # Test access to wiki.onosproject.org |
| 24 | function testWikiAccess { |
| 25 | trap "echo 'FAILED'" ERR |
| 26 | printf "Checking Wiki access... " |
Brian O'Connor | 156c480 | 2016-03-02 15:50:38 -0800 | [diff] [blame] | 27 | ssh $WIKI_USER@wiki.onosproject.org "test -w /var/www/api/index.html" |
Thomas Vachuska | 4702a26 | 2016-03-02 15:31:52 -0800 | [diff] [blame] | 28 | echo "OK" |
| 29 | } |
| 30 | |
| 31 | # Test access to EC2 |
| 32 | function 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. |
| 43 | function 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 | |
| 57 | testGerritAccess |
| 58 | testWikiAccess |
| 59 | testEC2Access |
| 60 | testSonatypeAccess |
| 61 | |
| 62 | echo "Ready to commence release process!" |
| 63 | |