forked from zalando/spilo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delivery.yaml
117 lines (102 loc) · 3.95 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
version: "2017-09-20"
allow_concurrent_steps: true
build_env: &BUILD_ENV
BASE_IMAGE: container-registry.zalando.net/library/ubuntu-22.04
PGVERSION: 17
MULTI_ARCH_REGISTRY: container-registry-test.zalando.net/acid
pipeline:
- id: push-spilo-cdp-pr
env:
<<: *BUILD_ENV
type: script
requires_human_approval: true
when:
- event: pull_request
timeout: 10h
vm_config:
type: linux
size: large
commands:
- desc: Tag and push spilo-cdp image without promotion
cmd: |
cd postgres-appliance
PATRONIVERSION=$(sed -n 's/^ENV PATRONIVERSION=\([1-9][0-9]*\.[0-9]*\).*$/\1/p' Dockerfile)
ECR_TEST_IMAGE="$MULTI_ARCH_REGISTRY/spilo-cdp-pr$CDP_PULL_REQUEST_NUMBER-$PGVERSION:$PATRONIVERSION-p$CDP_PULL_REQUEST_COUNTER"
# create a Buildkit builder with CDP specific configuration
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
# single platform build for PR images!
docker buildx build --platform "linux/amd64" \
--build-arg PGVERSION="$PGVERSION" \
--build-arg BASE_IMAGE="$BASE_IMAGE" \
--build-arg PGOLDVERSIONS="14 15 16" \
--build-arg TIMESCALEDB="2.17.2" \
-t "$ECR_TEST_IMAGE" \
--push .
- id: push-spilo-cdp
env:
<<: *BUILD_ENV
type: script
when:
- event: push
branch: trigger
timeout: 10h
vm_config:
type: linux
size: extra_large
commands:
- desc: Tag and push spilo-cdp image
cmd: |
cd postgres-appliance
PATRONIVERSION=$(sed -n 's/^ENV PATRONIVERSION=\([1-9][0-9]*\.[0-9]*\).*$/\1/p' Dockerfile)
ECR_TEST_IMAGE="$MULTI_ARCH_REGISTRY/spilo-cdp-$PGVERSION:trigger-$PATRONIVERSION-p$CDP_TARGET_BRANCH_COUNTER"
# create a Buildkit builder with CDP specific configuration
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
docker buildx build --platform "linux/amd64,linux/arm64" \
--build-arg PGVERSION="$PGVERSION" \
--build-arg BASE_IMAGE="$BASE_IMAGE" \
--build-arg PGOLDVERSIONS="14 15 16" \
--build-arg TIMESCALEDB="2.17.2" \
-t "$ECR_TEST_IMAGE" \
--push .
cdp-promote-image "$ECR_TEST_IMAGE"
- id: push-spilo-cdp-master
env:
<<: *BUILD_ENV
type: script
requires_human_approval: true
when:
- event: push
branch: master
timeout: 10h
vm_config:
type: linux
size: extra_large
commands:
- desc: Tag and push spilo-cdp image to ecr
cmd: |
cd postgres-appliance
PATRONIVERSION=$(sed -n 's/^ENV PATRONIVERSION=\([1-9][0-9]*\.[0-9]*\).*$/\1/p' Dockerfile)
ECR_TEST_IMAGE="$MULTI_ARCH_REGISTRY/spilo-cdp-$PGVERSION:$PATRONIVERSION-p$CDP_TARGET_BRANCH_COUNTER"
# create a Buildkit builder with CDP specific configuration
docker buildx create --config /etc/cdp-buildkitd.toml --driver-opt network=host --bootstrap --use
docker buildx build --platform "linux/amd64,linux/arm64" \
--build-arg PGVERSION="$PGVERSION" \
--build-arg BASE_IMAGE="$BASE_IMAGE" \
--build-arg PGOLDVERSIONS="14 15 16" \
--build-arg TIMESCALEDB="2.17.2" \
-t "$ECR_TEST_IMAGE" \
--push .
cdp-promote-image "$ECR_TEST_IMAGE"
- id: tag-spilo
type: script
requires_human_approval: true
when:
event: push
branch: master
commands:
- desc: Tag release spilo image
cmd: |
PATRONIVERSION=$(sed -n 's/^ENV PATRONIVERSION=\([1-9][0-9]*\.[0-9]*\).*$/\1/p' postgres-appliance/Dockerfile)
COUNTER=$(git tag | sed -n "s/^$PATRONIVERSION-p//p" | sort -un | tail -n1)
TAG="$PATRONIVERSION-p$((COUNTER+1))"
git gh-tag "$TAG"