From a6601fb349049e47a6a73624b470a54747f32f4b Mon Sep 17 00:00:00 2001 From: Arvind Iyengar Date: Mon, 7 Mar 2022 11:33:22 -0800 Subject: [PATCH] Add forward-port script --- Makefile | 3 +++ scripts/forward-port | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 scripts/forward-port diff --git a/Makefile b/Makefile index b53ef5717..04d29225d 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ pull-scripts: remove: ./scripts/remove-asset +forward-port: + ./scripts/forward-port + TARGETS := prepare patch clean clean-cache charts list index unzip zip standardize validate template $(TARGETS): diff --git a/scripts/forward-port b/scripts/forward-port new file mode 100755 index 000000000..673984cc2 --- /dev/null +++ b/scripts/forward-port @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +cd $(dirname $0) +cd .. + +if [ -n "$(git status --porcelain)" ]; then + echo "Git needs to be clean to run this script" + exit 1 +fi + +if [[ -z ${CHART} ]] || [[ -z ${VERSION} ]] || [[ -z ${UPSTREAM} ]] || [[ -z ${BRANCH} ]]; then + echo "Usage: CHART= VERSION= UPSTREAM= BRANCH= make forward-port" + exit 1 +fi + +if [[ -d charts/${CHART}/${VERSION} ]] && [[ -f assets/${CHART}/${CHART}-${VERSION}.tgz ]]; then + rm -rf charts/${CHART}/${VERSION} + rm -rf assets/${CHART}/${CHART}-${VERSION}.tgz +fi + +git fetch ${UPSTREAM} ${BRANCH} +if ! git cat-file -e ${UPSTREAM}/${BRANCH}:assets/${CHART}/${CHART}-${VERSION}.tgz; then + exit 1 +fi +git checkout ${UPSTREAM}/${BRANCH} -- assets/${CHART}/${CHART}-${VERSION}.tgz 2>&1 1>/dev/null +git reset HEAD 2>&1 1>/dev/null +ASSET=${CHART}/${CHART}-${VERSION}.tgz make unzip + +touch release.yaml +yq e -i ".${CHART} = ((.${CHART} + [\"${VERSION}\"]) | unique)" release.yaml + +make index