diff --git a/hack/release-scripts/generate-release b/hack/release-scripts/generate-release-pr similarity index 79% rename from hack/release-scripts/generate-release rename to hack/release-scripts/generate-release-pr index 78dfeead8..6c2f32757 100755 --- a/hack/release-scripts/generate-release +++ b/hack/release-scripts/generate-release-pr @@ -1,8 +1,6 @@ #!/bin/bash # This script generates (most of) the file changes needed for a new aws-ebs-csi-driver release -tmp_filename="tmp-$RANDOM.txt" # TODO Needed? - # --- Script Tools set -euo pipefail # Exit on any error @@ -19,6 +17,16 @@ check_dependencies() { exit 1 fi done + + # Force macOS users to use gsed due to -i incompatibility + export SED="sed" + if [[ $(uname) = "Darwin" ]]; then + if ! command -v "gsed" &>/dev/null; then + log "gsed could not be found, please install it." + exit 1 + fi + SED="gsed" + fi } error_handler() { @@ -29,8 +37,6 @@ error_handler() { trap 'error_handler ${LINENO} $? "$BASH_COMMAND"' ERR # --- Script -# trap 'rm $tmp_filename' EXIT TODO ? - usage () { echo "Usage: $0 [NEW_DRIVER_VERSION] [optional-cmd]" echo "example: $0 v1.24.0" @@ -66,9 +72,6 @@ parse_args () { [[ $# -ne 1 ]] && usage setup_vars "$@" - - # Confirm sure new version isn't same as current version - [[ "$NEW_DRIVER_VERSION" == "$PREV_DRIVER_VERSION" ]] || log "ERROR: $NEW_DRIVER_VERSION is the existing driver version" } update_driver_source_of_truth () { @@ -90,15 +93,14 @@ update_readme () { update_makefile () { log "Updating Makefile" - # TODO figure out how to standardize GNU and BSD sed? Always redirect into tmp file? - gsed "s/VERSION?=$PREV_DRIVER_VERSION/VERSION?=$NEW_DRIVER_VERSION/g" "$MAKEFILE_PATH" + $SED "s/VERSION?=$PREV_DRIVER_VERSION/VERSION?=$NEW_DRIVER_VERSION/g" -i "$MAKEFILE_PATH" } update_installmd () { log "Updating docs/install.md" prev_major_minor_version=$(echo "$PREV_DRIVER_VERSION" | sed 's/v\([0-9]*\.[0-9]*\).*/\1/') new_major_minor_version=$(echo "$NEW_DRIVER_VERSION" | sed 's/v\([0-9]*\.[0-9]*\).*/\1/') - gsed "s/?ref=release-$prev_major_minor_version/?ref=release-$new_major_minor_version/g" "$INSTALL_MD_PATH" + $SED "s/?ref=release-$prev_major_minor_version/?ref=release-$new_major_minor_version/g" -i "$INSTALL_MD_PATH" } update_chart_and_overlays () { @@ -106,10 +108,9 @@ update_chart_and_overlays () { prev_minor_patch_version=$(echo "$PREV_DRIVER_VERSION" | sed 's/v[0-9]*\.//') new_minor_patch_version=$(echo "$NEW_DRIVER_VERSION" | sed 's/v[0-9]*\.//') - gsed "s/$prev_minor_patch_version$/$new_minor_patch_version/g" "$CHART_PATH" + $SED "s/$prev_minor_patch_version$/$new_minor_patch_version/g" -i "$CHART_PATH" - (cd "$ROOT_DIRECTORY"; make generate-kustomize) > tmp.f # TODO look up proper null print - rm tmp.f + (cd "$ROOT_DIRECTORY"; make generate-kustomize) > "/dev/null" } update_upstream_repo () { @@ -122,14 +123,15 @@ update_upstream_repo () { print_rest_of_release_steps () { echo "SUCCESS! Before you submit the release PR, you must also: - 1. Update CHANGELOG.md - 2. Update charts/aws-ebs-csi-driver/CHANGELOG.md" + 1. Check that 'git diff' produces what you expected. + 2. Update CHANGELOG.md + 3. Update charts/aws-ebs-csi-driver/CHANGELOG.md" } main () { check_dependencies parse_args "$@" - # update_driver_source_of_truth TODO test + update_driver_source_of_truth # Post-release PR except changelogs update_upstream_repo diff --git a/hack/release-scripts/image-source-of-truth.yaml b/hack/release-scripts/image-source-of-truth.yaml index 9ba68e185..2099b0053 100644 --- a/hack/release-scripts/image-source-of-truth.yaml +++ b/hack/release-scripts/image-source-of-truth.yaml @@ -4,7 +4,7 @@ driver: name: "aws-ebs-csi-driver" version: "v1.24.0" gcrStagingImage: "gcr.io/k8s-staging-provider-aws/aws-ebs-csi-driver" - manifestDigest: "" + manifestDigest: "sha256:3dba81d0c3c8ce51abeda40ec0dbad7e4930a89c8c6a1984a64bf67caa46a3ae" gcrImage: "registry.k8s.io/provider-aws/aws-ebs-csi-driver" ecrImage: "public.ecr.aws/ebs-csi-driver/aws-ebs-csi-driver" sidecars: # sidecar names match upstream helm chart values.yaml