mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2024-12-22 11:06:04 +00:00
7a0c251972
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
54 lines
2.0 KiB
YAML
54 lines
2.0 KiB
YAML
version: "2017-09-20"
|
|
pipeline:
|
|
- id: build
|
|
overlay: ci/golang
|
|
cache:
|
|
paths:
|
|
- /go/pkg/mod # pkg cache for Go modules
|
|
- ~/.cache/go-build # Go build cache
|
|
type: script
|
|
env:
|
|
GOFLAGS: "-mod=readonly"
|
|
commands:
|
|
- desc: test
|
|
cmd: |
|
|
make test
|
|
- desc: build
|
|
cmd: |
|
|
make build.docker
|
|
- desc: push
|
|
cmd: |
|
|
if [[ $CDP_TARGET_BRANCH == master && ! $CDP_PULL_REQUEST_NUMBER ]]; then
|
|
IMAGE=registry-write.opensource.zalan.do/teapot/kube-metrics-adapter
|
|
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
|
|
fi
|
|
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
|