Committed by
Gerrit Code Review
Adding more checks to onos-release-prerequisites.
Change-Id: I6701a8c92d96491049dea937830730bd577cae27
Showing
1 changed file
with
70 additions
and
1 deletions
| ... | @@ -10,13 +10,80 @@ WIKI_USER=${WIKI_USER:-$USER} | ... | @@ -10,13 +10,80 @@ WIKI_USER=${WIKI_USER:-$USER} |
| 10 | 10 | ||
| 11 | set -e | 11 | set -e |
| 12 | 12 | ||
| 13 | +# Tests availability of the specified tools | ||
| 14 | +function testTool { | ||
| 15 | + trap "echo 'FAILED'" ERR | ||
| 16 | + printf "Checking $1 availability... " | ||
| 17 | + which -s $1 | ||
| 18 | + echo "OK" | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +# Tests availability of gerrit | ||
| 22 | +function testGerritTool { | ||
| 23 | + trap "echo 'FAILED'" ERR | ||
| 24 | + printf "Checking gerrit... " | ||
| 25 | + git review --version 2>/dev/null | ||
| 26 | + echo "OK" | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +# Tests availability of GPG or GPG2 | ||
| 30 | +function testGpgTool { | ||
| 31 | + trap "echo 'FAILED'" ERR | ||
| 32 | + printf "Checking gpg or gpg2... " | ||
| 33 | + which -s gpg || which -s gpg2 | ||
| 34 | + echo "OK" | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +# Tests Java version | ||
| 38 | +function testJavaVersion { | ||
| 39 | + trap "echo 'FAILED'" ERR | ||
| 40 | + printf "Checking Java version... " | ||
| 41 | + v=$(javac -version 2>&1 | grep 1.8.0_ | sed -e 's/.*1.8.0_\([0-9]*\).*/\1/g') | ||
| 42 | + test "$v" -ge 74 | ||
| 43 | + echo "OK" | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +# Tests availability of the required tools | ||
| 47 | +function testToolchain { | ||
| 48 | + for tool in bash python git java javac mvn tar; do | ||
| 49 | + testTool $tool; | ||
| 50 | + done | ||
| 51 | + testGerritTool | ||
| 52 | + testGpgTool | ||
| 53 | + testJavaVersion | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +# Tests that the specified artifact dependency is not a snapshot version | ||
| 57 | +function testArtifactDependency { | ||
| 58 | + trap "echo 'FAILED'" ERR | ||
| 59 | + printf "Checking $1 dependency... " | ||
| 60 | + grep "<$1.version>.*</$1.version>" $ONOS_ROOT/pom.xml | grep -q SNAPSHOT && false | ||
| 61 | + echo "OK" | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +# Tests that the ONOS-base is not a snapshot version | ||
| 65 | +function testOnosBase { | ||
| 66 | + trap "echo 'FAILED'" ERR | ||
| 67 | + printf "Checking onos-base dependency... " | ||
| 68 | + grep -A1 "onos-base" $ONOS_ROOT/pom.xml | grep -q SNAPSHOT && false | ||
| 69 | + echo "OK" | ||
| 70 | +} | ||
| 71 | + | ||
| 72 | +# Tests that the root pom does not contain any snapshot dependencies | ||
| 73 | +# on anxillary artifacts, e.g. openflowj, copycat | ||
| 74 | +function testSnapshotDependencies { | ||
| 75 | + testOnosBase | ||
| 76 | + for artifact in onos-build-conf onos-maven-plugin openflowj atomix copycat; do | ||
| 77 | + testArtifactDependency $artifact | ||
| 78 | + done | ||
| 79 | +} | ||
| 80 | + | ||
| 13 | # Test access to Gerrit (Administrator) | 81 | # Test access to Gerrit (Administrator) |
| 14 | function testGerritAccess { | 82 | function testGerritAccess { |
| 15 | trap "echo 'FAILED'" ERR | 83 | trap "echo 'FAILED'" ERR |
| 16 | printf "Checking Gerrit ONOS Release group access... " | 84 | printf "Checking Gerrit ONOS Release group access... " |
| 17 | ssh -p 29418 gerrit.onosproject.org gerrit ls-members "ONOS\ Release"\ | 85 | ssh -p 29418 gerrit.onosproject.org gerrit ls-members "ONOS\ Release"\ |
| 18 | --recursive | grep -q $GERRIT_USER | 86 | --recursive | grep -q $GERRIT_USER |
| 19 | - | ||
| 20 | echo "OK" | 87 | echo "OK" |
| 21 | } | 88 | } |
| 22 | 89 | ||
| ... | @@ -54,6 +121,8 @@ function testSonatypeAccess { | ... | @@ -54,6 +121,8 @@ function testSonatypeAccess { |
| 54 | echo "OK" | 121 | echo "OK" |
| 55 | } | 122 | } |
| 56 | 123 | ||
| 124 | +testToolchain | ||
| 125 | +testSnapshotDependencies | ||
| 57 | testGerritAccess | 126 | testGerritAccess |
| 58 | testWikiAccess | 127 | testWikiAccess |
| 59 | testEC2Access | 128 | testEC2Access | ... | ... |
-
Please register or login to post a comment