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"
28 release_data_file_tag=""
33 echo "$SCRIPT_NAME - execute a certain policy framework release phase"
35 echo " usage: $SCRIPT_NAME [-options]"
38 echo " -h - this help message"
39 echo " -d data_file - the policy release data file to use, defaults to '$release_data_file'"
40 echo " -l location - the location of the policy framework repos on the file system,"
41 echo " defaults to '$repo_location'"
42 echo " -i issue-id - issue ID in the format POLICY-nnnn"
43 echo " -p phase - the release phase, a positive integer"
44 echo " -t tag - tag the release data file with the given tag"
47 echo " $SCRIPT_NAME -l /home/user/onap -d /home/user/data/pf_release_data.csv -i POLICY-1234 -p 3"
48 echo " perform release phase 3 on the repos at location '/home/user/onap' using the release data"
49 echo " in the file '/home/user/data/pf_release_data.csv'"
53 while getopts "hd:l:i:p:t:" opt
60 release_data_file=$OPTARG
72 release_data_file_tag="$OPTARG"
83 echo "no arguments were specified"
87 if [[ -z "$repo_location" ]]
89 echo "policy repo location not specified on -l flag"
93 if ! [ -d "$repo_location" ]
95 echo "policy repo location '$repo_location' not found"
99 if [[ -z "$release_data_file" ]]
101 echo "policy release data file not specified on -d flag"
105 if ! [ -f "$release_data_file" ]
107 echo "policy release data file '$release_data_file' not found"
111 if [ -z "$issue_id" ]
113 echo "issue_id not specified on -i flag"
117 if ! echo "$issue_id" | grep -Eq '^POLICY-[0-9]*$'
119 echo "issue ID is invalid, it should be of form 'POLICY-nnnn'"
123 if [ -z "$release_phase" ]
125 echo "release_phase not specified on -p flag"
129 if ! [[ "$release_phase" =~ ^[0-9]+$ ]]
131 echo "release_phase is invalid, it should be a positive integer"
136 echo "Updating parent references in the parent pom and generating commit . . ."
137 updateRefs.sh -d "$release_data_file" -l "$repo_location" -r policy/parent -p
139 -l "$repo_location" \
142 -e "update parent references in policy/parent pom" \
143 -m "updated the parent references in the policy/parent pom"
144 echo "Updated parent references in the parent pom and generated commit"
148 echo "Generating artifact release yaml file and commit for policy/parent . . ."
149 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/parent -i "$issue_id"
150 echo "Generated artifact release yaml file and commit for policy/parent"
154 echo "Updating snapshots for policy/parent, updating references on policy/docker and policy/common . . ."
156 -d "$release_data_file" \
157 -l "$repo_location" \
161 -d "$release_data_file" \
162 -l "$repo_location" \
166 -d "$release_data_file" \
167 -l "$repo_location" \
170 -l "$repo_location" \
173 -e "update parent references in policy/docker pom" \
174 -m "updated the parent references in the policy/docker pom"
176 -l "$repo_location" \
179 -e "update parent references in policy/common pom" \
180 -m "updated the parent references in the policy/common pom"
181 echo "Updated snapshots for policy/parent, updating references on policy/docker and policy/common"
185 echo "Generating artifact release yaml file and commit for policy/common . . ."
186 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/common -i "$issue_id"
187 echo "Generated artifact release yaml file and commit for policy/common"
189 echo "Generating docker release yaml file and commit for policy/docker . . ."
190 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/docker -i "$issue_id"
191 echo "Generated docker release yaml file and commit for policy/docker"
195 echo "Updating snapshots for policy/common and policy/docker, updating references on policy/models . . ."
197 -d "$release_data_file" \
198 -l "$repo_location" \
202 -d "$release_data_file" \
203 -l "$repo_location" \
206 -l "$repo_location" \
209 -e "update parent,common references in policy/models pom" \
210 -m "updated the parent and common references in the policy/models pom"
211 echo "Updated snapshots for policy/common and policy/docker, updated references on policy/models"
215 echo "Generating artifact release yaml file and commit for policy/models . . ."
216 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/models -i "$issue_id"
217 echo "Generated artifact release yaml file and commit for policy/models"
221 echo "Generating docker release yaml file and commit for policy/models . . ."
222 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/models -i "$issue_id"
223 echo "Generated docker release yaml file and commit for policy/models"
227 echo "Updating snapshots for policy/models, updating references on other repos . . ."
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" \
249 -d "$release_data_file" \
250 -l "$repo_location" \
251 -r "policy/distribution"
254 -d "$release_data_file" \
255 -l "$repo_location" \
256 -r "policy/drools-pdp"
259 -d "$release_data_file" \
260 -l "$repo_location" \
264 -d "$release_data_file" \
265 -l "$repo_location" \
266 -r "policy/xacml-pdp"
268 -l "$repo_location" \
269 -r "policy/apex-pdp" \
271 -e "update references in policy/apex-pdp pom" \
272 -m "updated references in the policy/apex-pdp pom"
274 -l "$repo_location" \
277 -e "update references in policy/api pom" \
278 -m "updated references in the policy/api pom"
280 -l "$repo_location" \
283 -e "update references in policy/clamp pom" \
284 -m "updated references in the policy/clamp pom"
286 -l "$repo_location" \
287 -r "policy/distribution" \
289 -e "update references in policy/distribution pom" \
290 -m "updated references in the policy/distribution pom"
292 -l "$repo_location" \
293 -r "policy/drools-pdp" \
295 -e "update references in policy/drools-pdp pom" \
296 -m "updated references in the policy/drools-pdp 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/pap -i "$issue_id"
320 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/xacml-pdp -i "$issue_id"
321 echo "Generated artifact release yaml file and commit for repos"
325 echo "Generating docker release yaml file and commit for repos . . ."
326 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/apex-pdp -i "$issue_id"
327 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/api -i "$issue_id"
328 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/clamp -i "$issue_id"
329 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/distribution -i "$issue_id"
330 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-pdp -i "$issue_id"
331 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/pap -i "$issue_id"
332 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/xacml-pdp -i "$issue_id"
333 echo "Generated docker release yaml file and commit for repos"
337 echo "Updating snapshots for repos, updating references on policy/drools-applications, policy/gui . . ."
339 -d "$release_data_file" \
340 -l "$repo_location" \
344 -d "$release_data_file" \
345 -l "$repo_location" \
346 -r "policy/drools-applications"
349 -d "$release_data_file" \
350 -l "$repo_location" \
353 -l "$repo_location" \
354 -r "policy/drools-applications" \
356 -e "update references in policy/drools-applications pom" \
357 -m "updated references in the policy/drools-applications pom"
359 -l "$repo_location" \
362 -e "update references in policy/gui pom" \
363 -m "updated references in the policy/gui pom"
364 echo "Updated snapshots for repos, updated references on policy/drools-applications, policy/gui"
368 echo "Generating artifact release yaml file and commit for policy/drools-applications . . ."
369 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-applications -i "$issue_id"
370 releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/gui -i "$issue_id"
371 echo "Generated artifact release yaml file and commit for policy/drools-applications"
375 echo "Generating docker release yaml file and commit for policy/drools-applications . . ."
376 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-applications -i "$issue_id"
377 releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/gui -i "$issue_id"
378 echo "Generated docker release yaml file and commit for policy/drools-applications"
382 echo "Updating snapshots on policy/drools-applications and policy/gui . . ."
384 -d "$release_data_file" \
385 -l "$repo_location" \
387 echo "Updated snapshots on policy/drools-applications and policy/gui"
391 echo "Updating release data file . . ."
393 -t "$release_data_file_tag" \
394 -d "$release_data_file" \
395 -l "$repo_location" \
398 -l "$repo_location" \
401 -e "update release data in policy/parent" \
402 -m "updated release data in policy/parent"
403 echo "Updated release data file"
406 case "$release_phase" in
453 *) echo "specified release phase '$release_phase' is invalid"