From 2da18f6d0be535eb2ae0afc74b945a39ccd8d7a8 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Fri, 29 Jul 2022 13:35:49 +0100 Subject: Update docker files base images to snapshots Currently the policy base images used in docker files in master are hard revisions of the policy base images. The docker files should use snapshot policy base images when they are availabe and only change to released base images at release time. This commit ensures that the references are updated correctly in Docker files to snapshots or released base policy images as appropriate Issue-ID: POLICY-4287 Change-Id: I2c68e1bad6bde2e116c27678c88f8b40dc914b0f Signed-off-by: liamfallon --- integration/src/main/scripts/release/bumpSnapshots.sh | 11 ++++++++--- integration/src/main/scripts/release/releasePhase.sh | 2 +- integration/src/main/scripts/release/updateRefs.sh | 18 ++++++++++++++---- 3 files changed, 23 insertions(+), 8 deletions(-) (limited to 'integration/src/main/scripts') diff --git a/integration/src/main/scripts/release/bumpSnapshots.sh b/integration/src/main/scripts/release/bumpSnapshots.sh index c67e81ff..73eccd9e 100755 --- a/integration/src/main/scripts/release/bumpSnapshots.sh +++ b/integration/src/main/scripts/release/bumpSnapshots.sh @@ -178,9 +178,14 @@ do mv "$temp_file" "$repo_location/$repo/version.properties" fi - updateRefs.sh -pcmoxs -d "$release_data_file" -l "$repo_location" -r "$repo" - - if [ "$(git -C "$repo_location/$specified_repo" status | grep '^[ \t]*modified:[ \t]*pom.xml' > /dev/null 2>&1)" = 0 ] + updateRefs.sh -pcmokxs -d "$release_data_file" -l "$repo_location" -r "$repo" + + if [ "$(git -C "$repo_location/$specified_repo" status | + grep \ + -e '^\s*modified:\s*pom.xml$' \ + -e '^\s*modified:\s*.*Dockerfile$' \ + > /dev/null 2>&1)" \ + = 1 ] then references_updated=0 else diff --git a/integration/src/main/scripts/release/releasePhase.sh b/integration/src/main/scripts/release/releasePhase.sh index fd8397ff..652bf007 100755 --- a/integration/src/main/scripts/release/releasePhase.sh +++ b/integration/src/main/scripts/release/releasePhase.sh @@ -152,7 +152,7 @@ release_phase_3() { -l "$repo_location" \ -i "$issue_id" updateRefs.sh \ - -p \ + -pk \ -d "$release_data_file" \ -l "$repo_location" \ -r "policy/docker" diff --git a/integration/src/main/scripts/release/updateRefs.sh b/integration/src/main/scripts/release/updateRefs.sh index 14f90d9a..059c46c0 100755 --- a/integration/src/main/scripts/release/updateRefs.sh +++ b/integration/src/main/scripts/release/updateRefs.sh @@ -404,10 +404,20 @@ then echo "updating docker base images to version $docker_latest_released_tag on repo $repo_location/$target_repo . . ." find "$repo_location/$target_repo" \ -name '*Docker*' - 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 + 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 + 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 + if [[ "$result_code" -eq 0 ]] then echo "docker base images updated on $repo_location/$target_repo" -- cgit 1.2.3-korg