Use github in lieu of gerrit mirror

The gerrit mirror is not always accessible behind corporate firewalls,
thus changed the CSITs to use github instead.
Also modified the script to only clone ci-management to /tmp if it
does not already exist.

Issue-ID: POLICY-3179
Change-Id: I9cac98b04e000d9365e05a1f2ca1c328fef14c6c
Signed-off-by: Jim Hahn <jrh3@att.com>
diff --git a/csit/detmVers.sh b/csit/detmVers.sh
index 1906292..56e516c 100644
--- a/csit/detmVers.sh
+++ b/csit/detmVers.sh
@@ -20,58 +20,43 @@
 
 echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER}
 
-POLICY_MODELS_VERSION=$(
-    curl -q --silent \
-      https://git.onap.org/policy/models/plain/pom.xml?h=${GERRIT_BRANCH} |
-    xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)
+function getVersion
+{
+    REPO=$1
+    curl -qL --silent \
+      https://github.com/onap/policy-$REPO/raw/${GERRIT_BRANCH}/pom.xml |
+    xmllint --xpath \
+      '/*[local-name()="project"]/*[local-name()="version"]/text()' -
+}
+
+POLICY_MODELS_VERSION=$(getVersion models)
 export POLICY_MODELS_VERSION=${POLICY_MODELS_VERSION:0:3}-SNAPSHOT-latest
 echo POLICY_MODELS_VERSION=${POLICY_MODELS_VERSION}
 
-POLICY_API_VERSION=$(
-    curl -q --silent \
-      https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} |
-    xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)
+POLICY_API_VERSION=$(getVersion api)
 export POLICY_API_VERSION=${POLICY_API_VERSION:0:3}-SNAPSHOT-latest
 echo POLICY_API_VERSION=${POLICY_API_VERSION}
 
-POLICY_PAP_VERSION=$(
-    curl -q --silent \
-      https://git.onap.org/policy/pap/plain/pom.xml?h=${GERRIT_BRANCH} |
-    xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)
+POLICY_PAP_VERSION=$(getVersion pap)
 export POLICY_PAP_VERSION=${POLICY_PAP_VERSION:0:3}-SNAPSHOT-latest
 echo POLICY_PAP_VERSION=${POLICY_PAP_VERSION}
 
-POLICY_XACML_PDP_VERSION=$(
-    curl -q --silent \
-      https://git.onap.org/policy/xacml-pdp/plain/pom.xml?h=${GERRIT_BRANCH} |
-    xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)
+POLICY_XACML_PDP_VERSION=$(getVersion xacml-pdp)
 export POLICY_XACML_PDP_VERSION=${POLICY_XACML_PDP_VERSION:0:3}-SNAPSHOT-latest
 echo POLICY_XACML_PDP_VERSION=${POLICY_XACML_PDP_VERSION}
 
-POLICY_DROOLS_VERSION=$(
-    curl -q --silent \
-      https://git.onap.org/policy/drools-pdp/plain/pom.xml?h=${GERRIT_BRANCH} |
-    xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)
+POLICY_DROOLS_VERSION=$(getVersion drools-pdp)
 export POLICY_DROOLS_VERSION=${POLICY_DROOLS_VERSION:0:3}-SNAPSHOT-latest
 echo POLICY_DROOLS_VERSION=${POLICY_DROOLS_VERSION}
 
-POLICY_DROOLS_APPS_VERSION=$(
-    curl -q --silent \
-      https://git.onap.org/policy/drools-applications/plain/pom.xml?h=${GERRIT_BRANCH} |
-    xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)
+POLICY_DROOLS_APPS_VERSION=$(getVersion drools-applications)
 export POLICY_DROOLS_APPS_VERSION=${POLICY_DROOLS_APPS_VERSION:0:3}-SNAPSHOT-latest
 echo POLICY_DROOLS_APPS_VERSION=${POLICY_DROOLS_APPS_VERSION}
 
-POLICY_APEX_PDP_VERSION=$(
-    curl -q --silent \
-      https://git.onap.org/policy/apex-pdp/plain/pom.xml?h=${GERRIT_BRANCH} |
-    xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)
+POLICY_APEX_PDP_VERSION=$(getVersion apex-pdp)
 export POLICY_APEX_PDP_VERSION=${POLICY_APEX_PDP_VERSION:0:3}-SNAPSHOT-latest
 echo POLICY_APEX_PDP_VERSION=${POLICY_APEX_PDP_VERSION}
 
-POLICY_DISTRIBUTION_VERSION=$(
-    curl -q --silent \
-      https://git.onap.org/policy/distribution/plain/pom.xml?h=${GERRIT_BRANCH} |
-    xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)
+POLICY_DISTRIBUTION_VERSION=$(getVersion distribution)
 export POLICY_DISTRIBUTION_VERSION=${POLICY_DISTRIBUTION_VERSION:0:3}-SNAPSHOT-latest
 echo POLICY_DISTRIBUTION_VERSION=${POLICY_DISTRIBUTION_VERSION}
diff --git a/csit/get-models-examples.sh b/csit/get-models-examples.sh
index 75b6528..e83b024 100644
--- a/csit/get-models-examples.sh
+++ b/csit/get-models-examples.sh
@@ -24,4 +24,4 @@
 cd ${WORKSPACE}
 
 # download models examples
-git clone -b ${GERRIT_BRANCH} --single-branch git://gerrit-mirror-ap.onap.org/mirror/policy/models.git
+git clone -b ${GERRIT_BRANCH} --single-branch https://github.com/onap/policy-models.git models
diff --git a/csit/prepare-csit.sh b/csit/prepare-csit.sh
index 4275841..b15aa4e 100755
--- a/csit/prepare-csit.sh
+++ b/csit/prepare-csit.sh
@@ -33,11 +33,11 @@
 fi
 if [ -f ${ROBOT_VENV}/bin/activate ]; then
     source ${ROBOT_VENV}/bin/activate
-else
+elif [ ! -d /tmp/ci-management ]; then
     rm -rf /tmp/ci-management
     rm -f ${WORKSPACE}/env.properties
     cd /tmp
-    git clone -b master --single-branch git://gerrit-mirror-ap.onap.org/mirror/ci-management.git
+    git clone -b master --single-branch https://github.com/onap/ci-management.git
     source /tmp/ci-management/jjb/integration/include-raw-integration-install-robotframework.sh
 fi
 
diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh
index c3d67d9..07b9dea 100755
--- a/csit/run-project-csit.sh
+++ b/csit/run-project-csit.sh
@@ -150,7 +150,7 @@
 cd ${WORKSPACE}
 
 # get the plan from git clone
-if ! `git clone -b ${GERRIT_BRANCH} --single-branch git://gerrit-mirror-ap.onap.org/mirror/policy/${PROJECT}.git` ; then
+if ! `git clone -b ${GERRIT_BRANCH} --single-branch https://github.com/onap/policy-${PROJECT}.git ${PROJECT}` ; then
     echo "repo not found: policy/${PROJECT}"
     exit 1
 fi