forked from SeldonIO/MLServer
-
Notifications
You must be signed in to change notification settings - Fork 0
248 lines (245 loc) · 8.93 KB
/
release.yml
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "MLServer Version to Release"
required: true
jobs:
draft-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update Version
run: |
./hack/update-version.sh ${{ github.event.inputs.version }}
- name: Commiting & Pushing Updated Version Tag
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Bump version to ${{ github.event.inputs.version }}
tagging_message: ${{ github.event.inputs.version }}
- name: Draft Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
draft: true
tag_name: ${{ github.event.inputs.version }}
mlserver:
needs: draft-release
runs-on: ubuntu-latest
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
remove-dotnet: "true"
remove-haskell: "true"
remove-android: "true"
root-reserve-mb: "30720"
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.version }}
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Build Python wheel
run: |
poetry build
poetry publish --skip-existing
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.TWINE_USERNAME }}
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
- name: Build Docker Image
run: |
DOCKER_BUILDKIT=1 docker build . \
--build-arg RUNTIMES="" \
-t $MLSERVER_IMAGE-slim
DOCKER_BUILDKIT=1 docker build . \
--build-arg RUNTIMES=all \
-t $MLSERVER_IMAGE
env:
MLSERVER_IMAGE: seldonio/mlserver:${{ github.event.inputs.version }}
- name: Scan Docker Image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/mlserver:${{ github.event.inputs.version }}
args: --fail-on=upgradable
--app-vulns
--severity-threshold=high
--file=Dockerfile
--policy-path=.snyk
- name: Scan Docker Slim Image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/mlserver:${{ github.event.inputs.version }}-slim
args: --fail-on=upgradable
--app-vulns
--severity-threshold=high
--file=Dockerfile
--policy-path=.snyk
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to DockerHub
run: |
docker push $MLSERVER_IMAGE-slim
docker push $MLSERVER_IMAGE
env:
MLSERVER_IMAGE: seldonio/mlserver:${{ github.event.inputs.version }}
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Push to Quay.io
run: |
docker tag $MLSERVER_IMAGE-slim $QUAY_MLSERVER_IMAGE-slim
docker push $QUAY_MLSERVER_IMAGE-slim
docker tag $MLSERVER_IMAGE $QUAY_MLSERVER_IMAGE
docker push $QUAY_MLSERVER_IMAGE
env:
MLSERVER_IMAGE: seldonio/mlserver:${{ github.event.inputs.version }}
QUAY_MLSERVER_IMAGE: quay.io/redhat-isv-containers/63566bb9822ce8cef9ba27fc:${{ github.event.inputs.version }}
- name: Install preflight
run: |
wget https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/$PREFLIGHT_VERSION/preflight-linux-amd64
chmod u+x preflight-linux-amd64
sudo mv preflight-linux-amd64 /usr/local/bin/preflight
preflight --version
env:
PREFLIGHT_VERSION: 1.4.2
- name: Submit preflight results
run: |
preflight check container \
$QUAY_MLSERVER_IMAGE-slim \
--docker-config=${HOME}/.docker/config.json \
--certification-project-id=$PROJECT_ID \
--pyxis-api-token=$PYXIS_API_TOKEN \
--artifacts ./artifacts/mlserver \
--submit
preflight check container \
$QUAY_MLSERVER_IMAGE \
--docker-config=${HOME}/.docker/config.json \
--certification-project-id=$PROJECT_ID \
--pyxis-api-token=$PYXIS_API_TOKEN \
--artifacts ./artifacts/mlserver-slim \
--submit
env:
PYXIS_API_TOKEN: ${{ secrets.PYXIS_API_TOKEN }}
PROJECT_ID: 63566bb9822ce8cef9ba27fc
QUAY_MLSERVER_IMAGE: quay.io/redhat-isv-containers/63566bb9822ce8cef9ba27fc:${{ github.event.inputs.version }}
runtimes:
needs: draft-release
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runtime:
- alibi-detect
- alibi-explain
- huggingface
- lightgbm
- mlflow
- mllib
- sklearn
- xgboost
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
remove-dotnet: "true"
remove-haskell: "true"
remove-android: "true"
root-reserve-mb: "30720"
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.version }}
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Build Python wheel
working-directory: ./runtimes/${{ matrix.runtime }}
run: |
poetry build
poetry publish --skip-existing
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.TWINE_USERNAME }}
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
- name: Build Docker Image
run: |
DOCKER_BUILDKIT=1 docker build . \
--build-arg RUNTIMES=mlserver-${{ matrix.runtime }} \
-t $RUNTIME_IMAGE
env:
RUNTIME_IMAGE: seldonio/mlserver:${{ github.event.inputs.version }}-${{ matrix.runtime }}
- name: Scan Docker Image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/mlserver:${{ github.event.inputs.version }}-${{ matrix.runtime }}
args: --fail-on=upgradable
--app-vulns
--severity-threshold=high
--file=Dockerfile
--policy-path=.snyk
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to DockerHub
run: |
docker push $RUNTIME_IMAGE
env:
RUNTIME_IMAGE: seldonio/mlserver:${{ github.event.inputs.version }}-${{ matrix.runtime }}
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Push to Quay.io
run: |
docker tag $RUNTIME_IMAGE $QUAY_RUNTIME_IMAGE
docker push $QUAY_RUNTIME_IMAGE
env:
RUNTIME_IMAGE: seldonio/mlserver:${{ github.event.inputs.version }}-${{ matrix.runtime }}
QUAY_RUNTIME_IMAGE: quay.io/redhat-isv-containers/63566bb9822ce8cef9ba27fc:${{ github.event.inputs.version }}-${{ matrix.runtime }}
- name: Install preflight
run: |
wget https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/$PREFLIGHT_VERSION/preflight-linux-amd64
chmod u+x preflight-linux-amd64
sudo mv preflight-linux-amd64 /usr/local/bin/preflight
preflight --version
env:
PREFLIGHT_VERSION: 1.4.2
- name: Submit preflight results
run: |
preflight check container \
$QUAY_RUNTIME_IMAGE \
--docker-config=${HOME}/.docker/config.json \
--certification-project-id=$PROJECT_ID \
--pyxis-api-token=$PYXIS_API_TOKEN \
--artifacts ./artifacts/mlserver-${{ matrix.runtime }} \
--submit
env:
PYXIS_API_TOKEN: ${{ secrets.PYXIS_API_TOKEN }}
PROJECT_ID: 63566bb9822ce8cef9ba27fc
QUAY_RUNTIME_IMAGE: quay.io/redhat-isv-containers/63566bb9822ce8cef9ba27fc:${{ github.event.inputs.version }}-${{ matrix.runtime }}