3 # COPYRIGHT NOTICE STARTS HERE
5 # Copyright 2018 © Samsung Electronics Co., Ltd.
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 # COPYRIGHT NOTICE ENDS HERE
21 # This simple script should be used during build / packaging process
22 # and it should be referenced in BuildGuide.
23 # Patching of helm charts is the only way for OOM charts to be compatible
24 # with this offline installer. This will become obsolete once native
25 # solution is implemented in charts themselves and which is tracked
32 _R='\033[0;31;1m' #Red
33 _G='\033[0;32;1m' #Green
34 _Y='\033[0;33;1m' #Yellow
35 C_='\033[0m' #Color off
39 echo -e "./$(basename $0) <helm charts repo> <commit/tag/branch> <patchfile> <target_dir>\n"
40 echo "Example: ./$(basename $0) https://gerrit.onap.org/r/oom 3.0.0-ONAP /root/offline-installer/patches/casablanca.patch /root/offline-installer/ansible/application/helm_charts"
43 if [ "$#" -ne 4 ]; then
44 echo "This script should get exactly 4 arguments!"
45 echo -e "Wrong number of parameters provided\n"
51 # git and patch tools are preconditions for this to work
54 PATCH_FILE=$(realpath "${3}")
56 echo -e "${_G}[Step $((CURR++))/${TOTAL} cloning repo with charts to be patched]${C_}"
57 git clone "${1}" "${4}"
59 echo -e "${_G}[Step $((CURR++))/${TOTAL} setting working dir to ${4}]${C_}"
62 echo -e "${_G}[Step $((CURR++))/${TOTAL} git-checkout to correct base]${C_}"
65 echo -e "${_G}[Step $((CURR++))/${TOTAL} patching charts]${C_}"
66 git apply "${PATCH_FILE}"
68 echo -e "${_G}[Step $((CURR++))/${TOTAL} returning to original working directory]${C_}"