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 "Updating snapshots for policy/models, updating references on other repos . . ."
218 -d "$release_data_file" \
219 -l "$repo_location" \
223 -d "$release_data_file" \
224 -l "$repo_location" \
228 -d "$release_data_file" \
229 -l "$repo_location" \
233 -d "$release_data_file" \
234 -l "$repo_location" \
238 -d "$release_data_file" \
239 -l "$repo_location" \
240 -r "policy/distribution"
243 -d "$release_data_file" \
244 -l "$repo_location" \
245 -r "policy/drools-pdp"
248 -d "$release_data_file" \
249 -l "$repo_location" \
253 -d "$release_data_file" \
254 -l "$repo_location" \
258 -d "$release_data_file" \
259 -l "$repo_location" \
260 -r "policy/xacml-pdp"
262 -l "$repo_location" \
263 -r "policy/apex-pdp" \
265 -e "update references in policy/apex-pdp pom" \
266 -m "updated references in the policy/apex-pdp pom"
268 -l "$repo_location" \
271 -e "update references in policy/api pom" \
272 -m "updated references in the policy/api pom"
274 -l "$repo_location" \
277 -e "update references in policy/clamp pom" \
278 -m "updated references in the policy/clamp pom"
280 -l "$repo_location" \
281 -r "policy/distribution" \
283 -e "update references in policy/distribution pom" \
284 -m "updated references in the policy/distribution pom"
286 -l "$repo_location" \
287 -r "policy/drools-pdp" \
289 -e "update references in policy/drools-pdp pom" \
290 -m "updated references in the policy/drools-pdp pom"
292 -l "$repo_location" \
295 -e "update references in policy/gui pom" \
296 -m "updated references in the policy/gui pom"
298 -l "$repo_location" \
301 -e "update references in policy/pap pom" \
302 -m "updated references in the policy/pap pom"
304 -l "$repo_location" \
305 -r "policy/xacml-pdp" \
307 -e "update references in policy/xacml-pdp pom" \
308 -m "updated references in the policy/xacml-pdp pom"
309 echo "Updated snapshots for policy/models, updated references on other repos"
313 echo "Generating artifact release yaml file and commit for repos . . ."
314 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/apex-pdp -i "$issue_id"
315 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/api -i "$issue_id"
316 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/clamp -i "$issue_id"
317 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/distribution -i "$issue_id"
318 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-pdp -i "$issue_id"
319 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/gui -i "$issue_id"
320 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/pap -i "$issue_id"
321 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/xacml-pdp -i "$issue_id"
322 echo "Generated artifact release yaml file and commit for repos"
326 echo "Generating docker release yaml file and commit for repos . . ."
327 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/apex-pdp -i "$issue_id"
328 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/api -i "$issue_id"
329 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/clamp -i "$issue_id"
330 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/distribution -i "$issue_id"
331 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-pdp -i "$issue_id"
332 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/gui -i "$issue_id"
333 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/pap -i "$issue_id"
334 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/xacml-pdp -i "$issue_id"
335 echo "Generated docker release yaml file and commit for repos"
339 echo "Updating snapshots for repos, updating references on policy/drools-applications . . ."
341 -d "$release_data_file" \
342 -l "$repo_location" \
346 -d "$release_data_file" \
347 -l "$repo_location" \
348 -r "policy/drools-applications"
350 -l "$repo_location" \
351 -r "policy/drools-applications" \
353 -e "update references in policy/drools-applications pom" \
354 -m "updated references in the policy/drools-applications pom"
355 echo "Updated snapshots for repos, updated references on policy/drools-applications"
359 echo "Generating artifact release yaml file and commit for policy/drools-applications . . ."
360 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-applications -i "$issue_id"
361 echo "Generated artifact release yaml file and commit for policy/drools-applications"
365 echo "Generating docker release yaml file and commit for policy/drools-applications . . ."
366 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-applications -i "$issue_id"
367 echo "Generated docker release yaml file and commit for policy/drools-applications"
371 echo "Updating snapshots on policy/drools-applications . . ."
373 -d "$release_data_file" \
374 -l "$repo_location" \
378 case "$release_phase" in
419 *) echo "specified release phase '$release_phase' is invalid"