Support for kafka within xacml tutorial
[policy/xacml-pdp.git] / tutorials / tutorial-xacml-application / src / main / docker / run-tutorial.sh
1 #! /bin/bash
2
3 # ============LICENSE_START====================================================
4 #  Copyright 2022, 2024 Nordix Foundation.
5 # =============================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END======================================================
20
21 if [ -z "$CONTAINER_LOCATION" ]
22 then
23     export CONTAINER_LOCATION="nexus3.onap.org:10001/"
24 fi
25
26 echo "Looking up the XACML tutorial version . . ."
27
28 POLICY_XACML_TUTORIAL_VERSION=$(
29     docker images --filter "reference=onap/policy-xacml-tutorial" |
30     grep -v "REPOSITORY" |
31     sort    |
32     head -1 |
33     awk '{print $2}'
34 )
35
36 if [ -z "$POLICY_XACML_TUTORIAL_VERSION" ]
37 then
38     echo "Look up of the XACML tutorial version failed, have you built the tutorial docker image?"
39     exit 1
40 else
41     export POLICY_XACML_TUTORIAL_VERSION
42     echo "Look up of the XACML tutorial version completed, version is ${POLICY_XACML_TUTORIAL_VERSION}"
43 fi
44
45 echo "Looking up latest versions of Policy Framework images . . ."
46 GETVERS_SCRIPT=$(mktemp)
47 curl -qL --silent "https://raw.githubusercontent.com/onap/policy-docker/master/compose/get-versions.sh" > "$GETVERS_SCRIPT"
48 export GERRIT_BRANCH="master"
49 chmod +x "$GETVERS_SCRIPT"
50 source "$GETVERS_SCRIPT"
51 echo "Look up of latest versions of Policy Framework images completed"
52
53
54 echo "Running tutorial . . ."
55 docker-compose -f docker-compose.yml up
56 echo "Tutorial run completed"
57
58 echo "Cleaning up . . ."
59 rm "$GETVERS_SCRIPT"
60 echo "Cleanup completed"