From b3e09595b46422ead673531f10e69d35a9d67b61 Mon Sep 17 00:00:00 2001 From: xiaoweim Date: Thu, 30 Jan 2025 19:58:18 +0000 Subject: [PATCH 1/2] improve propose-tag script --- dev/tasks/propose-tag | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dev/tasks/propose-tag b/dev/tasks/propose-tag index c177f27b59..a222194592 100755 --- a/dev/tasks/propose-tag +++ b/dev/tasks/propose-tag @@ -41,6 +41,11 @@ if [[ -z "${VERSION:-}" ]]; then exit 1 fi +if [[ -z "${STALE_VERSION:-}" ]]; then + echo "STALE_VERSION must be set" + exit 1 +fi + # Update our version marker file (used for user agent etc) cat < version/VERSION ${VERSION} @@ -104,4 +109,12 @@ for channeldir in channels autopilot-channels; do done # Generate operator/config/gke-addon/image_configmap.yaml -make -C ${REPO_ROOT}/operator manifests \ No newline at end of file +make -C ${REPO_ROOT}/operator manifests + +# Remove the STALE_VERSION package for standard and autopilot +rm -rf operator/autopilot-channels/packages/configconnector/${STALE_VERSION} +rm -rf operator/channels/packages/configconnector/${STALE_VERSION} + +# Format +GOFLAGS= go run github.com/google/addlicense@04bfe4ee9ca5764577b029acc6a1957fd1997153 -c "Google LLC" -l apache operator/autopilot-channels/packages/configconnector +GOFLAGS= go run github.com/google/addlicense@04bfe4ee9ca5764577b029acc6a1957fd1997153 -c "Google LLC" -l apache operator/channels/packages/configconnector \ No newline at end of file From 17e6a866a9121fe832f433c0c847be96f5f7d1a7 Mon Sep 17 00:00:00 2001 From: xiaoweim Date: Sat, 1 Feb 2025 00:02:48 +0000 Subject: [PATCH 2/2] add script to find the KCC stale version --- dev/tasks/propose-tag | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/dev/tasks/propose-tag b/dev/tasks/propose-tag index a222194592..a11637caa4 100755 --- a/dev/tasks/propose-tag +++ b/dev/tasks/propose-tag @@ -41,11 +41,6 @@ if [[ -z "${VERSION:-}" ]]; then exit 1 fi -if [[ -z "${STALE_VERSION:-}" ]]; then - echo "STALE_VERSION must be set" - exit 1 -fi - # Update our version marker file (used for user agent etc) cat < version/VERSION ${VERSION} @@ -111,10 +106,31 @@ done # Generate operator/config/gke-addon/image_configmap.yaml make -C ${REPO_ROOT}/operator manifests +# find the STALE_VERSION +folder_path="${REPO_ROOT}/operator/channels/packages/configconnector" +if [ ! -d "$folder_path" ]; then + echo "Error: Directory $folder_path does not exist" + exit 1 +fi + +# List all directories in the specified path and store them in an array +versions=($(ls -d "$folder_path"/*/ 2>/dev/null | xargs -n 1 basename)) + +if [ ${#versions[@]} -eq 0 ]; then + echo "Error: No version directories found in $folder_path" + exit 1 +fi + +echo "Found versions:" +printf '%s\n' "${versions[@]}" + +STALE_VERSION=$(printf "%s\n" "${versions[@]}" | sort -V | tail -n 4 | head -n 1) +echo "stale version: ${STALE_VERSION}" + # Remove the STALE_VERSION package for standard and autopilot -rm -rf operator/autopilot-channels/packages/configconnector/${STALE_VERSION} -rm -rf operator/channels/packages/configconnector/${STALE_VERSION} +rm -rf ${REPO_ROOT}/operator/autopilot-channels/packages/configconnector/${STALE_VERSION} +rm -rf ${REPO_ROOT}/operator/channels/packages/configconnector/${STALE_VERSION} # Format -GOFLAGS= go run github.com/google/addlicense@04bfe4ee9ca5764577b029acc6a1957fd1997153 -c "Google LLC" -l apache operator/autopilot-channels/packages/configconnector -GOFLAGS= go run github.com/google/addlicense@04bfe4ee9ca5764577b029acc6a1957fd1997153 -c "Google LLC" -l apache operator/channels/packages/configconnector \ No newline at end of file +GOFLAGS= go run github.com/google/addlicense@04bfe4ee9ca5764577b029acc6a1957fd1997153 -c "Google LLC" -l apache ${REPO_ROOT}/operator/autopilot-channels/packages/configconnector +GOFLAGS= go run github.com/google/addlicense@04bfe4ee9ca5764577b029acc6a1957fd1997153 -c "Google LLC" -l apache ${REPO_ROOT}/operator/channels/packages/configconnector \ No newline at end of file