-
Notifications
You must be signed in to change notification settings - Fork 28
/
delivery.yaml
136 lines (131 loc) · 4.9 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
version: "2017-09-20"
pipeline:
- id: build
vm_config:
type: linux
image: "cdp-runtime/go"
size: large
type: script
env:
GOFLAGS: "-mod=readonly"
cache:
paths:
- /go/pkg/mod # pkg cache for Go modules
- ~/.cache/go-build # Go build cache
commands:
- desc: test
cmd: |
go mod tidy
if ! git diff --quiet go.mod go.sum; then
echo "Running go mod tidy modified go.mod and/or go.sum"
exit 1
fi
make check
make test
- desc: build
cmd: |
make build.docker
- desc: push
cmd: |
IMAGE=registry-write.opensource.zalan.do/teapot/stackset-controller-test
IMAGE=$IMAGE VERSION=$CDP_BUILD_VERSION make build.push
- desc: Build and push image to Zalando's registry
cmd: |
IMAGE=container-registry-test.zalando.net/teapot/stackset-controller
make build.linux.amd64 build.linux.arm64 build/linux/amd64/e2e build/linux/arm64/e2e
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 .
docker buildx build --rm --build-arg BASE_IMAGE=container-registry.zalando.net/library/static:latest -t "${IMAGE}-e2e:${CDP_BUILD_VERSION}" -f Dockerfile.e2e --platform linux/amd64,linux/arm64 --push .
- id: e2e
type: process
desc: "E2E Tests"
target: stups-test
process: microservice_standard_test
config:
apply_manifests:
env:
- name: APPLICATION
value: stackset-controller-test
- name: DEPLOYMENT_PATH
value: e2e
- name: IMAGE
value: "container-registry-test.zalando.net/teapot/stackset-controller:#{CDP_BUILD_VERSION}"
- name: CONTROLLER_ID
value: "#{CDP_BUILD_VERSION}"
- name: CLUSTER_DOMAIN
value: stups-test.zalan.do
- name: CLUSTER_DOMAIN_INTERNAL
value: ingress.cluster.local
end2end_tests:
metadata:
name: e2e
spec:
serviceAccountName: stackset-controller
restartPolicy: Never
containers:
- name: e2e
image: "container-registry-test.zalando.net/teapot/stackset-controller-e2e:#{CDP_BUILD_VERSION}"
args:
- "-test.parallel"
- "64"
env:
- name: "CONTROLLER_ID"
value: "#{CDP_BUILD_VERSION}"
- name: CLUSTER_DOMAIN
value: stups-test.zalan.do
- name: CLUSTER_DOMAIN_INTERNAL
value: ingress.cluster.local
- name: "E2E_NAMESPACE"
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- id: buildprod
when:
branch: master
vm_config:
type: linux
image: "cdp-runtime/go"
size: large
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/stackset-controller
IMAGE=$IMAGE VERSION=$VERSION make build.docker
git diff --stat --exit-code
IMAGE=$IMAGE VERSION=$VERSION make build.push
# Build and push image to Zalando's registry
IMAGE=container-registry-test.zalando.net/teapot/stackset-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}:${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/stackset-controller:${VERSION} --help" >>$tf
echo -e '```' >>$tf
echo "################################"
cat $tf
echo "################################"
git gh-release --message-from-file "${tf}" $VERSION