forked from zalando-incubator/kube-ingress-aws-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delivery.yaml
86 lines (80 loc) · 3.26 KB
/
delivery.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
version: "2017-09-20"
pipeline:
- id: build
vm_config:
type: linux
image: "cdp-runtime/go"
cache:
paths:
- /go/pkg/mod # pkg cache for Go modules
- ~/.cache/go-build # Go build cache
type: script
commands:
- desc: test
cmd: |
make test
- desc: Build docker image
cmd: |
make build.docker
git diff --exit-code || exit 1
- desc: Push docker image
cmd: |
if [ -n "$CDP_PULL_REQUEST_NUMBER" ]; then
IMAGE=registry-write.opensource.zalan.do/teapot/kube-ingress-aws-controller-test
VERSION=$CDP_BUILD_VERSION
IMAGE=$IMAGE VERSION=$VERSION make build.push
# multi-arch image
IMAGE=container-registry-test.zalando.net/teapot/kube-ingress-aws-controller
make build.linux.amd64 build.linux.arm64
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
docker buildx build --rm --build-arg BASE_IMAGE=container-registry.zalando.net/library/static:latest -t "${IMAGE}:${CDP_BUILD_VERSION}" --platform linux/amd64,linux/arm64 --push .
fi
- id: buildprod
when:
branch: master
vm_config:
type: linux
image: "cdp-runtime/go"
type: script
env:
GOFLAGS: "-mod=readonly"
cache:
paths:
- /go/pkg/mod # pkg cache for Go modules
- ~/.cache/go-build # Go build cache
commands:
- desc: create tag and release
cmd: |
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}"
git gh-tag $VERSION
echo "create and push docker container"
IMAGE=registry-write.opensource.zalan.do/teapot/kube-ingress-aws-controller
IMAGE=$IMAGE VERSION=$VERSION make build.docker
git diff --stat --exit-code
IMAGE=$IMAGE VERSION=$VERSION make build.push
# multi-arch image (Zalando private)
VERSION=$VERSION make build.linux.amd64 build.linux.arm64
IMAGE=container-registry-test.zalando.net/teapot/kube-ingress-aws-controller
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
docker buildx build --rm --build-arg BASE_IMAGE=container-registry.zalando.net/library/static:latest -t "${IMAGE}:${VERSION}" --platform linux/amd64,linux/arm64 --push .
cdp-promote-image "${IMAGE}:${VERSION}"
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-ingress-aws-controller:${VERSION} --help" >>$tf
echo -e '```' >>$tf
echo "################################"
cat $tf
echo "################################"
git gh-release --message-from-file "${tf}" $VERSION