forked from zalando/skipper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delivery.yaml
131 lines (117 loc) · 5.23 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
version: "2017-09-20"
allow_concurrent_steps: true
pipeline:
- id: vulncheck
depends_on: []
vm_config:
type: linux
image: "cdp-runtime/go"
type: script
when:
branch: master
event: push
commands:
- desc: vuln-check
cmd: |
make deps govulncheck
- 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}"
ARM_IMAGE="${IMAGE_REGISTRY}/teapot/skipper-armv7:${RELEASE_VERSION}"
ARM64_IMAGE="${IMAGE_REGISTRY}/teapot/skipper-arm64:${RELEASE_VERSION}"
MULTIARCH_IMAGE="${MULTIARCH_REGISTRY}/teapot/skipper:${RELEASE_VERSION}"
else
IMAGE="${IMAGE_REGISTRY}/teapot/skipper-test:${CDP_BUILD_VERSION}"
ARM_IMAGE="${IMAGE_REGISTRY}/teapot/skipper-armv7-test:${CDP_BUILD_VERSION}"
ARM64_IMAGE="${IMAGE_REGISTRY}/teapot/skipper-arm64-test:${CDP_BUILD_VERSION}"
MULTIARCH_IMAGE="${MULTIARCH_REGISTRY}/teapot/skipper-test:${CDP_BUILD_VERSION}"
fi
export IMAGE ARM_IMAGE ARM64_IMAGE MULTIARCH_IMAGE
make deps cicheck staticcheck gosec
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 docker image registry.opensource.zalan.do/teapot/skipper-arm64:${RELEASE_VERSION}"
make docker.build.arm64 && git status && git diff && make docker.push.arm64
echo "Creating docker image registry.opensource.zalan.do/teapot/skipper-armv7:${RELEASE_VERSION}"
make docker.build.armv7 && git status && git diff && make docker.push.armv7
echo "Creating release for tag: ${RELEASE_VERSION}"
make build.package
files=(-u sha256sum.txt); for f in *.tar.gz; do files+=(-u "$f"); done
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/skipper:${RELEASE_VERSION} skipper --help" >>$tf
echo -e "# arm64" >>$tf
echo -e "docker run -it registry.opensource.zalan.do/teapot/skipper-arm64:${RELEASE_VERSION} skipper --help" >>$tf
echo -e "# arm v7 32bit" >>$tf
echo -e "docker run -it registry.opensource.zalan.do/teapot/skipper-armv7:${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
overlay: ci/python
commands:
- desc: install deps
cmd: |
pip3 install mkdocs mkdocs-material markdown-include
- desc: build docs
cmd: |
mkdocs build --strict
shopt -s extglob # needed to use !(pr)
if [ "$CDP_PULL_REQUEST_NUMBER" ]; then
mkdir -p site/pr/#{CDP_PULL_REQUEST_NUMBER}
mv site/!(pr) site/pr/#{CDP_PULL_REQUEST_NUMBER}
fi
if [[ $CDP_TARGET_BRANCH == master && ! $CDP_PULL_REQUEST_NUMBER ]]; then
echo "Please update the docs with: mkdocs gh-deploy"
fi
artifacts:
- type: docs
name: skipper
path: site