start-local-mozreview
author Gregory Szorc <gps@mozilla.com>
Mon, 23 Jan 2017 17:22:54 -0800
changeset 691174 1550fe5c904f8c8960a32c74f59a438909f290b8
parent 690702 200d9e8e90a48078bf9374e926dbd8cee590005f
permissions -rwxr-xr-x
global: update vendored pyflakes from 0.7.3 to 1.5.0 MozReview-Commit-ID: HwxUUi0rL9W

#!/bin/bash
# This script starts the mozreview servers, creates a default user, some bugs
# and a properly configured mercurial repository for pushing reviews.

set -eo pipefail

if [ -n "$MOZREVIEW_BUILD_FORKS" ]; then
    # include --forks switch to build scripts
    FORKS="--forks=$MOZREVIEW_BUILD_FORKS"
else
    FORKS=''
fi

TEST_MOZREVIEW_NAME=mozreview-test
TEST_REPO_NAME=local-mozreview-test-repo

VCT_PATH=`pwd`
cd ..
PARENT_PATH=`pwd`
cd $VCT_PATH

REPO_PATH=$PARENT_PATH/$TEST_REPO_NAME
TEST_MOZREVIEW_PATH=$PARENT_PATH/$TEST_MOZREVIEW_NAME

MOZREVIEW_HOME=$TEST_MOZREVIEW_PATH
. venv/bin/activate

./mozreview stop $TEST_MOZREVIEW_PATH

./mozreview start --reviewboard-port=55556 $FORKS $TEST_MOZREVIEW_PATH

$(./mozreview shellinit)

./mozreview create-repo test-repo

./mozreview create-user default@example.com password 'Default User :default' \
    --uid 2000 --scm-level 1 --bugzilla-group editbugs
./reviewboard associate-ldap-user default default@example.com

./mozreview create-user level1@example.com password 'Level 1 User :level1' \
    --uid 2001 --scm-level 1 --bugzilla-group editbugs
./reviewboard associate-ldap-user level1 level1@example.com

./mozreview create-user level2@example.com password 'Level 2 User :level2' \
    --uid 2002 --scm-level 2 --bugzilla-group editbugs
./reviewboard associate-ldap-user level2 level2@example.com

./mozreview create-user level3@example.com password 'Level 3 User :level3' \
    --uid 2003 --scm-level 3 --bugzilla-group editbugs
./reviewboard associate-ldap-user level3 level3@example.com

rm -rf $REPO_PATH
./mozreview clone test-repo $REPO_PATH --user default@example.com

API_KEY=$(./mozreview create-api-key default@example.com)
echo "
[bugzilla]
username = default@example.com
apikey = $API_KEY
" >> $REPO_PATH/.hg/hgrc

BUGZILLA_USERNAME=admin@example.com BUGZILLA_PASSWORD=password ./bugzilla create-bug-range firefox general 11

echo "Development environment created."
echo "Run the following command to initialise your environment:"
echo "eval \$(./mozreview shellinit)"