-
Notifications
You must be signed in to change notification settings - Fork 351
/
delivery.yaml
119 lines (107 loc) · 4.29 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
version: "2017-09-20"
allow_concurrent_steps: true
pipeline:
- id: vulncheck and capslock
depends_on: []
vm_config:
type: linux
image: "cdp-runtime/go"
type: script
when:
branch: master
event: push
commands:
- desc: Vulnerability & capability check
cmd: |
make deps govulncheck capslock
- id: build
depends_on: []
vm_config:
type: linux
image: "cdp-runtime/go"
type: script
commands:
- desc: Setup BuildKit
cmd: |
# create a Buildkit builder with CDP specific configuration (https://cloud.docs.zalando.net/howtos/cdp-multiarch/)
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
- desc: build-push
cmd: |
set -eo pipefail
IMAGE_REGISTRY="registry-write.opensource.zalan.do"
MULTIARCH_REGISTRY="container-registry-test.zalando.net"
if [[ $CDP_TARGET_BRANCH == master && ! $CDP_PULL_REQUEST_NUMBER ]]; then
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
RELEASE_VERSION=${VERSION_PART}.${NEW_PATCH}
export VERSION="${RELEASE_VERSION}"
IMAGE="${IMAGE_REGISTRY}/teapot/skipper:${RELEASE_VERSION}"
MULTIARCH_IMAGE="${MULTIARCH_REGISTRY}/teapot/skipper:${RELEASE_VERSION}"
else
IMAGE="${IMAGE_REGISTRY}/teapot/skipper-test:${CDP_BUILD_VERSION}"
MULTIARCH_IMAGE="${MULTIARCH_REGISTRY}/teapot/skipper-test:${CDP_BUILD_VERSION}"
fi
export IMAGE MULTIARCH_IMAGE
export TESTCONTAINERS_RYUK_DISABLED=true
make deps check-fmt vet staticcheck shortcheck
if [[ $CDP_TARGET_BRANCH == master && ! $CDP_PULL_REQUEST_NUMBER ]]; then
echo "Creating git tag: ${RELEASE_VERSION}"
git gh-tag "${RELEASE_VERSION}"
fi
git status
git diff
cd packaging
make docker.build.amd64 && git status && git diff && make docker.push.amd64 && make docker.push.multiarch
if [[ $CDP_TARGET_BRANCH == master && ! $CDP_PULL_REQUEST_NUMBER ]]; then
echo "Created docker image registry.opensource.zalan.do/teapot/skipper:${RELEASE_VERSION}"
cdp-promote-image "${MULTIARCH_IMAGE}"
echo "Created multi-arch docker image container-registry.zalando.net/teapot/skipper:${RELEASE_VERSION}"
echo "Creating release for tag: ${RELEASE_VERSION}"
make build.package
files=(-u sha256sum.txt)
for f in *.tar.gz *.zip; do files+=(-u "$f"); done
echo "create release page"
tf=$(mktemp)
echo -e "### Changes\n" >$tf
git log -1 --pretty=%B | grep -v -F 'Signed-off-by:' | grep -v -F 'Co-authored-by:' >>$tf
echo -e "\n### Multiarch Docker image\n" >>$tf
echo -e "Multiarch Docker image is available in Github's docker registry:\n" >>$tf
echo -e '```' >>$tf
echo -e "docker run -it ghcr.io/zalando/skipper:${RELEASE_VERSION} skipper --help" >>$tf
echo -e '```' >>$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/skipper:${RELEASE_VERSION} skipper --help" >>$tf
echo -e '```' >>$tf
echo "################################"
cat $tf
echo "################################"
git gh-release --message-from-file "${tf}" "${files[@]}" "$RELEASE_VERSION"
else
echo "Created docker image registry.opensource.zalan.do/teapot/skipper-test:${CDP_BUILD_VERSION}"
echo "Created multi-arch docker image container-registry-test.zalando.net/teapot/skipper-test:${CDP_BUILD_VERSION}"
echo "Not creating a release. No release version defined."
fi
- id: docs
depends_on: [build]
type: script
vm_config:
type: linux
image: cdp-runtime/mkdocs-v9
size: small
commands:
- desc: install deps
cmd: |
pipx inject mkdocs-material markdown-include
- desc: build docs
cmd: |
build-docs
artifacts:
- type: docs
name: skipper
path: site