aboutsummaryrefslogtreecommitdiffstats
path: root/docs/bak/installation.rst
blob: cde26e021a83e2f8823a34418ef3a61766d708a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
.. _onap_so_schema_version_2_0:
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. Copyright 2018 Huawei Technologies Co., Ltd.

Install and Configure Service Orchestrator
==========================================

Get Ubuntu
----------
Get the Ubuntu ISO image from ubuntu.com. The recommended version is 16.04.3 LTS (Long Term Support), desktop edition.

Get VirtualBox and VirtualBox Guest Additions
---------------------------------------------
Make sure you have the VirtualBox Guest Additions ISO for your version of
VirtualBox.  I'm using VirtualBox 5.1.28.  Save the Guest Additions ISO on your
host computer along with the Ubuntu ISO.  Get the Guest Additions ISO from
here: http://download.virtualbox.org/virtualbox

*NOTE*: Guest Additions versions prior to 5.1 will not work with Ubuntu 16.04.3.  If you have an earlier version of VirtualBox, you should upgrade to the latest 5.1 version.

Create a new VM in VirtualBox for Ubuntu
----------------------------------------
Type: Linux
Version: Ubuntu (64-bit)
At least 2048 MB memory
At least 40 GB VDI
Network: Attached to: NAT

Create a port-forwarding rule for SSH
-------------------------------------
Create a port-forwarding rule so that you can use PuTTY (or other SSH client) to connect to the VM.
Go to "Network" settings in VirtualBox, add a port forwarding rule:
Name: SSH
Protocol: TCP
Host IP: 127.0.0.1
Host Port: 1022
Guest IP: <leave blank>
Guest Port: 22

Create Shared Folder
--------------------
This is oriented to Windows users.  If you're using a MAC or a Linux host computer, the details may be different.  You can share any folder on the host computer with the Ubuntu VM.  On Windows, a practical choice is to share the C:\Users folder, so that your Windows home directory will be accessible from the Ubuntu VM.
Go to "Shared Folders" settings in VirtualBox, add a share:
Folder Path: C:\Users
Folder Name: Users
Auto-mount: <checked>
Read-only: <unchecked>

Install Ubuntu in the VM
------------------------
On the "Storage" panel in VirtualBox, click on "[ optical drive ]" and then "Choose Disk Image".  Select your Ubuntu ISO image.

After selecting the ISO image, start the VM.
Follow the prompts to install Ubuntu.

Proxy Configuration (optional)
------------------------------
If you're behind a corporate firewall, configure some proxy settings.  NOTE: your proxy configuration may require username and password credentials, not shown here.
**Ubuntu system proxy setting**:

- System Settings → Network → Network proxy
  (Replace "proxyhost" and port with your actual proxy information)

**apt proxy setting**:

- Edit /etc/apt/apt.conf and add one line at the top (replace "proxyhost:port" with your actual proxy information):
  Acquire::http::Proxy "http://proxyhost:port";
- Reboot the VM.

Install SSH Server
------------------
sudo apt update
sudo apt install openssh-server

Connect to the VM from your host computer
-----------------------------------------
The PuTTY SSH client is popular.  A connection to localhost:1022 (or whatever port you have forwarded) will go to the VM.

Install VirtualBox Guest Additions
----------------------------------
On the "Storage" panel in VirtualBox, click on "[ optical drive ]" and then "Choose Disk Image".  Select your VirtualBox Guest Additions ISO image.

In a VM terminal window, mount the cdrom::

  sudo mkdir -p /media/cdrom
  sudo mount /dev/cdrom /media/cdrom

Install necessary dependencies::

  sudo apt update
  sudo apt install gcc g++ dkms

Install the guest additions.  NOTE: look for errors in the command output!
If you see an error that says you are missing kernel headers, the most likely
cause is that you are using a VirtualBox version that is too old.
The error message is misleading.::

  cd /media/cdrom
  sudo ./VBoxLinuxAdditions.run

Add yourself to the vboxsf user group (replace "userid" with your user ID)::

  sudo usermod -a -G vboxsf userid

Reboot the VM.
In a VM terminal window, verify that you can access your home directory on the
host computer, which should be mounted under /media/sf_Users

Further Reading
----------------------------------------
https://wiki.onap.org/display/DW/Development+Environment
er.Float */ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ .highlight .sa { color: #e6db74 } /* Literal.String.Affix */ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ .highlight .sc { color: #e6db74 } /* Literal.String.Char */ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/bin/bash

#
# ============LICENSE_START================================================
# ONAP
# =========================================================================
# Copyright (C) 2021-2022 Nordix Foundation.
# =========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============LICENSE_END==================================================
#

set -e

SCRIPT_NAME=$(basename "$0")
repo_location="./"
release_data_file="pf_release_data.csv"
release_data_file_tag=""

# Use the bash internal OSTYPE variable to check for MacOS
if [[ "$OSTYPE" == "darwin"* ]]
then
    SED="gsed"
else
    SED="sed"
fi

usage()
{
    echo ""
    echo "$SCRIPT_NAME - updates the inter-repo references in Policy Framework POM files"
    echo ""
    echo "       usage:  $SCRIPT_NAME [-options]"
    echo ""
    echo "       options"
    echo "         -h           - this help message"
    echo "         -d data_file - the policy release data file to use, generated by the 'getReleaseData.sh' script,"
    echo "                        defaults to '$release_data_file'"
    echo "         -l location  - the location of the policy framework repos on the file system,"
    echo "                        defaults to '$repo_location'"
    echo "         -r repo      - the policy repo to update"
    echo "         -p           - update policy/parent references"
    echo "         -c           - update policy/common references"
    echo "         -m           - update policy/model references"
    echo "         -o           - update policy/drools-pdp references"
    echo "         -x           - update policy/apex-pdp references"
    echo "         -k           - update docker base images in Dockerfiles"
    echo "         -f           - update release data in policy parent"
    echo "         -t tag       - tag the release data file with the given tag"
    echo "         -s           - update release references to snapshot references,"
    echo "                        if omitted, snapshot references are updated to release references"
    echo ""
    echo " examples:"
    echo "  $SCRIPT_NAME -pcm -r policy/pap"
    echo "              update the parent, common, and models references of policy/pap"
    echo "              to the current released version"
    echo ""
    echo "  $SCRIPT_NAME -c -m -s -r policy/api"
    echo "              update the common and models references of policy/api"
    echo "              to the current snapshot version"
    exit 255;
}

update_parent=false
update_common=false
update_models=false
update_drools_pdp=false
update_apex_pdp=false
update_snapshot=false
update_docker=false
update_file=false

while getopts "hd:l:r:pcmoxkft:s" opt
do
    case $opt in
    h)
        usage
        ;;
    d)
        release_data_file=$OPTARG
        ;;
    l)
        repo_location=$OPTARG
        ;;
    r)
        specified_repo=$OPTARG
        ;;
    p)
        update_parent=true
        ;;
    c)
        update_common=true
        ;;
    m)
        update_models=true
        ;;
    o)
        update_drools_pdp=true
        ;;
    x)
        update_apex_pdp=true
        ;;
    k)
        update_docker=true
        ;;
    f)
        update_file=true
        ;;
    t)
        release_data_file_tag="$OPTARG"_
        ;;
    s)
        update_snapshot=true
        ;;
    \?)
        usage
        exit 1
        ;;
    esac
done

if [ $OPTIND -eq 1 ]
then
    echo "no arguments were specified"
    usage
fi

if [[ -z "$repo_location" ]]
then
    echo "policy repo location not specified on -l flag"
    exit 1
fi

if ! [ -d "$repo_location" ]
then
    echo "policy repo location '$repo_location' not found"
    exit 1
fi

if [[ -z "$release_data_file" ]]
then
    echo "policy release data file not specified on -d flag"
    exit 1
fi

if ! [ -f "$release_data_file" ]
then
    echo "policy release data file '$release_data_file' not found"
    exit 1
fi

if [ -z "$specified_repo" ]
then
    echo "repo not specified on -r flag"
    exit 1
fi

# shellcheck disable=SC2034
# shellcheck disable=SC2046
read -r parent_repo \
     parent_latest_released_tag \
     parent_latest_snapshot_tag \
     parent_changed_files \
     parent_docker_images \
    <<< $(grep policy/parent "$release_data_file" | tr ',' ' ' )

# shellcheck disable=SC2034
# shellcheck disable=SC2046
read -r common_repo \
     common_latest_released_tag \
     common_latest_snapshot_tag \
     common_changed_files \
     common_docker_images \
    <<< $(grep policy/common "$release_data_file" | tr ',' ' ' )

# shellcheck disable=SC2034
# shellcheck disable=SC2046
read -r docker_repo \
     docker_latest_released_tag \
     docker_latest_snapshot_tag \
     docker_changed_files \
     docker_docker_images \
    <<< $(grep policy/docker "$release_data_file" | tr ',' ' ' )

# shellcheck disable=SC2034
# shellcheck disable=SC2046
read -r models_repo \
     models_latest_released_tag \
     models_latest_snapshot_tag \
     models_changed_files \
     models_docker_images \
    <<< $(grep policy/models "$release_data_file" | tr ',' ' ' )

# shellcheck disable=SC2034
# shellcheck disable=SC2046
read -r drools_pdp_repo \
     drools_pdp_latest_released_tag \
     drools_pdp_latest_snapshot_tag \
     drools_pdp_changed_files \
     drools_pdp_docker_images \
    <<< $(grep policy/drools-pdp "$release_data_file" | tr ',' ' ' )

# shellcheck disable=SC2034
# shellcheck disable=SC2046
read -r apex_pdp_repo \
     apex_pdp_latest_released_tag \
     apex_pdp_latest_snapshot_tag \
     apex_pdp_changed_files \
     apex_pdp_docker_images \
    <<< $(grep policy/apex-pdp "$release_data_file" | tr ',' ' ' )

# shellcheck disable=SC2034
# shellcheck disable=SC2046
read -r target_repo \
	 target_latest_released_tag \
	 target_latest_snapshot_tag \
	 target_changed_files \
	 target_docker_images \
	<<< $(grep "$specified_repo" "$release_data_file" | tr ',' ' ' )

if [ -z "$target_repo" ]
then
    echo "specified repo '$specified_repo' not found in policy release data file '$release_data_file'"
    exit 1
fi

if [ ! "$specified_repo" = "$target_repo" ]
then
    echo "specified repo '$specified_repo' does not match target repo '$target_repo'"
    exit 1
fi

if [ "$update_parent" = true ]
then
    if [ "$specified_repo" = "policy/parent" ]
    then
        if [ "$update_snapshot" = true ]
        then
            major_version=$(echo "$parent_latest_released_tag" | $SED -E 's/^([0-9]*)\.[0-9]*\.[0-9]*$/\1/')
            minor_version=$(echo "$parent_latest_released_tag" | $SED -E 's/^[0-9]*\.([0-9]*)\.[0-9]*$/\1/')
            patch_version=$(echo "$parent_latest_released_tag" | $SED -E 's/^[0-9]*\.[0-9]*\.([0-9]*)$/\1/')

            new_patch_version=$((patch_version+1))
            new_snapshot_tag="$major_version"."$minor_version"."$new_patch_version"-SNAPSHOT

            echo updating policy parent reference to "$new_snapshot_tag" on "$repo_location/$target_repo" . . .
            $SED -i \
                "s/<version.parent.resources>.*<\/version.parent.resources>/<version.parent.resources>$new_snapshot_tag<\/version.parent.resources>/" \
                 "$repo_location/policy/parent/integration/pom.xml"
            result_code=$?
        else
            next_release_version=${parent_latest_snapshot_tag%-*}

            echo "updating policy parent reference to $next_release_version on $repo_location/$target_repo . . ."
            $SED -i \
                "s/<version.parent.resources>.*<\/version.parent.resources>/<version.parent.resources>$next_release_version<\/version.parent.resources>/" \
                "$repo_location/policy/parent/integration/pom.xml"
            result_code=$?
        fi
    else
        if [ "$update_snapshot" = true ]
        then
            echo "updating policy parent reference to $parent_latest_snapshot_tag on $repo_location/$target_repo . . ."
            updateParentRef.sh \
                -f "$repo_location/$target_repo/pom.xml" \
                -g org.onap.policy.parent \
                -a integration \
                -v "$parent_latest_snapshot_tag"
            result_code=$?
        else
            echo "updating policy parent reference to $parent_latest_released_tag on $repo_location/$target_repo . . ."
            updateParentRef.sh \
                -f "$repo_location/$target_repo/pom.xml" \
                -g org.onap.policy.parent \
                -a integration \
                -v "$parent_latest_released_tag"
            result_code=$?
        fi
    fi
    if [[ "$result_code" -eq 0 ]]
    then
        echo "policy parent reference updated on $repo_location/$target_repo"
    else
        echo "policy parent reference update failed on $repo_location/$target_repo"
        exit 1
    fi
fi

if [ "$update_common" = true ]
then
    if [ "$update_snapshot" = true ]
    then
        echo "updating policy common reference to $common_latest_snapshot_tag on $repo_location/$target_repo . . ."
        $SED -i \
            -e "s/<policy.common.version>.*<\/policy.common.version>/<policy.common.version>$common_latest_snapshot_tag<\/policy.common.version>/" \
            -e "s/<version.policy.common>.*<\/version.policy.common>/<version.policy.common>$common_latest_snapshot_tag<\/version.policy.common>/" \
            "$repo_location/$target_repo/pom.xml"
        result_code=$?
    else
        echo "updating policy common reference to $common_latest_released_tag on $repo_location/$target_repo . . ."
        $SED -i \
            -e "s/<policy.common.version>.*<\/policy.common.version>/<policy.common.version>$common_latest_released_tag<\/policy.common.version>/" \
            -e "s/<version.policy.common>.*<\/version.policy.common>/<version.policy.common>$common_latest_released_tag<\/version.policy.common>/" \
            "$repo_location/$target_repo/pom.xml"
        result_code=$?
    fi
    if [[ "$result_code" -eq 0 ]]
    then
        echo "policy common reference updated on $repo_location/$target_repo"
    else
        echo "policy common reference update failed on $repo_location/$target_repo"
        exit 1
    fi
fi

if [ "$update_models" = true ]
then
    if [ "$update_snapshot" = true ]
    then
        echo "updating policy models reference to $models_latest_snapshot_tag on $repo_location/$target_repo . . ."
        $SED -i \
            -e "s/<policy.models.version>.*<\/policy.models.version>/<policy.models.version>$models_latest_snapshot_tag<\/policy.models.version>/" \
            -e "s/<version.policy.models>.*<\/version.policy.models>/<version.policy.models>$models_latest_snapshot_tag<\/version.policy.models>/" \
            "$repo_location/$target_repo/pom.xml"
        result_code=$?
    else
        echo "updating policy models reference to $models_latest_released_tag on $repo_location/$target_repo . . ."
        $SED -i \
            -e "s/<policy.models.version>.*<\/policy.models.version>/<policy.models.version>$models_latest_released_tag<\/policy.models.version>/" \
            -e "s/<version.policy.models>.*<\/version.policy.models>/<version.policy.models>$models_latest_released_tag<\/version.policy.models>/" \
            "$repo_location/$target_repo/pom.xml"
        result_code=$?
    fi
    if [[ "$result_code" -eq 0 ]]
    then
        echo "policy models reference updated on $repo_location/$target_repo"
    else
        echo "policy models reference update failed on $repo_location/$target_repo"
        exit 1
    fi
fi

if [ "$update_drools_pdp" = true ]
then
    if [ "$update_snapshot" = true ]
    then
        echo "updating policy drools-pdp reference to $drools_pdp_latest_snapshot_tag on $repo_location/$target_repo . . ."
        $SED -i \
            -e "s/<policy.drools-pdp.version>.*<\/policy.drools-pdp.version>/<policy.drools-pdp.version>$drools_pdp_latest_snapshot_tag<\/policy.drools-pdp.version>/" \
            -e "s/<version.policy.drools-pdp>.*<\/version.policy.drools-pdp>/<version.policy.drools-pdp>$drools_pdp_latest_snapshot_tag<\/version.policy.drools-pdp>/" \
            "$repo_location/$target_repo/pom.xml"
        result_code=$?
    else
        echo "updating policy drools-pdp reference to $drools_pdp_latest_released_tag on $repo_location/$target_repo . . ."
        $SED -i \
            -e "s/<policy.drools-pdp.version>.*<\/policy.drools-pdp.version>/<policy.drools-pdp.version>$drools_pdp_latest_released_tag<\/policy.drools-pdp.version>/" \
            -e "s/<version.policy.drools-pdp>.*<\/version.policy.drools-pdp>/<version.policy.drools-pdp>$drools_pdp_latest_released_tag<\/version.policy.drools-pdp>/" \
            "$repo_location/$target_repo/pom.xml"
        result_code=$?
    fi
    if [[ "$result_code" -eq 0 ]]
    then
        echo "policy drools-pdp reference updated on $repo_location/$target_repo"
    else
        echo "policy drools-pdp reference update failed on $repo_location/$target_repo"
        exit 1
    fi
fi

if [ "$update_apex_pdp" = true ]
then
    if [ "$update_snapshot" = true ]
    then
        echo "updating policy apex-pdp reference to $apex_pdp_latest_snapshot_tag on $repo_location/$target_repo . . ."
        $SED -i \
            -e "s/<policy.apex-pdp.version>.*<\/policy.apex-pdp.version>/<policy.apex-pdp.version>$apex_pdp_latest_snapshot_tag<\/policy.apex-pdp.version>/" \
            -e "s/<version.policy.apex-pdp>.*<\/version.policy.apex-pdp>/<version.policy.apex-pdp>$apex_pdp_latest_snapshot_tag<\/version.policy.apex-pdp>/" \
            "$repo_location/$target_repo/pom.xml"
        result_code=$?
    else
        echo "updating policy apex-pdp reference to $apex_pdp_latest_released_tag on $repo_location/$target_repo . . ."
        $SED -i \
            -e "s/<policy.apex-pdp.version>.*<\/policy.apex-pdp.version>/<policy.apex-pdp.version>$apex_pdp_latest_released_tag<\/policy.apex-pdp.version>/" \
            -e "s/<version.policy.apex-pdp>.*<\/version.policy.apex-pdp>/<version.policy.apex-pdp>$apex_pdp_latest_released_tag<\/version.policy.apex-pdp>/" \
            "$repo_location/$target_repo/pom.xml"
        result_code=$?
    fi
    if [[ "$result_code" -eq 0 ]]
    then
        echo "policy apex-pdp reference updated on $repo_location/$target_repo"
    else
        echo "policy apex-pdp reference update failed on $repo_location/$target_repo"
        exit 1
    fi
fi

if [ "$update_docker" = true ] && [ "$target_docker_images" != "" ]
then
    if [ "$specified_repo" = "policy/docker" ]
    then
        if [ "$update_snapshot" = true ]
        then
            major_version=$(echo "$docker_latest_released_tag" | $SED -E 's/^([0-9]*)\.[0-9]*\.[0-9]*$/\1/')
            minor_version=$(echo "$docker_latest_released_tag" | $SED -E 's/^[0-9]*\.([0-9]*)\.[0-9]*$/\1/')
            patch_version=$(echo "$docker_latest_released_tag" | $SED -E 's/^[0-9]*\.[0-9]*\.([0-9]*)$/\1/')

            new_patch_version=$((patch_version+1))
            new_snapshot_tag="$major_version"."$minor_version"."$new_patch_version"-SNAPSHOT

            echo "updating docker base images to version $new_snapshot_tag on repo $repo_location/$target_repo . . ."
            find "$repo_location/$target_repo" \
                -name '*Docker*' \
                -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9].*$/\1$new_snapshot_tag/" {} \;
            result_code=$?
        else
            next_release_version=${docker_latest_snapshot_tag%-*}

            echo "updating docker base images to version $next_release_version on repo $repo_location/$target_repo . . ."
            find "$repo_location/$target_repo" \
                -name '*Docker*' \
                -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9].*$/\1$next_release_version/" {} \;
            result_code=$?
        fi
    else
        if [ "$update_snapshot" == true ]
        then
            echo "updating docker base images to version $docker_latest_snapshot_tag on repo $repo_location/$target_repo . . ."
            find "$repo_location/$target_repo" \
                -name '*Docker*' \
                -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9].*$/\1$docker_latest_snapshot_tag/" {} \;
            result_code=$?
        else
            echo "updating docker base images to version $docker_latest_released_tag on repo $repo_location/$target_repo . . ."
            find "$repo_location/$target_repo" \
                -name '*Docker*' \
                -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9].*$/\1$docker_latest_released_tag/" {} \;
            result_code=$?
        fi
    fi

    if [[ "$result_code" -eq 0 ]]
    then
        echo "docker base images updated on $repo_location/$target_repo"
    else
        echo "docker base images update failed on $repo_location/$target_repo"
        exit 1
    fi
fi

if [ "$update_file" = true ]
then
    if [ ! "$target_repo" = "policy/parent" ]
    then
        echo "update of data file can only be done on the policy/parent repo"
        exit 1
    fi

    release_data_file_name="$release_data_file_tag$release_data_file"

    echo \
        "updating release data at" \
        "$repo_location/$target_repo/integration/src/main/resources/release/$release_data_file_name"
    cp \
        "$release_data_file" \
        "$repo_location/$target_repo/integration/src/main/resources/release/$release_data_file_name"
    echo \
        "updated release data at" \
        "$repo_location/$target_repo/integration/src/main/resources/release/$release_data_file_name"
fi