Add forward-port script

pull/1788/head
Arvind Iyengar 2022-03-07 11:33:22 -08:00
parent 28882bb3a3
commit a6601fb349
No known key found for this signature in database
GPG Key ID: A8DD9BFD6C811498
2 changed files with 37 additions and 0 deletions

View File

@ -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):

34
scripts/forward-port Executable file
View File

@ -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=<chart> VERSION=<version> UPSTREAM=<git-remote> BRANCH=<git-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