summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-10-03 11:17:55 +0100
committerliamfallon <liam.fallon@est.tech>2022-10-03 11:20:29 +0100
commit91cae851fb32b3670a54a4ff9120e5690c85aed4 (patch)
treed5dbdc1a723c536cbd42a4935b2bfe06e946ae1e
parentd31592eebbfbaca118c44f45af0cb3e935b90623 (diff)
Handle docker refs correctly in policy/docker
The decker references in db-migrator need to be handled specially because the reference in db-migrator must be set to the new Docker reference that is to be released rather than the docker reference in the pf_release_data.csv (which is correct in later phases). This is in effect a forward reference to the "to-be-released_ docker base image. Issue-ID: POLICY-4045 Change-Id: Iff3845d06894f7f4c927509fb2fb43f00af3b7ef Signed-off-by: liamfallon <liam.fallon@est.tech>
-rwxr-xr-xintegration/src/main/scripts/release/updateRefs.sh49
1 files changed, 38 insertions, 11 deletions
diff --git a/integration/src/main/scripts/release/updateRefs.sh b/integration/src/main/scripts/release/updateRefs.sh
index 45ec0652..9ca92e22 100755
--- a/integration/src/main/scripts/release/updateRefs.sh
+++ b/integration/src/main/scripts/release/updateRefs.sh
@@ -406,19 +406,46 @@ fi
if [ "$update_docker" = true ] && [ "$target_docker_images" != "" ]
then
- if [ "$update_snapshot" == true ]
+ if [ "$specified_repo" = "policy/docker" ]
then
- echo "updating docker base images to version $docker_latest_snapshot_tag on repo $repo_location/$target_repo . . ."
- find "$repo_location/$target_repo" \
- -name '*Docker*' \
- -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9].*$/\1$docker_latest_snapshot_tag/" {} \;
- result_code=$?
+ if [ "$update_snapshot" = true ]
+ then
+ major_version=$(echo "$docker_latest_released_tag" | $SED -E 's/^([0-9]*)\.[0-9]*\.[0-9]*$/\1/')
+ minor_version=$(echo "$docker_latest_released_tag" | $SED -E 's/^[0-9]*\.([0-9]*)\.[0-9]*$/\1/')
+ patch_version=$(echo "$docker_latest_released_tag" | $SED -E 's/^[0-9]*\.[0-9]*\.([0-9]*)$/\1/')
+
+ new_patch_version=$((patch_version+1))
+ new_snapshot_tag="$major_version"."$minor_version"."$new_patch_version"-SNAPSHOT
+
+ echo "updating docker base images to version $new_snapshot_tag on repo $repo_location/$target_repo . . ."
+ find "$repo_location/$target_repo" \
+ -name '*Docker*' \
+ -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9].*$/\1$new_snapshot_tag/" {} \;
+ result_code=$?
+ else
+ next_release_version=${docker_latest_snapshot_tag%-*}
+
+ echo "updating docker base images to version $next_release_version on repo $repo_location/$target_repo . . ."
+ find "$repo_location/$target_repo" \
+ -name '*Docker*' \
+ -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9].*$/\1$next_release_version/" {} \;
+ result_code=$?
+ fi
else
- echo "updating docker base images to version $docker_latest_released_tag on repo $repo_location/$target_repo . . ."
- find "$repo_location/$target_repo" \
- -name '*Docker*' \
- -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9].*$/\1$docker_latest_released_tag/" {} \;
- result_code=$?
+ if [ "$update_snapshot" == true ]
+ then
+ echo "updating docker base images to version $docker_latest_snapshot_tag on repo $repo_location/$target_repo . . ."
+ find "$repo_location/$target_repo" \
+ -name '*Docker*' \
+ -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9].*$/\1$docker_latest_snapshot_tag/" {} \;
+ result_code=$?
+ else
+ echo "updating docker base images to version $docker_latest_released_tag on repo $repo_location/$target_repo . . ."
+ find "$repo_location/$target_repo" \
+ -name '*Docker*' \
+ -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9].*$/\1$docker_latest_released_tag/" {} \;
+ result_code=$?
+ fi
fi
if [[ "$result_code" -eq 0 ]]