diff options
author | 2022-06-17 10:44:27 +0100 | |
---|---|---|
committer | 2022-06-17 10:47:38 +0100 | |
commit | cd44921c7e00e699b27697d3e5be4fc3433b81a2 (patch) | |
tree | b06c916c12e9075571f51b1978105357bb81900d /integration/src/release_scripts/releaseRepoImages.sh | |
parent | b3223fd59ea60d98948e23073833a010c027a8a2 (diff) |
Restructure scripts in policy-parent
- Moved the scripts into src/main/scripts
- created src/main/resources
- added pf_release_data.csv to src/main/resources, this file will be
- added a n ew release phase to release the mdoels-simulator image
pf_release_data.sh:
Used to find the correct versions of images to use for the CSIT tests,
the current lookup scripts can't cope with snapshots being deleted after
they time out.
Issue-ID: POLICY-4233
Change-Id: Idb5a4a624c06114f0f480c599e87f5596705ea07
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'integration/src/release_scripts/releaseRepoImages.sh')
-rwxr-xr-x | integration/src/release_scripts/releaseRepoImages.sh | 179 |
1 files changed, 0 insertions, 179 deletions
diff --git a/integration/src/release_scripts/releaseRepoImages.sh b/integration/src/release_scripts/releaseRepoImages.sh deleted file mode 100755 index 00eff051..00000000 --- a/integration/src/release_scripts/releaseRepoImages.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/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================================================== -# - -SCRIPT_NAME=$(basename "$0") -repo_location="./" -release_data_file="./pf_release_data.csv" - -usage() -{ - echo "" - echo "$SCRIPT_NAME - release the docker images for the specified repository by generating the release yaml file and" - echo " the release commit" - echo " usage: $SCRIPT_NAME [-options]" - echo "" - echo " options" - echo " -h - this help message" - echo " -d data_file - the policy release data file to use, 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 release" - echo " -i issue-id - issue ID in the format POLICY-nnnn" - echo "" - echo " examples:" - echo " $SCRIPT_NAME -l /home/user/onap -d /home/user/data/pf_release_data.csv -r policy/common -i POLICY-1234" - echo " release the 'policy/common' repo at location '/home/user/onap' using the release data" - echo " in the file '/home/user/data/pf_release_data.csv'" - exit 255; -} - -while getopts "hd:l:r:i:" opt -do - case $opt in - h) - usage - ;; - d) - release_data_file=$OPTARG - ;; - l) - repo_location=$OPTARG - ;; - r) - specified_repo=$OPTARG - ;; - i) - issue_id=$OPTARG - ;; - \?) - 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 - -if [ -z "$issue_id" ] -then - echo "issue_id not specified on -i flag" - exit 1 -fi - -if ! echo "$issue_id" | grep -Eq '^POLICY-[0-9]*$' -then - echo "issue ID is invalid, it should be of form 'POLICY-nnnn'" - exit 1 -fi - -# shellcheck disable=SC2034 -read -r repo \ - latest_released_tag \ - latest_snapshot_tag \ - changed_files \ - docker_images \ - <<< "$(grep "$specified_repo" "$release_data_file" | tr ',' ' ' )" - -if [ ! "$repo" = "$specified_repo" ] -then - echo "repo '$specified_repo' not found in file 'pf_release_data.csv'" - exit 1 -fi - -next_release_version=${latest_snapshot_tag%-*} - -while true -do - read -r -p "have you run 'stage-release' on the '$repo' repo? " yes_no - case $yes_no in - [Yy]* ) break - ;; - - [Nn]* ) exit - ;; - - * ) echo "Please answer 'yes' or 'no'" - ;; - esac -done - -if [ "$docker_images" != "" ] -then - saved_current_dir=$(pwd) - cd "$repo_location/$repo" || exit 1 - # shellcheck disable=SC2046 - if ! mkdock.sh $(echo "$docker_images" | sed -e "s/'//g" -e "s/:/ /g") - then - echo "generation of docker image release container yaml file failed" - cd "$saved_current_dir" || exit 1 - exit 1 - fi - cd "$saved_current_dir" || exit 1 -else - echo "repo '$repo' does not have any docker images" - exit 1 -fi - -echo "generating commit for $repo docker image release: $latest_released_tag-->$next_release_version . . ." - -generateCommit.sh \ - -l "$repo_location" \ - -r "$repo" \ - -i "$issue_id" \ - -e "Release docker images for $repo: $next_release_version" \ - -m "This commit releases docker images for repo $repo." - -echo "commit for $repo docker image release: $latest_released_tag-->$next_release_version generated" |