4 # ============LICENSE_START================================================
6 # =========================================================================
7 # Copyright (C) 2022 Nordix Foundation.
8 # =========================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
13 # http://www.apache.org/licenses/LICENSE-2.0
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END==================================================
25 SCRIPT_NAME=$(basename "$0")
27 release_data_file="./pf_release_data.csv"
32 echo "$SCRIPT_NAME - execute a certain policy framework release phase"
34 echo " usage: $SCRIPT_NAME [-options]"
37 echo " -h - this help message"
38 echo " -d data_file - the policy release data file to use, defaults to '$release_data_file'"
39 echo " -l location - the location of the policy framework repos on the file system,"
40 echo " defaults to '$repo_location'"
41 echo " -i issue-id - issue ID in the format POLICY-nnnn"
42 echo " -p phase - the release phase, a positive integer"
45 echo " $SCRIPT_NAME -l /home/user/onap -d /home/user/data/pf_release_data.csv -i POLICY-1234 -p 3"
46 echo " perform release phase 3 on the repos at location '/home/user/onap' using the release data"
47 echo " in the file '/home/user/data/pf_release_data.csv'"
51 while getopts "hd:l:i:p:" opt
58 release_data_file=$OPTARG
78 echo "no arguments were specified"
82 if [[ -z "$repo_location" ]]
84 echo "policy repo location not specified on -l flag"
88 if ! [ -d "$repo_location" ]
90 echo "policy repo location '$repo_location' not found"
94 if [[ -z "$release_data_file" ]]
96 echo "policy release data file not specified on -d flag"
100 if ! [ -f "$release_data_file" ]
102 echo "policy release data file '$release_data_file' not found"
106 if [ -z "$issue_id" ]
108 echo "issue_id not specified on -i flag"
112 if ! echo "$issue_id" | grep -Eq '^POLICY-[0-9]*$'
114 echo "issue ID is invalid, it should be of form 'POLICY-nnnn'"
118 if [ -z "$release_phase" ]
120 echo "release_phase not specified on -p flag"
124 if ! [[ "$release_phase" =~ ^[0-9]+$ ]]
126 echo "release_phase is invalid, it should be a positive integer"
131 echo "Updating parent references in the parent pom and generating commit . . ."
132 updateRefs.sh -d "$release_data_file" -l "$repo_location" -r policy/parent -p
134 -l "$repo_location" \
137 -e "update parent references in policy/parent pom" \
138 -m "updated the parent references in the policy/parent pom"
139 echo "Updated parent references in the parent pom and generated commit"
143 echo "Generating artifact release yaml file and commit for policy/parent . . ."
144 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/parent -i "$issue_id"
145 echo "Generated artifact release yaml file and commit for policy/parent"
149 echo "Updating snapshots for policy/parent, updating references on policy/docker and policy/common . . ."
151 -d "$release_data_file" \
152 -l "$repo_location" \
156 -d "$release_data_file" \
157 -l "$repo_location" \
161 -d "$release_data_file" \
162 -l "$repo_location" \
165 -l "$repo_location" \
168 -e "update parent references in policy/docker pom" \
169 -m "updated the parent references in the policy/docker pom"
171 -l "$repo_location" \
174 -e "update parent references in policy/common pom" \
175 -m "updated the parent references in the policy/common pom"
176 echo "Updated snapshots for policy/parent, updating references on policy/docker and policy/common"
180 echo "Generating artifact release yaml file and commit for policy/common . . ."
181 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/common -i "$issue_id"
182 echo "Generated artifact release yaml file and commit for policy/common"
184 echo "Generating docker release yaml file and commit for policy/docker . . ."
185 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/docker -i "$issue_id"
186 echo "Generated docker release yaml file and commit for policy/docker"
190 echo "Updating snapshots for policy/common and policy/docker, updating references on policy/models . . ."
192 -d "$release_data_file" \
193 -l "$repo_location" \
197 -d "$release_data_file" \
198 -l "$repo_location" \
201 -l "$repo_location" \
204 -e "update parent,common references in policy/models pom" \
205 -m "updated the parent and common references in the policy/models pom"
206 echo "Updated snapshots for policy/common and policy/docker, updated references on policy/models"
210 echo "Generating artifact release yaml file and commit for policy/models . . ."
211 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/models -i "$issue_id"
212 echo "Generated artifact release yaml file and commit for policy/models"
216 echo "Generating docker release yaml file and commit for policy/models . . ."
217 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/models -i "$issue_id"
218 echo "Generated docker release yaml file and commit for policy/models"
222 echo "Updating snapshots for policy/models, updating references on other repos . . ."
224 -d "$release_data_file" \
225 -l "$repo_location" \
229 -d "$release_data_file" \
230 -l "$repo_location" \
234 -d "$release_data_file" \
235 -l "$repo_location" \
239 -d "$release_data_file" \
240 -l "$repo_location" \
244 -d "$release_data_file" \
245 -l "$repo_location" \
246 -r "policy/distribution"
249 -d "$release_data_file" \
250 -l "$repo_location" \
251 -r "policy/drools-pdp"
254 -d "$release_data_file" \
255 -l "$repo_location" \
259 -d "$release_data_file" \
260 -l "$repo_location" \
261 -r "policy/xacml-pdp"
263 -l "$repo_location" \
264 -r "policy/apex-pdp" \
266 -e "update references in policy/apex-pdp pom" \
267 -m "updated references in the policy/apex-pdp pom"
269 -l "$repo_location" \
272 -e "update references in policy/api pom" \
273 -m "updated references in the policy/api pom"
275 -l "$repo_location" \
278 -e "update references in policy/clamp pom" \
279 -m "updated references in the policy/clamp pom"
281 -l "$repo_location" \
282 -r "policy/distribution" \
284 -e "update references in policy/distribution pom" \
285 -m "updated references in the policy/distribution pom"
287 -l "$repo_location" \
288 -r "policy/drools-pdp" \
290 -e "update references in policy/drools-pdp pom" \
291 -m "updated references in the policy/drools-pdp pom"
293 -l "$repo_location" \
296 -e "update references in policy/pap pom" \
297 -m "updated references in the policy/pap pom"
299 -l "$repo_location" \
300 -r "policy/xacml-pdp" \
302 -e "update references in policy/xacml-pdp pom" \
303 -m "updated references in the policy/xacml-pdp pom"
304 echo "Updated snapshots for policy/models, updated references on other repos"
308 echo "Generating artifact release yaml file and commit for repos . . ."
309 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/apex-pdp -i "$issue_id"
310 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/api -i "$issue_id"
311 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/clamp -i "$issue_id"
312 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/distribution -i "$issue_id"
313 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-pdp -i "$issue_id"
314 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/pap -i "$issue_id"
315 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/xacml-pdp -i "$issue_id"
316 echo "Generated artifact release yaml file and commit for repos"
320 echo "Generating docker release yaml file and commit for repos . . ."
321 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/apex-pdp -i "$issue_id"
322 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/api -i "$issue_id"
323 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/clamp -i "$issue_id"
324 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/distribution -i "$issue_id"
325 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-pdp -i "$issue_id"
326 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/pap -i "$issue_id"
327 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/xacml-pdp -i "$issue_id"
328 echo "Generated docker release yaml file and commit for repos"
332 echo "Updating snapshots for repos, updating references on policy/drools-applications, policy/gui . . ."
334 -d "$release_data_file" \
335 -l "$repo_location" \
339 -d "$release_data_file" \
340 -l "$repo_location" \
341 -r "policy/drools-applications"
344 -d "$release_data_file" \
345 -l "$repo_location" \
348 -l "$repo_location" \
349 -r "policy/drools-applications" \
351 -e "update references in policy/drools-applications pom" \
352 -m "updated references in the policy/drools-applications pom"
354 -l "$repo_location" \
357 -e "update references in policy/gui pom" \
358 -m "updated references in the policy/gui pom"
359 echo "Updated snapshots for repos, updated references on policy/drools-applications, policy/gui"
363 echo "Generating artifact release yaml file and commit for policy/drools-applications . . ."
364 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-applications -i "$issue_id"
365 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/gui -i "$issue_id"
366 echo "Generated artifact release yaml file and commit for policy/drools-applications"
370 echo "Generating docker release yaml file and commit for policy/drools-applications . . ."
371 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-applications -i "$issue_id"
372 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/gui -i "$issue_id"
373 echo "Generated docker release yaml file and commit for policy/drools-applications"
377 echo "Updating snapshots on policy/drools-applications, policy/gui and updating release data file . . ."
379 -d "$release_data_file" \
380 -l "$repo_location" \
384 -d "$release_data_file" \
385 -l "$repo_location" \
388 -l "$repo_location" \
391 -e "update release data in policy/parent" \
392 -m "updated release data in policy/parent"
393 echo "Updated snapshots on policy/drools-applications, policy/gui and updated release data file"
396 case "$release_phase" in
440 *) echo "specified release phase '$release_phase' is invalid"