automate release of all merge to master similar to stackset-controller

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
This commit is contained in:
Sandor Szücs 2021-01-21 17:00:23 +01:00
parent ca20ef3a3b
commit 7a0c251972
No known key found for this signature in database
GPG Key ID: 2D7B996673E41107

View File

@ -20,7 +20,15 @@ pipeline:
cmd: |
if [[ $CDP_TARGET_BRANCH == master && ! $CDP_PULL_REQUEST_NUMBER ]]; then
IMAGE=registry-write.opensource.zalan.do/teapot/kube-metrics-adapter
VERSION=$(git describe --tags --always)
LATEST_VERSION=$(git describe --tags --always | awk -F \- '{print $1}')
CUR_PART=$(echo $LATEST_VERSION | awk -F . '{print $1"."$2}')
VERSION_PART=$(cat VERSION)
OLD_PATCH=$(echo $LATEST_VERSION | awk -F . '{print $3}')
NEW_PATCH=$((OLD_PATCH + 1))
if [ "$CUR_PART" != "$VERSION_PART" ]; then NEW_PATCH=0; fi
VERSION=${VERSION_PART}.${NEW_PATCH}
echo "Creating release for tag: ${VERSION}"
else
IMAGE=registry-write.opensource.zalan.do/teapot/kube-metrics-adapter-test
VERSION=$CDP_BUILD_VERSION
@ -28,3 +36,18 @@ pipeline:
IMAGE=$IMAGE VERSION=$VERSION make build.docker
git diff --stat --exit-code
IMAGE=$IMAGE VERSION=$VERSION make build.push
if [[ $CDP_TARGET_BRANCH == master && ! $CDP_PULL_REQUEST_NUMBER ]]; then
echo "create release page"
tf=$(mktemp)
echo -e "### Changes\n" >$tf
git log -1 --pretty=%B | grep -v 'Signed-off-by:' | grep -v -E '^\s*$' | grep -vE '^\*' >>$tf
echo -e "\n### Docker image\n" >>$tf
echo -e "Docker image is available in Zalando's Open Source registry:\n" >>$tf
echo -e '```' >>$tf
echo -e "docker run -it registry.opensource.zalan.do/teapot/kube-metrics-adapter:${VERSION} --help" >>$tf
echo -e '```' >>$tf
echo "################################"
cat $tf
echo "################################"
git gh-release --message-from-file "${tf}" $VERSION
fi