rameshiyer27 | bdced49 | 2023-06-28 12:15:14 +0100 | [diff] [blame] | 1 | #! /bin/bash -x |
| 2 | |
| 3 | # ============LICENSE_START==================================================== |
| 4 | # Copyright (C) 2023 Nordix Foundation. All rights reserved. |
| 5 | |
| 6 | # ============================================================================= |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | # |
| 19 | # SPDX-License-Identifier: Apache-2.0 |
| 20 | # ============LICENSE_END====================================================== |
| 21 | |
| 22 | # This script gets executed in Nordix infra for consuming locally generated docker images for k8s tests. |
| 23 | |
| 24 | if [ -z "${WORKSPACE}" ]; then |
| 25 | WORKSPACE=$(git rev-parse --show-toplevel) |
| 26 | export WORKSPACE |
| 27 | fi |
| 28 | |
| 29 | |
| 30 | |
| 31 | echo "Setting project configuration for: $PROJECT" |
| 32 | case $PROJECT in |
| 33 | |
| 34 | clamp | policy-clamp) |
| 35 | echo "CLAMP" |
| 36 | env |
| 37 | if [ "$(docker images nexus3.onap.org:10001/onap/policy-clamp-runtime-acm:$POLICY_CLAMP_VERSION | grep -v REPOSITORY | wc -l)" == 1 ]; then |
| 38 | docker save nexus3.onap.org:10001/onap/policy-clamp-runtime-acm:$POLICY_CLAMP_VERSION -o ./runtime_image.tar |
| 39 | microk8s images import ./runtime_image.tar |
| 40 | fi |
| 41 | if [ "$(docker images nexus3.onap.org:10001/onap/policy-clamp-ac-http-ppnt:$POLICY_CLAMP_VERSION | grep -v REPOSITORY | wc -l)" == 1 ]; then |
| 42 | docker save nexus3.onap.org:10001/onap/policy-clamp-ac-http-ppnt:$POLICY_CLAMP_VERSION -o ./http_ppnt_image.tar |
| 43 | microk8s images import ./http_ppnt_image.tar |
| 44 | fi |
| 45 | if [ "$(docker images nexus3.onap.org:10001/onap/policy-clamp-ac-k8s-ppnt:$POLICY_CLAMP_VERSION | grep -v REPOSITORY | wc -l)" == 1 ]; then |
| 46 | docker save nexus3.onap.org:10001/onap/policy-clamp-ac-k8s-ppnt:$POLICY_CLAMP_VERSION -o ./k8s_ppnt_image.tar |
| 47 | microk8s images import ./k8s_ppnt_image.tar |
| 48 | fi |
| 49 | if [ "$(docker images nexus3.onap.org:10001/onap/policy-clamp-ac-pf-ppnt:$POLICY_CLAMP_VERSION | grep -v REPOSITORY | wc -l)" == 1 ]; then |
| 50 | docker save nexus3.onap.org:10001/onap/policy-clamp-ac-pf-ppnt:$POLICY_CLAMP_VERSION -o ./pf_ppnt_image.tar |
| 51 | microk8s images import ./pf_ppnt_image.tar |
| 52 | fi |
| 53 | ;; |
| 54 | |
| 55 | api | policy-api) |
| 56 | echo "API" |
| 57 | env |
| 58 | if [ "$(docker images nexus3.onap.org:10001/onap/policy-api:$POLICY_API_VERSION | grep -v REPOSITORY | wc -l)" == 1 ]; then |
| 59 | docker save nexus3.onap.org:10001/onap/policy-api:$POLICY_API_VERSION -o ./image.tar |
| 60 | microk8s images import ./image.tar |
| 61 | fi |
| 62 | ;; |
| 63 | |
| 64 | pap | policy-pap) |
| 65 | echo "PAP" |
| 66 | env |
| 67 | if [ "$(docker images nexus3.onap.org:10001/onap/policy-pap:$POLICY_PAP_VERSION | grep -v REPOSITORY | wc -l)" == 1 ]; then |
| 68 | docker save nexus3.onap.org:10001/onap/policy-pap:$POLICY_PAP_VERSION -o ./image.tar |
| 69 | microk8s images import ./image.tar |
| 70 | fi |
| 71 | ;; |
| 72 | |
| 73 | apex-pdp | policy-apex-pdp) |
| 74 | echo "APEX" |
| 75 | env |
| 76 | if [ "$(docker images nexus3.onap.org:10001/onap/policy-apex-pdp:$POLICY_APEX_PDP_VERSION | grep -v REPOSITORY | wc -l)" == 1 ]; then |
| 77 | docker save nexus3.onap.org:10001/onap/policy-apex-pdp:$POLICY_APEX_PDP_VERSION -o ./image.tar |
| 78 | microk8s images import ./image.tar |
| 79 | fi |
| 80 | ;; |
| 81 | |
| 82 | xacml-pdp | policy-xacml-pdp) |
| 83 | echo "XACML" |
| 84 | env |
| 85 | if [ "$(docker images nexus3.onap.org:10001/onap/policy-xacml-pdp:$POLICY_XACML_PDP_VERSION | grep -v REPOSITORY | wc -l)" == 1 ]; then |
| 86 | docker save nexus3.onap.org:10001/onap/policy-xacml-pdp:$POLICY_XACML_PDP_VERSION -o ./image.tar |
| 87 | microk8s images import ./image.tar |
| 88 | fi |
| 89 | ;; |
| 90 | |
| 91 | drools-pdp | policy-drools-pdp) |
| 92 | echo "DROOLS" |
| 93 | env |
| 94 | if [ "$(docker images nexus3.onap.org:10001/onap/policy-pdpd-cl:$POLICY_DROOLS_PDP_VERSION | grep -v REPOSITORY | wc -l)" == 1 ]; then |
| 95 | docker save nexus3.onap.org:10001/onap/policy-pdpd-cl:$POLICY_DROOLS_PDP_VERSION -o ./image.tar |
| 96 | microk8s images import ./image.tar |
| 97 | fi |
| 98 | ;; |
| 99 | |
| 100 | distribution | policy-distribution) |
| 101 | echo "DISTRIBUTION" |
| 102 | env |
| 103 | if [ "$(docker images nexus3.onap.org:10001/onap/policy-distribution:$POLICY_DISTRIBUTION_VERSION | grep -v REPOSITORY | wc -l)" == 1 ]; then |
| 104 | docker save nexus3.onap.org:10001/onap/policy-distribution:$POLICY_DISTRIBUTION_VERSION -o ./image.tar |
| 105 | microk8s images import ./image.tar |
| 106 | fi |
| 107 | ;; |
| 108 | |
| 109 | *) |
| 110 | echo "UNKNOWN" |
| 111 | ;; |
| 112 | esac |