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} |
| 9 | |
| 10 | set -e |
| 11 | |
| 12 | # Test access to Gerrit (Administrator) |
| 13 | function 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 |
| 22 | function 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 |
| 30 | function 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. |
| 41 | function 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 | |
| 55 | testGerritAccess |
| 56 | testWikiAccess |
| 57 | testEC2Access |
| 58 | testSonatypeAccess |
| 59 | |
| 60 | echo "Ready to commence release process!" |
| 61 | |