16
16
CTEST_OUTPUT_ON_FAILURE : 1
17
17
CONAN_NON_INTERACTIVE : 1
18
18
CONAN_REVISIONS_ENABLED : 1
19
+ IMAGE_NAME : netboxlabs/pktvisor
19
20
20
21
jobs :
21
22
unit-tests-mac :
61
62
- name : Test
62
63
working-directory : ${{github.workspace}}/build
63
64
shell : bash
64
- run : ctest -C $BUILD_TYPE
65
+ run : ctest -C $BUILD_TYPE --output-on-failure
65
66
66
67
unit-tests-linux :
67
68
runs-on : ubuntu-latest
82
83
uses : actions/cache@v4
83
84
with :
84
85
path : ${{github.workspace}}/build/p/
85
- key : conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
86
- restore-keys : conan-${{ runner.os }}-
86
+ key : conan-${{ runner.os }}-amd64- ${{ hashFiles('conanfile.py', '*/conanfile.py') }}
87
+ restore-keys : conan-${{ runner.os }}-amd64-
87
88
88
89
- name : Configure CMake
89
90
shell : bash
@@ -104,7 +105,7 @@ jobs:
104
105
- name : Test
105
106
working-directory : ${{github.workspace}}/build
106
107
shell : bash
107
- run : sudo ctest -C $BUILD_TYPE
108
+ run : sudo ctest --output-on-failure
108
109
109
110
build-win64 :
110
111
runs-on : windows-2019
@@ -231,19 +232,20 @@ jobs:
231
232
uses : actions/cache@v4
232
233
with :
233
234
path : ${{github.workspace}}/build/p/
234
- key : conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
235
- restore-keys : conan-${{ runner.os }}-
235
+ key : conan-${{ runner.os }}-amd64- ${{ hashFiles('conanfile.py', '*/conanfile.py') }}
236
+ restore-keys : conan-${{ runner.os }}-amd64-
236
237
237
- - name : Build pktvisord + push symbol to bugsplat.com
238
+ - name : Build pktvisord + push symbol to backtrace.io
238
239
uses : ./.github/actions/build-cpp
239
240
with :
240
241
context : " ."
241
242
build_type : " Release"
242
243
asan : " OFF"
243
244
bugsplat_key : ${{secrets.BUGSPLAT_KEY}}
244
245
bugsplat_symbol_url : ${{secrets.BUGSPLAT_SYMBOL_URL}}
245
- bugsplat : " true "
246
+ bugsplat : " false "
246
247
file : " ./Dockerfile"
248
+ arch : " amd64"
247
249
248
250
- name : Build pktvisor-cli
249
251
uses : ./.github/actions/build-go
@@ -255,15 +257,14 @@ jobs:
255
257
run : ls -lha .
256
258
257
259
- name : Get VERSION
258
- id : build
259
260
run : |
260
261
echo "VERSION=${{needs.unit-tests-linux.outputs.version_number}}" >> $GITHUB_ENV
261
262
262
- - name : Generate ref tag (develop)
263
- run : echo "REF_TAG=latest-develop" >> $GITHUB_ENV
264
-
265
- - name : Debug ref tag
266
- run : echo ${{ env.REF_TAG }}
263
+ - name : Docker meta
264
+ id : meta
265
+ uses : docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
266
+ with :
267
+ images : ${{ env.IMAGE_NAME }}
267
268
268
269
- name : Login to Docker Hub
269
270
uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
@@ -289,24 +290,33 @@ jobs:
289
290
uses : docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
290
291
291
292
- name : Build + push - pktvisor (multi-arch)
292
- env :
293
- IMAGE_NAME : netboxlabs/pktvisor
294
293
uses : docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
294
+ id : docker_build
295
295
with :
296
296
builder : ${{ steps.buildx.outputs.name }}
297
297
context : .
298
298
file : ./docker/Dockerfile.crashhandler
299
299
platforms : linux/amd64
300
- push : true
301
- tags : |
302
- ${{ env.IMAGE_NAME }}:${{ needs.unit-tests-linux.outputs.version_number }}
303
- ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
304
- outputs : type=docker,dest=/tmp/amd64.tar
300
+ labels : ${{ steps.meta.outputs.labels }}
301
+ outputs : type=image,"name=${{ env.IMAGE_NAME }}",push-by-digest=true,name-canonical=true,push=true
302
+
303
+ - name : Export digest
304
+ run : |
305
+ mkdir -p /tmp/digests
306
+ digest="${{ steps.docker_build.outputs.digest }}"
307
+ touch "/tmp/digests/${digest#sha256:}"
308
+
309
+ - name : Upload digest
310
+ uses : actions/upload-artifact@v4
311
+ with :
312
+ name : digests-linux-amd64
313
+ path : /tmp/digests/*
314
+ if-no-files-found : error
315
+ retention-days : 1
305
316
306
317
build-app-image-x64 :
307
- needs : [ package-amd64 ]
318
+ needs : [ merge-packages ]
308
319
runs-on : ubuntu-latest
309
- # if: github.event_name != 'pull_request'
310
320
steps :
311
321
- uses : actions/checkout@v4
312
322
@@ -317,6 +327,13 @@ jobs:
317
327
id : conan
318
328
uses : turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d # v1.2
319
329
330
+ - name : Setup Conan Cache
331
+ uses : actions/cache@v4
332
+ with :
333
+ path : ${{github.workspace}}/build/p/
334
+ key : conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
335
+ restore-keys : conan-${{ runner.os }}-amd64-
336
+
320
337
- name : Configure CMake to generate VERSION
321
338
shell : bash
322
339
working-directory : ${{github.workspace}}/build
@@ -365,15 +382,13 @@ jobs:
365
382
366
383
- name : Build + push - pktvisor-prom-write
367
384
env :
368
- IMAGE_NAME : netboxlabs/pktvisor-prom-write
385
+ PROM_IMAGE_NAME : netboxlabs/pktvisor-prom-write
369
386
working-directory : ${{github.workspace}}/centralized_collection/prometheus/docker-grafana-agent
370
387
run : |
371
- docker build . --file Dockerfile --build-arg PKTVISOR_TAG=${{ env.REF_TAG }} --tag ${{ env.IMAGE_NAME }}:${{ env.VERSION }} --tag ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
372
- docker push -a ${{ env.IMAGE_NAME }}
388
+ docker build . --file Dockerfile --build-arg PKTVISOR_TAG=${{ env.REF_TAG }} --tag ${{ env.PROM_IMAGE_NAME }}:${{ env.VERSION }} --tag ${{ env.PROM_IMAGE_NAME }}:${{ env.REF_TAG }}
389
+ docker push -a ${{ env.PROM_IMAGE_NAME }}
373
390
374
391
- name : Generate AppImage
375
- env :
376
- IMAGE_NAME : netboxlabs/pktvisor
377
392
working-directory : ${{github.workspace}}/appimage
378
393
run : |
379
394
DEV_IMAGE="${{ env.IMAGE_NAME }}:${{ env.VERSION }}" DEV_MODE=t make pktvisor-x86_64.AppImage
@@ -406,8 +421,8 @@ jobs:
406
421
path : ${{github.workspace}}/build/p/
407
422
key : conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
408
423
restore-keys : conan-${{ runner.os }}-arm64-
409
-
410
- - name : Build pktvisord + push symbol to bugsplat.com
424
+
425
+ - name : Build pktvisord + push symbol to backtrace.io
411
426
uses : ./.github/actions/build-cpp
412
427
with :
413
428
context : " ."
@@ -417,6 +432,7 @@ jobs:
417
432
bugsplat_symbol_url : ${{secrets.BUGSPLAT_SYMBOL_URL}}
418
433
bugsplat : " false"
419
434
file : " ./Dockerfile"
435
+ arch : " arm64"
420
436
421
437
- name : Build pktvisor-cli
422
438
uses : ./.github/actions/build-go
@@ -428,11 +444,11 @@ jobs:
428
444
- name : Debug artifacts
429
445
run : ls -lha .
430
446
431
- - name : Generate ref tag (develop)
432
- run : echo "REF_TAG=latest-develop" >> $GITHUB_ENV
433
-
434
- - name : Debug ref tag
435
- run : echo ${{ env.REF_TAG }}
447
+ - name : Docker meta
448
+ id : meta
449
+ uses : docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
450
+ with :
451
+ images : ${{ env.IMAGE_NAME }}
436
452
437
453
- name : Login to Docker Hub
438
454
uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
@@ -459,16 +475,65 @@ jobs:
459
475
460
476
- name : Build + push - pktvisor (multi-arch)
461
477
id : docker_build
462
- env :
463
- IMAGE_NAME : netboxlabs/pktvisor
464
478
uses : docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
465
479
with :
466
480
builder : ${{ steps.buildx.outputs.name }}
467
481
context : .
468
482
file : ./docker/Dockerfile.crashhandler
469
483
platforms : linux/arm64
470
- push : true
484
+ labels : ${{ steps.meta.outputs.labels }}
485
+ outputs : type=image,"name=${{ env.IMAGE_NAME }}",push-by-digest=true,name-canonical=true,push=true
486
+
487
+ - name : Export digest
488
+ run : |
489
+ mkdir -p /tmp/digests
490
+ digest="${{ steps.docker_build.outputs.digest }}"
491
+ touch "/tmp/digests/${digest#sha256:}"
492
+
493
+ - name : Upload digest
494
+ uses : actions/upload-artifact@v4
495
+ with :
496
+ name : digests-linux-arm64
497
+ path : /tmp/digests/*
498
+ if-no-files-found : error
499
+ retention-days : 1
500
+
501
+ merge-packages :
502
+ runs-on : ubuntu-latest
503
+ needs : [unit-tests-linux, package-amd64, package-arm64]
504
+ steps :
505
+ - name : Download digests
506
+ uses : actions/download-artifact@v4
507
+ with :
508
+ path : /tmp/digests
509
+ pattern : digests-*
510
+ merge-multiple : true
511
+
512
+ - name : Login to Docker Hub
513
+ uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
514
+ with :
515
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
516
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
517
+
518
+ - name : Set up Docker Buildx
519
+ id : buildx
520
+ uses : docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
521
+
522
+ - name : Docker meta
523
+ id : meta
524
+ uses : docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
525
+ with :
526
+ images : ${{ env.IMAGE_NAME }}
471
527
tags : |
472
- ${{ env.IMAGE_NAME }}:${{ needs.unit-tests-linux.outputs.version_number }}
473
- ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
474
- outputs : type=docker,dest=/tmp/arm64.tar
528
+ type=raw,value=latest-develop
529
+ type=raw,value=${{ needs.unit-tests-linux.outputs.version_number }}
530
+
531
+ - name : Create manifest list and push
532
+ working-directory : /tmp/digests
533
+ run : |
534
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
535
+ $(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *)
536
+
537
+ - name : Inspect image
538
+ run : |
539
+ docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
0 commit comments