Pull correct docker images. 11/89611/5
authorBilal A <bilal@research.att.com>
Fri, 7 Jun 2019 21:25:59 +0000 (21:25 +0000)
committerBilal A <bilal@research.att.com>
Mon, 10 Jun 2019 21:51:47 +0000 (21:51 +0000)
Enables Policy CSITs for API, PAP, Distribution and XACML-PDP
to pull correct docker images based on the code branch.

Issue-ID: POLICY-1834
Signed-off-by: Bilal A <bilal@research.att.com>
Change-Id: I6b99c8ae9cb78dd8ebddc522bc2a7080ec6e5735

plans/policy/api/setup.sh
plans/policy/distribution/setup.sh
plans/policy/pap/setup.sh
plans/policy/xacml-pdp/setup.sh
scripts/policy/config/policy-csit.conf [new file with mode: 0644]
scripts/policy/docker-compose-api.yml
scripts/policy/docker-compose-pap.yml
scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml

index 6168085..6f6cc29 100644 (file)
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
 
+# Select branch 
+GERRIT_BRANCH=$(cat ${SCRIPTS}/policy/config/policy-csit.conf | cut -d "=" -f2)
+echo $GERRIT_BRANCH
+
 echo "Uninstall docker-py and reinstall docker."
 pip uninstall -y docker-py
 pip uninstall -y docker
 pip install -U docker==2.7.0
 
+
+sudo apt-get -y install libxml2-utils
+export POLICY_API_VERSION="$(curl --silent https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
+echo $POLICY_API_VERSION
 # Adding this waiting container to avoid race condition between api and mariadb containers.
 docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-api.yml run --rm start_dependencies
 
index 40a15d1..63d8508 100644 (file)
 #
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
+# Select branch 
+GERRIT_BRANCH=$(cat ${SCRIPTS}/policy/config/policy-csit.conf | cut -d "=" -f2)
+echo $GERRIT_BRANCH
 
-docker run -d --name policy-distribution -p 6969:6969 -it nexus3.onap.org:10001/onap/policy-distribution:2.1.0-SNAPSHOT-latest
+sudo apt-get -y install libxml2-utils
+export POLICY_DISTRIBUTION_VERSION="$(curl --silent https://git.onap.org/policy/distribution/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
+echo $POLICY_DISTRIBUTION_VERSION
+docker run -d --name policy-distribution -p 6969:6969 -it nexus3.onap.org:10001/onap/policy-distribution:$POLICY_DISTRIBUTION_VERSION
 
 POLICY_DISTRIBUTION_IP=`get-instance-ip.sh policy-distribution`
 echo DISTRIBUTION IP IS ${POLICY_DISTRIBUTION_IP}
index 8bd3f0a..5dac27d 100644 (file)
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
 
+GERRIT_BRANCH=$(cat ${SCRIPTS}/policy/config/policy-csit.conf | cut -d "=" -f2)
+echo $GERRIT_BRANCH
+
 echo "Uninstall docker-py and reinstall docker."
 pip uninstall -y docker-py
 pip uninstall -y docker
 pip install -U docker==2.7.0
 
+
+sudo apt-get -y install libxml2-utils
+export POLICY_API_VERSION="$(curl --silent https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
+export POLICY_PAP_VERSION="$(curl --silent https://git.onap.org/policy/pap/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
+echo $POLICY_API_VERSION
+echo $POLICY_PAP_VERSION
 # Adding this waiting container due to race condition between pap and mariadb
 docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-pap.yml run --rm start_dependencies
 
index 5036586..a5b6be4 100644 (file)
@@ -17,6 +17,9 @@
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
 
+GERRIT_BRANCH=$(cat ${SCRIPTS}/policy/config/policy-csit.conf | cut -d "=" -f2)
+echo $GERRIT_BRANCH
+
 echo "Uninstall docker-py and reinstall docker."
 pip uninstall -y docker-py
 pip uninstall -y docker
@@ -50,7 +53,7 @@ ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v
 cd ..
 
 git clone http://gerrit.onap.org/r/oparent
-git clone --depth 1 https://gerrit.onap.org/r/policy/models -b dublin
+git clone --depth 1 https://gerrit.onap.org/r/policy/models -b $GERRIT_BRANCH
 cd models/models-sim/models-sim-dmaap
 ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn clean install -DskipTests  --settings ${WORK_DIR}/oparent/settings.xml
 bash ./src/main/package/docker/docker_build.sh
@@ -58,6 +61,16 @@ cd ${WORKSPACE}
 rm -rf ${WORK_DIR}
 sleep 3
 
+
+
+sudo apt-get -y install libxml2-utils
+export POLICY_API_VERSION="$(curl --silent https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
+export POLICY_PAP_VERSION="$(curl --silent https://git.onap.org/policy/pap/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
+export POLICY_XACML_PDP_VERSION="$(curl --silent https://git.onap.org/policy/xacml-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
+
+echo $POLICY_API_VERSION
+echo $POLICY_PAP_VERSION
+echo $POLICY_XACML_PDP_VERSION
 # Adding this waiting container due to race condition between pap and mariadb
 docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_dependencies
 
diff --git a/scripts/policy/config/policy-csit.conf b/scripts/policy/config/policy-csit.conf
new file mode 100644 (file)
index 0000000..1b6657a
--- /dev/null
@@ -0,0 +1 @@
+GERRIT_BRANCH=dublin
index 5cf5a27..bb1ca34 100644 (file)
@@ -27,7 +27,7 @@ services:
       ports:
        - "3306:3306"
    api:
-      image: nexus3.onap.org:10001/onap/policy-api
+      image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION}
       container_name: policy-api
       depends_on: 
        - mariadb
index 383e1bc..466d9ba 100644 (file)
@@ -27,7 +27,7 @@ services:
       ports:
        - "3306:3306"
    pap:
-      image: nexus3.onap.org:10001/onap/policy-pap
+      image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION}
       container_name: policy-pap
       depends_on: 
        - mariadb
@@ -35,7 +35,7 @@ services:
       ports:
        - "6969:6969"
    api:
-      image: nexus3.onap.org:10001/onap/policy-api
+      image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION}
       container_name: policy-api
       depends_on:
        - mariadb
index 96a4b12..8c1b063 100644 (file)
@@ -37,20 +37,20 @@ services:
       ports:
        - "3904:3904"
    pap:
-      image: nexus3.onap.org:10001/onap/policy-pap
+      image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION}
       container_name: policy-pap
       depends_on:
        - mariadb
        - message-router
       hostname: policy-pap
    api:
-      image: nexus3.onap.org:10001/onap/policy-api
+      image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION}
       container_name: policy-api
       depends_on:
        - mariadb
       hostname: policy-api
    xacml-pdp:
-      image: nexus3.onap.org:10001/onap/policy-xacml-pdp
+      image: nexus3.onap.org:10001/onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION}
       container_name: policy-xacml-pdp
       depends_on:
        - mariadb