Brian O'Connor

Updating onos-edit-config to unblock push for release

Some minor fixes for onos-release-prerequisites

Change-Id: I3c0003fef9de6cf26ce33ca4930db3c4b6000ce5
...@@ -8,7 +8,7 @@ set -e ...@@ -8,7 +8,7 @@ set -e
8 GERRIT_USER=${GERRIT_USER:-$USER} 8 GERRIT_USER=${GERRIT_USER:-$USER}
9 GERRIT_PROJECT=${GERRIT_PROJECT:-onos} 9 GERRIT_PROJECT=${GERRIT_PROJECT:-onos}
10 10
11 -function setup() { 11 +function setup {
12 DIR=$(mktemp -d /tmp/$GERRIT_PROJECT-config.XXXXX) || { echo "Failed to create temp file"; exit 1; } 12 DIR=$(mktemp -d /tmp/$GERRIT_PROJECT-config.XXXXX) || { echo "Failed to create temp file"; exit 1; }
13 cd $DIR 13 cd $DIR
14 git init 14 git init
...@@ -17,22 +17,30 @@ function setup() { ...@@ -17,22 +17,30 @@ function setup() {
17 git checkout meta/config 17 git checkout meta/config
18 } 18 }
19 19
20 -function cleanup() { 20 +function cleanup {
21 # clean up the directory 21 # clean up the directory
22 - rm -rf $OUT 22 + rm -rf $DIR
23 +}
24 +
25 +function testReleaseMembership {
26 + trap "echo 'ERROR: Not a member of the ONOS Release group'; cleanup" ERR
27 + ssh -p 29418 gerrit.onosproject.org gerrit ls-members "ONOS\ Release" | grep -q $GERRIT_USER
23 } 28 }
24 29
25 setup 30 setup
26 case $1 in 31 case $1 in
27 block) 32 block)
33 + testReleaseMembership
28 sed -i '' "s/submit = group/submit = block group/g" project.config 34 sed -i '' "s/submit = group/submit = block group/g" project.config
35 + sed -i '' "s/push = block group ONOS Release/push = group ONOS Release/g" project.config
29 git diff 36 git diff
30 git commit -am"Blocking submit for all users in project" 37 git commit -am"Blocking submit for all users in project"
31 git push origin HEAD:refs/meta/config 38 git push origin HEAD:refs/meta/config
32 ;; 39 ;;
33 unblock) 40 unblock)
34 - echo unblock 41 + testReleaseMembership
35 sed -i '' "s/submit = block group/submit = group/g" project.config 42 sed -i '' "s/submit = block group/submit = group/g" project.config
43 + sed -i '' "s/push = group ONOS Release/push = block group ONOS Release/g" project.config
36 git diff 44 git diff
37 git commit -am"Unblocking submit for all users in project" 45 git commit -am"Unblocking submit for all users in project"
38 git push origin HEAD:refs/meta/config 46 git push origin HEAD:refs/meta/config
......
...@@ -6,15 +6,17 @@ ...@@ -6,15 +6,17 @@
6 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 6 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 7
8 GERRIT_USER=${GERRIT_USER:-$USER} 8 GERRIT_USER=${GERRIT_USER:-$USER}
9 +WIKI_USER=${WIKI_USER:-$USER}
9 10
10 set -e 11 set -e
11 12
12 # Test access to Gerrit (Administrator) 13 # Test access to Gerrit (Administrator)
13 function testGerritAccess { 14 function testGerritAccess {
14 trap "echo 'FAILED'" ERR 15 trap "echo 'FAILED'" ERR
15 - printf "Checking Gerrit Administrator access... " 16 + printf "Checking Gerrit ONOS Release group access... "
16 - ssh -p 29418 gerrit.onosproject.org gerrit ls-members Administrators \ 17 + ssh -p 29418 gerrit.onosproject.org gerrit ls-members "ONOS\ Release"\
17 - --recursive | grep -q $GERRIT_USER 18 + --recursive | grep -q $GERRIT_USER
19 +
18 echo "OK" 20 echo "OK"
19 } 21 }
20 22
...@@ -22,7 +24,7 @@ function testGerritAccess { ...@@ -22,7 +24,7 @@ function testGerritAccess {
22 function testWikiAccess { 24 function testWikiAccess {
23 trap "echo 'FAILED'" ERR 25 trap "echo 'FAILED'" ERR
24 printf "Checking Wiki access... " 26 printf "Checking Wiki access... "
25 - ssh $USER@api.onosproject.org "test -w /var/www/api/index.html" 27 + ssh $WIKI_USER@wiki.onosproject.org "test -w /var/www/api/index.html"
26 echo "OK" 28 echo "OK"
27 } 29 }
28 30
......