From 27dac8bda605855f699c0e3c414aa6a3fa619245 Mon Sep 17 00:00:00 2001 From: Wendy Raschke Date: Fri, 27 Oct 2023 12:19:31 -0500 Subject: [PATCH 1/4] update.sh script invoked by main branch workflow needs to be in vNext --- update.sh | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 update.sh diff --git a/update.sh b/update.sh new file mode 100644 index 000000000..faf12f36e --- /dev/null +++ b/update.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +echo "Hello from the update.sh script!" +echo $(date) + +# Set variables to the positional parameters +OLD_VERSION=$1 +NEW_VERSION=$2 +BUILD_LABEL=$3 + +# See if NEW_VERSION and OLD_VERSION fit expected pattern. +if [[ $OLD_VERSION =~ 2[3-9]\.0\.0\.[0-9]+ && $NEW_VERSION =~ 2[3-9]\.0\.0\.[0-9]+ ]]; +then + echo "$OLD_VERSION and $NEW_VERSION matches expected version format." +else + echo "Either $OLD_VERSION or $NEW_VERSION does not fit expected version format." + exit 1; +fi + +# Get last digit of old version +OLD_SHORT_VERSION=${OLD_VERSION:7} + +echo "OLD_VERSION = $OLD_VERSION" +echo "NEW_VERSION = $NEW_VERSION" +echo "BUILD_LABEL = $BUILD_LABEL" +echo "OLD_SHORT_VERSION = $OLD_SHORT_VERSION" + +echo "Copying latest files to $NEW_VERSION" +cp -r ./ga/latest ./ga/$NEW_VERSION + +# Perform the substitutions in both latest and $NEW_VERSION directories. +for file in $(find ./ga/latest ./ga/$NEW_VERSION -name Dockerfile.*); do + echo "Processing $file"; + + sed -i'.bak' -e "s/$OLD_VERSION/$NEW_VERSION/" $file; + sed -i'.bak' -e "s/ARG LIBERTY_BUILD_LABEL=.*/ARG LIBERTY_BUILD_LABEL=$BUILD_LABEL/g" $file; + + # Do these substitutions only in $NEW_VERSION, not latest. + if [[ "$file" == "./ga/$NEW_VERSION/"* ]]; + then + sed -i'.bak' -e "s/ARG PARENT_IMAGE=icr.io\/appcafe\/websphere-liberty:kernel/ARG PARENT_IMAGE=icr.io\/appcafe\/websphere-liberty:$NEW_VERSION-kernel/g" $file; + sed -i'.bak' -e "s/FROM websphere-liberty:kernel/FROM websphere-liberty:$NEW_VERSION-kernel/g" $file; + fi + + # Clean up temp files + rm $file.bak + +done + +cp ./ga/$OLD_VERSION/images.txt ./ga/$NEW_VERSION/images.txt; +sed -i'.bak' -e "s/$OLD_VERSION/$NEW_VERSION/g" ./ga/$NEW_VERSION/images.txt; +rm ./ga/$NEW_VERSION/images.txt.bak; + +if [[ $(( $OLD_SHORT_VERSION % 3 )) -eq 0 ]] + then + : + else + rm -rf ./ga/$OLD_VERSION + fi + +# Finally, comment out "ga/*/*/resources/*" in .gitignore so +# newly created $NEW_VERSION/full/resources and $NEW_VERSION/kernel/resources +# directories can be committed and pushed. +sed -i'.bak' -e "s/ga\/\*\/\*\/resources\/\*/#ga\/\*\/\*\/resources\/\*/g" .gitignore +rm ./.gitignore.bak + +echo "Done performing file updates."; From 5e150419956db0d40e08877cfb88b2de06a32769 Mon Sep 17 00:00:00 2001 From: Wendy Raschke Date: Mon, 30 Oct 2023 12:03:17 -0500 Subject: [PATCH 2/4] Update Travis config file --- update.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/update.sh b/update.sh index faf12f36e..d28fc3360 100644 --- a/update.sh +++ b/update.sh @@ -47,6 +47,11 @@ for file in $(find ./ga/latest ./ga/$NEW_VERSION -name Dockerfile.*); do done +# Update the .travis.yml file. +sed -i'.bak' -e "s/RELEASE=\.\.\/releases\/$OLD_VERSION/RELEASE=\.\.\/releases\/$NEW_VERSION/" ./.travis.yml; +rm ./.travis.yml.bak; + +# Update the images.txt file cp ./ga/$OLD_VERSION/images.txt ./ga/$NEW_VERSION/images.txt; sed -i'.bak' -e "s/$OLD_VERSION/$NEW_VERSION/g" ./ga/$NEW_VERSION/images.txt; rm ./ga/$NEW_VERSION/images.txt.bak; From 69f80478b793e8610c312982f7b335c512a54bd6 Mon Sep 17 00:00:00 2001 From: Wendy Raschke Date: Tue, 31 Oct 2023 10:54:23 -0500 Subject: [PATCH 3/4] Script rename and in subdir --- update.sh => internal/create-new-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename update.sh => internal/create-new-release.sh (97%) diff --git a/update.sh b/internal/create-new-release.sh similarity index 97% rename from update.sh rename to internal/create-new-release.sh index d28fc3360..07dd2d71d 100644 --- a/update.sh +++ b/internal/create-new-release.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo "Hello from the update.sh script!" +echo "Hello from the create-new-release.sh script!" echo $(date) # Set variables to the positional parameters From 76c553665701b0c1752d98f126b4c540f9698de3 Mon Sep 17 00:00:00 2001 From: Wendy Raschke Date: Tue, 31 Oct 2023 12:08:11 -0500 Subject: [PATCH 4/4] Restore location structure of script --- internal/create-new-release.sh => create-new-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename internal/create-new-release.sh => create-new-release.sh (95%) diff --git a/internal/create-new-release.sh b/create-new-release.sh similarity index 95% rename from internal/create-new-release.sh rename to create-new-release.sh index 07dd2d71d..a422c9117 100644 --- a/internal/create-new-release.sh +++ b/create-new-release.sh @@ -48,7 +48,7 @@ for file in $(find ./ga/latest ./ga/$NEW_VERSION -name Dockerfile.*); do done # Update the .travis.yml file. -sed -i'.bak' -e "s/RELEASE=\.\.\/releases\/$OLD_VERSION/RELEASE=\.\.\/releases\/$NEW_VERSION/" ./.travis.yml; +sed -i'.bak' -e "s/RELEASE=\.\.\/ga\/$OLD_VERSION/RELEASE=\.\.\/ga\/$NEW_VERSION/" ./.travis.yml; rm ./.travis.yml.bak; # Update the images.txt file