forked from lf-edge/eve
-
Notifications
You must be signed in to change notification settings - Fork 0
256 lines (249 loc) · 8.92 KB
/
publish.yml
File metadata and controls
256 lines (249 loc) · 8.92 KB
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
249
250
251
252
253
254
255
256
# Copyright (c) 2025, Zededa, Inc.
# SPDX-License-Identifier: Apache-2.0
---
name: Publish
on: # yamllint disable-line rule:truthy
push:
branches:
- "master"
- "[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+-stable"
paths-ignore:
- '**/*.md'
- '.github/**'
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-lts"
- "[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
jobs:
# 1) non-ARM packages, fully parallel
packages-non-arm:
if: github.event.repository.full_name == 'rene/eve'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: zededa-ubuntu-2204
arch: amd64
platform: "generic"
hv: kvm
- os: zededa-ubuntu-2204
arch: amd64
platform: "generic"
hv: kubevirt
- os: zededa-ubuntu-2204
arch: riscv64
platform: "generic"
hv: mini
steps:
- name: Starting Report
run: |
echo Git Ref: ${{ github.ref }}
echo GitHub Event: ${{ github.event_name }}
echo Disk usage
df -h
echo Memory
free -m
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Force fetch annotated tags (workaround)
run: |
git fetch --force --tags
- name: Determine architecture prefix and ref
env:
REF: ${{ github.ref }}
run: |
echo "ARCH=${{ matrix.arch }}" >> "$GITHUB_ENV"
echo "TAG=$(echo "$REF" | sed -e 's#^.*/##' -e 's#master#snapshot#' -e 's#main#snapshot#')" >> "$GITHUB_ENV"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }}
password: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }}
- name: Build packages
run: |
SUCCESS=
for i in 1 2 3; do
if make -e V=1 REGISTRY=10.208.13.132 HV=${{ matrix.hv }} ZARCH=${{ matrix.arch }} PLATFORM=${{ matrix.platform }} LINUXKIT_PKG_TARGET=push PRUNE=1 pkgs; then
SUCCESS=true
break
else
docker rmi -f $(docker image ls -q) || :
docker system prune -f -a || :
docker rm -f $(docker ps -aq) && docker volume rm -f $(docker volume ls -q) || :
fi
done
if [ -z "$SUCCESS" ]; then echo "::error::failed to build and push packages" && exit 1; fi
- name: Post package report
run: |
echo Disk usage
df -h
echo Memory
free -m
docker system df
docker system df -v
- name: Clean
if: ${{ always() }}
run: |
make clean || :
docker system prune -f -a || :
docker rm -f $(docker ps -aq) && docker volume rm -f $(docker volume ls -q) || :
rm -rf ~/.linuxkit || :
# 2) ARM packages, serialized
packages-arm:
if: github.event.repository.full_name == 'rene/eve'
runs-on: ${{ matrix.os }}
timeout-minutes: 1440 # It takes more time when building arm64 on an amd64 runner
strategy:
fail-fast: false
max-parallel: 1
matrix:
include:
- os: zededa-ubuntu-2204
arch: arm64
platform: "generic"
- os: zededa-ubuntu-2204
arch: arm64
platform: "nvidia-jp5"
- os: zededa-ubuntu-2204
arch: arm64
platform: "nvidia-jp6"
steps:
- name: Starting Report
run: |
echo Git Ref: ${{ github.ref }}
echo GitHub Event: ${{ github.event_name }}
echo Disk usage
df -h
echo Memory
free -m
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Force fetch annotated tags (workaround)
# Workaround for https://github.com/actions/checkout/issues/290
run: |
git fetch --force --tags
- name: Determine architecture prefix and ref
env:
REF: ${{ github.ref }}
run: |
# some special installs when building for riscv64
if [ "${{ matrix.arch }}" = riscv64 ]; then
APT_INSTALL="sudo apt install -y binfmt-support qemu-user-static"
# the following weird statement is here to speed up the happy path
# if the default server is responding -- we can skip apt update
$APT_INSTALL || { sudo apt update && $APT_INSTALL ; }
# constraining environment for riscv64 builds
echo "ZARCH=riscv64" >> "$GITHUB_ENV"
fi
echo "ARCH=${{ matrix.arch }}" >> "$GITHUB_ENV"
echo "TAG=$(echo "$REF" | sed -e 's#^.*/##' -e 's#master#snapshot#' -e 's#main#snapshot#')" >> "$GITHUB_ENV"
- name: Login to Docker Hub
if: ${{ github.event.repository.full_name }}== 'rene/eve'
uses: docker/login-action@v3
with:
username: ${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }}
password: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }}
- name: Build packages
run: |
SUCCESS=
# sadly, our build sometimes times out on network access
# and running out of disk space: re-trying for 3 times
for i in 1 2 3; do
if make -e V=1 REGISTRY=10.208.13.132 ZARCH=${{ matrix.arch }} PLATFORM=${{ matrix.platform }} LINUXKIT_PKG_TARGET=push PRUNE=1 pkgs; then
SUCCESS=true
break
else
# the most likely reason for 'make pkgs' to fail is
# the docker cache produced by the build exhausting
# disk space. So the following can't hurt before we
# retry:
docker rmi -f `docker image ls -q` || :
docker system prune -f -a || :
docker rm -f $(docker ps -aq) && docker volume rm -f $(docker volume ls -q) || :
fi
done
if [ -z "$SUCCESS" ]; then echo "::error::failed to build and push packages" && exit 1; fi
- name: Post package report
run: |
echo Disk usage
df -h
echo Memory
free -m
docker system df
docker system df -v
- name: Clean
if: ${{ always() }}
run: |
make clean || :
docker system prune -f -a || :
docker rm -f $(docker ps -aq) && docker volume rm -f $(docker volume ls -q) || :
rm -rf ~/.linuxkit || :
# 3) downstream jobs depend on both package jobs
eve:
if: github.event.repository.full_name == 'rene/eve'
needs: [packages-non-arm, packages-arm]
runs-on: zededa-ubuntu-2204
strategy:
fail-fast: false
matrix:
arch: [arm64, amd64]
hv: [kvm, xen]
platform: ["generic"]
include:
- arch: riscv64
hv: mini
platform: "generic"
- arch: arm64
hv: kvm
platform: "nvidia-jp5"
- arch: arm64
hv: kvm
platform: "nvidia-jp6"
- arch: amd64
hv: kubevirt
platform: "generic"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/run-make
with:
command: "V=1 REGISTRY=10.208.13.132 HV=${{ matrix.hv }} ZARCH=${{ matrix.arch }} PLATFORM=${{ matrix.platform }} LINUXKIT_PKG_TARGET=push eve"
dockerhub-token: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }}
dockerhub-account: ${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }}
- uses: ./.github/actions/run-make
if: matrix.arch != 'riscv64'
with:
command: "V=1 REGISTRY=10.208.13.132 HV=${{ matrix.hv }} ZARCH=${{ matrix.arch }} PLATFORM=${{ matrix.platform }} LINUXKIT_PKG_TARGET=push sbom collected_sources compare_sbom_collected_sources publish_sources"
dockerhub-token: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }}
dockerhub-account: ${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }}
- name: Clean
if: ${{ always() }}
run: |
make clean || :
docker system prune -f -a || :
docker rm -f $(docker ps -aq) && docker volume rm -f $(docker volume ls -q) || :
rm -rf ~/.linuxkit || :
manifest:
if: github.event.repository.full_name == 'rene/eve'
needs: [packages-non-arm, packages-arm]
runs-on: zededa-ubuntu-2204
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/run-make
with:
command: "V=1 REGISTRY=10.208.13.132 LINUXKIT_PKG_TARGET=manifest pkgs"
dockerhub-token: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }}
dockerhub-account: ${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }}
trigger_assets:
if: ${{ (startsWith(github.ref, 'refs/tags/')) && (github.event.repository.full_name == 'rene/eve') }}
needs: [manifest, eve]
uses: rene/eve/.github/workflows/assets.yml@master
with:
tag_ref: ${{ github.ref_name }}