From caafd16b2df4432b66406819ea34b1b02caa468e Mon Sep 17 00:00:00 2001 From: Steven Crespo Date: Wed, 15 Mar 2023 15:27:06 -0700 Subject: [PATCH] Fix release validation scripts --- scripts/release-validation/diff-with-released.sh | 10 +++++++--- scripts/release-validation/validate-annotations.sh | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/release-validation/diff-with-released.sh b/scripts/release-validation/diff-with-released.sh index d4a51a423..b314bff7a 100755 --- a/scripts/release-validation/diff-with-released.sh +++ b/scripts/release-validation/diff-with-released.sh @@ -7,8 +7,8 @@ OLD_CHART_DIR=$ROOT_DIR/charts NEW_CHART_DIR=$ROOT_DIR/to-be-released git fetch ${UPSTREAM_REMOTE} -cp -a $OLD_CHART_DIR $NEW_CHART_DIR -git checkout ${UPSTREAM_REMOTE}/${UPSTREAM_BRANCH} -- charts +mv $OLD_CHART_DIR $NEW_CHART_DIR +git checkout ${UPSTREAM_REMOTE}/${UPSTREAM_BRANCH} -- $OLD_CHART_DIR rm -rf diffs_in_latest_version mkdir -p diffs_in_latest_version @@ -28,5 +28,9 @@ for chart in $(echo $(ls ${OLD_CHART_DIR}) $(ls ${NEW_CHART_DIR}) | tr " " "\n" prior_chart_version=$(ls ${OLD_CHART_DIR}/${chart} | sort -Vr | head -n 1) diff -uNr ${OLD_CHART_DIR}/${chart}/${prior_chart_version} ${NEW_CHART_DIR}/${chart}/${latest_chart_version} > diffs_in_latest_version/${chart}/${prior_chart_version}-to-${latest_chart_version}.diff - rm -rf $NEW_CHART_DIR done + +if [[ -d $NEW_CHART_DIR ]]; then + rm -rf $NEW_CHART_DIR + git checkout HEAD -- $OLD_CHART_DIR +fi diff --git a/scripts/release-validation/validate-annotations.sh b/scripts/release-validation/validate-annotations.sh index 1e869ec52..d9f032c8e 100755 --- a/scripts/release-validation/validate-annotations.sh +++ b/scripts/release-validation/validate-annotations.sh @@ -34,7 +34,7 @@ for asset in $(find $ASSETS_DIR -mindepth 2 -maxdepth 2 -name "*.tgz" | sort | x chartname=$(echo ${chart#"$ROOT_DIR/"} | cut -d'/' -f2) chartversion=$(basename ${chart}) exists_in_25=$(yq e ".entries.*.[] | select(.name == \"${chartname}\" and .version == \"${chartversion}\")" <(git show ${UPSTREAM_REMOTE}/${OLD_UPSTREAM_BRANCH}:${INDEX_PATH})) - echo $exists_in_25 + if [[ -n ${exists_in_25} ]]; then echo "Skipping checking annotation on forward-ported chart ${chart}" continue