5151 ci_checks : ${{ steps.outputs.outputs.ci_checks }}
5252 base_container_publish : ${{ steps.outputs.outputs.base_container_publish }}
5353 axvisor_lvz_container_publish : ${{ steps.outputs.outputs.axvisor_lvz_container_publish }}
54+ base_container_image : ${{ steps.outputs.outputs.base_container_image }}
55+ axvisor_lvz_container_image : ${{ steps.outputs.outputs.axvisor_lvz_container_image }}
5456 steps :
5557 - name : Checkout code
5658 uses : actions/checkout@v6
6668 filters : |
6769 ci_checks:
6870 - ".cargo/**"
71+ - ".github/workflows/container-publish.yml"
6972 - ".github/workflows/ci.yml"
7073 - ".github/workflows/reusable-command.yml"
7174 - "Cargo.toml"
9598 FILTER_BASE_CONTAINER_PUBLISH : ${{ steps.filter.outputs.base_container_publish }}
9699 FILTER_AXVISOR_LVZ_CONTAINER_PUBLISH : ${{ steps.filter.outputs.axvisor_lvz_container_publish }}
97100 run : |
101+ repository="$(printf '%s' "$GITHUB_REPOSITORY" | LC_ALL=C tr '[:upper:]' '[:lower:]')"
102+ base_container_image="ghcr.io/${repository}-container"
103+ axvisor_lvz_container_image="ghcr.io/${repository}-container-axvisor-lvz"
104+
98105 if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
99106 ci_checks=false
100107 case "$MANUAL_TARGET" in
@@ -129,6 +136,8 @@ jobs:
129136 echo "ci_checks=${ci_checks}"
130137 echo "base_container_publish=${base_container_publish}"
131138 echo "axvisor_lvz_container_publish=${axvisor_lvz_container_publish}"
139+ echo "base_container_image=${base_container_image}"
140+ echo "axvisor_lvz_container_image=${axvisor_lvz_container_image}"
132141 } >> "$GITHUB_OUTPUT"
133142
134143 fmt :
@@ -154,143 +163,143 @@ jobs:
154163 runs_on : ' ["ubuntu-latest"]'
155164 command : cargo xtask clippy
156165 cache_key : clippy
157- container_image : ghcr.io/${{ github.repository }}-container:latest
166+ container_image : base
158167 required_repository_owner : " "
159168 main_pr_only : false
160169 - name : Run sync-lint
161170 use_container : true
162171 runs_on : ' ["ubuntu-latest"]'
163172 command : cargo xtask sync-lint
164173 cache_key : sync-lint
165- container_image : ghcr.io/${{ github.repository }}-container:latest
174+ container_image : base
166175 required_repository_owner : " "
167176 main_pr_only : false
168177 - name : Test with std
169178 use_container : true
170179 runs_on : ' ["ubuntu-latest"]'
171180 command : cargo xtask test
172181 cache_key : test-std
173- container_image : ghcr.io/${{ github.repository }}-container:latest
182+ container_image : base
174183 required_repository_owner : " "
175184 main_pr_only : false
176185 - name : Test axvisor aarch64 qemu
177186 use_container : true
178187 runs_on : ' ["ubuntu-latest"]'
179188 command : cargo xtask axvisor test qemu --arch aarch64
180189 cache_key : test-axvisor-aarch64
181- container_image : ghcr.io/${{ github.repository }}-container:latest
190+ container_image : base
182191 required_repository_owner : " "
183192 main_pr_only : false
184193 - name : Test axvisor riscv64 qemu
185194 use_container : true
186195 runs_on : ' ["ubuntu-latest"]'
187196 command : cargo xtask axvisor test qemu --arch riscv64
188197 cache_key : test-axvisor-riscv64
189- container_image : ghcr.io/${{ github.repository }}-container:latest
198+ container_image : base
190199 required_repository_owner : " "
191200 main_pr_only : false
192201 - name : Test axvisor loongarch64 qemu
193202 use_container : true
194203 runs_on : ' ["ubuntu-latest"]'
195204 command : cargo xtask axvisor test qemu --arch loongarch64
196205 cache_key : test-axvisor-loongarch64
197- container_image : ghcr.io/${{ github.repository }}-container- axvisor-lvz:latest
206+ container_image : axvisor-lvz
198207 required_repository_owner : " "
199208 main_pr_only : false
200209 - name : Test starry riscv64 qemu
201210 use_container : true
202211 runs_on : ' ["ubuntu-latest"]'
203212 command : cargo xtask starry test qemu --arch riscv64
204213 cache_key : test-starry-riscv64
205- container_image : ghcr.io/${{ github.repository }}-container:latest
214+ container_image : base
206215 required_repository_owner : " "
207216 main_pr_only : false
208217 - name : Test starry aarch64 qemu
209218 use_container : true
210219 runs_on : ' ["ubuntu-latest"]'
211220 command : cargo xtask starry test qemu --arch aarch64
212221 cache_key : test-starry-aarch64
213- container_image : ghcr.io/${{ github.repository }}-container:latest
222+ container_image : base
214223 required_repository_owner : " "
215224 main_pr_only : false
216225 - name : Test starry loongarch64 qemu
217226 use_container : true
218227 runs_on : ' ["ubuntu-latest"]'
219228 command : cargo xtask starry test qemu --arch loongarch64
220229 cache_key : test-starry-loongarch64
221- container_image : ghcr.io/${{ github.repository }}-container:latest
230+ container_image : base
222231 required_repository_owner : " "
223232 main_pr_only : false
224233 - name : Test starry x86_64 qemu
225234 use_container : true
226235 runs_on : ' ["ubuntu-latest"]'
227236 command : cargo xtask starry test qemu --arch x86_64
228237 cache_key : test-starry-x86_64
229- container_image : ghcr.io/${{ github.repository }}-container:latest
238+ container_image : base
230239 required_repository_owner : " "
231240 main_pr_only : false
232241 - name : Test arceos x86_64 qemu
233242 use_container : true
234243 runs_on : ' ["ubuntu-latest"]'
235244 command : cargo xtask arceos test qemu --arch x86_64
236245 cache_key : test-arceos-x86_64
237- container_image : ghcr.io/${{ github.repository }}-container:latest
246+ container_image : base
238247 required_repository_owner : " "
239248 main_pr_only : false
240249 - name : Test arceos riscv64 qemu
241250 use_container : true
242251 runs_on : ' ["ubuntu-latest"]'
243252 command : cargo xtask arceos test qemu --arch riscv64
244253 cache_key : test-arceos-riscv64
245- container_image : ghcr.io/${{ github.repository }}-container:latest
254+ container_image : base
246255 required_repository_owner : " "
247256 main_pr_only : false
248257 - name : Test arceos aarch64 qemu
249258 use_container : true
250259 runs_on : ' ["ubuntu-latest"]'
251260 command : cargo xtask arceos test qemu --arch aarch64
252261 cache_key : test-arceos-aarch64
253- container_image : ghcr.io/${{ github.repository }}-container:latest
262+ container_image : base
254263 required_repository_owner : " "
255264 main_pr_only : false
256265 - name : Test arceos loongarch64 qemu
257266 use_container : true
258267 runs_on : ' ["ubuntu-latest"]'
259268 command : cargo xtask arceos test qemu --arch loongarch64
260269 cache_key : test-arceos-loongarch64
261- container_image : ghcr.io/${{ github.repository }}-container:latest
270+ container_image : base
262271 required_repository_owner : " "
263272 main_pr_only : false
264273 - name : Stress starry aarch64
265274 use_container : true
266275 runs_on : ' ["ubuntu-latest"]'
267276 command : echo "TODO!"
268277 cache_key : test-starry-stress-aarch64
269- container_image : ghcr.io/${{ github.repository }}-container:latest
278+ container_image : base
270279 required_repository_owner : " "
271280 main_pr_only : true
272281 - name : Stress starry riscv64
273282 use_container : true
274283 runs_on : ' ["ubuntu-latest"]'
275284 command : echo "TODO!"
276285 cache_key : test-starry-stress-riscv64
277- container_image : ghcr.io/${{ github.repository }}-container:latest
286+ container_image : base
278287 required_repository_owner : " "
279288 main_pr_only : true
280289 - name : Stress starry loongarch64
281290 use_container : true
282291 runs_on : ' ["ubuntu-latest"]'
283292 command : echo "TODO!"
284293 cache_key : test-starry-stress-loongarch64
285- container_image : ghcr.io/${{ github.repository }}-container:latest
294+ container_image : base
286295 required_repository_owner : " "
287296 main_pr_only : true
288297 - name : Stress starry x86_64
289298 use_container : true
290299 runs_on : ' ["ubuntu-latest"]'
291300 command : echo "TODO!"
292301 cache_key : test-starry-stress-x86_64
293- container_image : ghcr.io/${{ github.repository }}-container:latest
302+ container_image : base
294303 required_repository_owner : " "
295304 main_pr_only : true
296305 - name : Test axvisor self-hosted x86_64
@@ -323,7 +332,14 @@ jobs:
323332 use_container : ${{ matrix.use_container }}
324333 command : ${{ matrix.command }}
325334 cache_key : ${{ matrix.cache_key }}
326- container_image : ${{ matrix.container_image }}
335+ container_image : >-
336+ ${{
337+ matrix.container_image == 'base'
338+ && format('{0}:latest', needs.detect_changes.outputs.base_container_image)
339+ || matrix.container_image == 'axvisor-lvz'
340+ && format('{0}:latest', needs.detect_changes.outputs.axvisor_lvz_container_image)
341+ || matrix.container_image
342+ }}
327343 apk_region : >-
328344 ${{
329345 (
@@ -387,7 +403,7 @@ jobs:
387403 - detect_changes
388404 uses : ./.github/workflows/container-publish.yml
389405 with :
390- image_name : ghcr.io/ ${{ github.repository }}-container
406+ image_name : ${{ needs.detect_changes.outputs.base_container_image }}
391407 dockerfile : container/Dockerfile
392408 cache_scope : container
393409 permissions :
@@ -412,11 +428,11 @@ jobs:
412428 - publish_base_container
413429 uses : ./.github/workflows/container-publish.yml
414430 with :
415- image_name : ghcr.io/ ${{ github.repository }}-container-axvisor-lvz
431+ image_name : ${{ needs.detect_changes.outputs.axvisor_lvz_container_image }}
416432 dockerfile : container/Dockerfile.axvisor-lvz
417433 cache_scope : container-axvisor-lvz
418434 build_args : |
419- BASE_IMAGE=ghcr.io/ ${{ github.repository }}-container :latest
435+ BASE_IMAGE=${{ needs.detect_changes.outputs.base_container_image }}:latest
420436 permissions :
421437 contents : read
422438 packages : write
0 commit comments