-
Notifications
You must be signed in to change notification settings - Fork 49
207 lines (175 loc) · 6.77 KB
/
publish_images.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Publish images
on:
workflow_dispatch:
push:
branches:
- master
- main
paths-ignore:
- "*.md"
# Don't build until pg point releases are fixed:
# https://www.postgresql.org/message-id/flat/CABOikdNmVBC1LL6pY26dyxAS2f%2BgLZvTsNt%3D2XbcyG7WxXVBBQ%40mail.gmail.com
#schedule:
# - cron: '0 7 * * 2'
concurrency:
group: publish-ha-images-${{ github.ref }}
cancel-in-progress: true
env:
DOCKER_REPOSITORY: timescale/timescaledb-ha
DOCKER_REGISTRY: docker.io
jobs:
publish:
name: Publish pg${{ matrix.pg_major }}${{ matrix.all }}${{ matrix.oss }} ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ "amd64", "arm64" ]
pg_major: [ "17", "16", "15", "14", "13", "12" ]
all_versions: [ "false", "true" ]
oss_only: [ "false", "true" ]
include:
- oss_only: "true"
oss: "-oss"
- all_versions: "true"
all: "-all"
- platform: amd64
runs_on: ubuntu-22.04
- platform: arm64
runs_on: cloud-image-runner-arm64
runs-on: "${{ matrix.runs_on }}"
steps:
# The github runners have a lot of space in /mnt, but apparently not enough in /. This step removes about 13G.
- name: remove unneeded runner software
run: |
df -h
du -chs /usr/share/dotnet /usr/local/lib/android /opt/microsoft || true
sudo rm -fr /usr/share/dotnet /usr/local/lib/android /opt/microsoft || true
sudo docker image prune --all --force || true
df -h
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.ORG_DOCKER_HUB_USERNAME }}
password: ${{ secrets.ORG_DOCKER_HUB_ACCESS_TOKEN }}
- name: Setup | Docker Context
run: if ! docker context use ha-builder; then docker context create ha-builder; fi
- name: Setup | Buildx
uses: docker/setup-buildx-action@v3
with:
endpoint: ha-builder
- name: Build and publish (pg${{ matrix.pg_major }}${{ matrix.all }}${{ matrix.oss }} ${{ matrix.platform }})
id: build
env:
PLATFORM: ${{ matrix.platform }}
PG_MAJOR: ${{ matrix.pg_major }}
ALL_VERSIONS: ${{ matrix.all_versions }}
OSS_ONLY: ${{ matrix.oss_only }}
run: |
GIT_REV="${GITHUB_REF#refs/tags/}" make publish-builder publish-release
- name: export outputs
run: |
mkdir -p /tmp/outputs
builder_id="${{ steps.build.outputs.builder_id }}"
release_id="${{ steps.build.outputs.release_id }}"
touch "/tmp/outputs/builder-$(echo "$builder_id" | cut -d: -f2)"
touch "/tmp/outputs/release-$(echo "$release_id" | cut -d: -f2)"
- name: upload outputs
uses: actions/upload-artifact@v4
with:
name: outputs-${{ matrix.pg_major }}-${{ matrix.all_versions }}-${{ matrix.oss_only }}-${{ matrix.platform }}
path: /tmp/outputs/*
if-no-files-found: error
retention-days: 1
publish-combined-manifests:
name: Publish manifest pg${{ matrix.pg_major }}${{ matrix.docker_tag_postfix }}
needs: [ "publish" ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pg_major: [ "17", "16", "15", "14", "13", "12" ]
docker_tag_postfix: ["", "-all", "-oss", "-all-oss" ]
include:
- docker_tag_postfix: ""
oss_only: "false"
all_versions: "false"
- docker_tag_postfix: "-all"
oss_only: "false"
all_versions: "true"
- docker_tag_postfix: "-oss"
oss_only: "true"
all_versions: "false"
- docker_tag_postfix: "-all-oss"
oss_only: "true"
all_versions: "true"
steps:
- name: Download arm64 outputs
uses: actions/download-artifact@v4
with:
name: outputs-${{ matrix.pg_major }}-${{ matrix.all_versions }}-${{ matrix.oss_only }}-arm64
path: /tmp/outputs
pattern: '*'
merge-multiple: true
- name: Download amd64 outputs
uses: actions/download-artifact@v4
with:
name: outputs-${{ matrix.pg_major }}-${{ matrix.all_versions }}-${{ matrix.oss_only }}-amd64
path: /tmp/outputs
pattern: '*'
merge-multiple: true
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.ORG_DOCKER_HUB_USERNAME }}
password: ${{ secrets.ORG_DOCKER_HUB_ACCESS_TOKEN }}
# QEMU for multiplatform, which should be quick enough for pulling version information out of the images
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Publish combined manifest for pg${{ matrix.pg_major }}${{ matrix.docker_tag_postfix }}
env:
PG_MAJOR: ${{ matrix.pg_major }}
VERSION_TAG: pg${{ matrix.pg_major}}${{ matrix.docker_tag_postfix }}-builder
DOCKER_TAG_POSTFIX: ${{ matrix.docker_tag_postfix }}
run: make publish-manifests
check:
name: Check image pg${{ matrix.pg_major }}${{ matrix.docker_tag_postfix }}
needs: [ "publish", "publish-combined-manifests" ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pg_major: [ "17", "16", "15", "14", "13", "12" ]
docker_tag_postfix: ["", "-all", "-oss", "-all-oss" ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.ORG_DOCKER_HUB_USERNAME }}
password: ${{ secrets.ORG_DOCKER_HUB_ACCESS_TOKEN }}
# QEMU for multiplatform, which should be quick enough for just the checks
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Check pg${{ matrix.pg_major }}${{ matrix.docker_tag_postfix }}
env:
PG_MAJOR: ${{ matrix.pg_major }}
DOCKER_TAG_POSTFIX: ${{ matrix.docker_tag_postfix }}
run: make get-image-config check
dispatch-ha-image-published-event:
name: Dispatch HA image published event
needs: [ "check" ]
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Dispatch event to Publish cloud images workflow
run: |
curl -H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${{ secrets.ORG_AUTOMATION_TOKEN }}" \
--request POST \
--data '{"event_type": "ha_image_published"}' \
https://api.github.com/repos/timescale/timescaledb-docker-cloud/dispatches