diff options
author | James Gu <james.gu@att.com> | 2020-02-17 11:58:04 -0800 |
---|---|---|
committer | James Gu <james.gu@att.com> | 2020-05-12 12:04:14 -0700 |
commit | 28402259e4425ad546d73575c3e8b14ae52b327d (patch) | |
tree | 29ba25e29075c9684350a88baa10554c72e49d06 | |
parent | 12230e534d4c2f74f2aa002ccb7b3d741a3f8d2e (diff) |
Added support to deploy from local airship and treasuremap repo
Added the ability to deploy Airship from local airship and
treasuremap folder, instead of pulling from remote repo. The use
case is primarily for developers to test locally.
Signed-off-by: James Gu <james.gu@att.com>
Change-Id: I42b91b0c68ab2033016711e9c4d05289dbe6c002
Signed-off-by: James Gu <james.gu@att.com>
-rwxr-xr-x | tools/deploy.sh | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/tools/deploy.sh b/tools/deploy.sh index 3d636fb..a166aa0 100755 --- a/tools/deploy.sh +++ b/tools/deploy.sh @@ -26,10 +26,14 @@ fi source $(dirname "$(realpath $0)")/../site/$1/$1.env -TMP_DIR=$(mktemp -d) -cd $TMP_DIR +if [ -z "$AS_HOME" ]; then + WORK_DIR=$(mktemp -d) + trap "{ sudo rm -rf $WORK_DIR; }" EXIT +else + WORK_DIR=$AS_HOME +fi -trap "{ sudo rm -rf $TMP_DIR; }" EXIT +cd ${WORK_DIR} ## Deps @@ -96,23 +100,29 @@ git_checkout() { fi git log -1 - cd $TMP_DIR + cd $WORK_DIR } clone_repos() { + if [ -d "airship" ]; then + echo "Found existing airship folder. Skip repo clone." + else + # clone/checkout site manifests + git_checkout 'https://gerrit.opnfv.org/gerrit/airship' $GERRIT_REFSPEC + fi - # clone/checkout site manifests - git_checkout 'https://gerrit.opnfv.org/gerrit/airship' $GERRIT_REFSPEC - - # clone treasuremap (only required for tools/airship) - # match treasuremap to global from site-definition - SITE_DEF_KEY="['data']['repositories']['global']['revision']" - TREASUREMAP_REF=$(read_yaml $SITE_DEF "$SITE_DEF_KEY") - - git_checkout 'https://review.opendev.org/airship/treasuremap' $TREASUREMAP_REF + if [ -d "treasuremap" ]; then + echo "Found existing treasuremap folder in the working directory. Skip repo clone." + else + # clone treasuremap (only required for tools/airship) + # match treasuremap to global from site-definition + SITE_DEF_KEY="['data']['repositories']['global']['revision']" + TREASUREMAP_REF=$(read_yaml $SITE_DEF "$SITE_DEF_KEY") + echo "TREASUREMAP_REF $TREASUREMAP_REF" + git_checkout 'https://review.opendev.org/airship/treasuremap' $TREASUREMAP_REF + fi } - ## Deployment pegleg_collect() { |