1616 CTEST_OUTPUT_ON_FAILURE : 1
1717 CONAN_NON_INTERACTIVE : 1
1818 CONAN_REVISIONS_ENABLED : 1
19+ IMAGE_NAME : netboxlabs/pktvisor
1920
2021jobs :
2122 unit-tests-mac :
6162 - name : Test
6263 working-directory : ${{github.workspace}}/build
6364 shell : bash
64- run : ctest -C $BUILD_TYPE
65+ run : ctest -C $BUILD_TYPE --output-on-failure
6566
6667 unit-tests-linux :
6768 runs-on : ubuntu-latest
8283 uses : actions/cache@v4
8384 with :
8485 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-
8788
8889 - name : Configure CMake
8990 shell : bash
@@ -104,7 +105,7 @@ jobs:
104105 - name : Test
105106 working-directory : ${{github.workspace}}/build
106107 shell : bash
107- run : sudo ctest -C $BUILD_TYPE
108+ run : sudo ctest --output-on-failure
108109
109110 build-win64 :
110111 runs-on : windows-2019
@@ -231,19 +232,20 @@ jobs:
231232 uses : actions/cache@v4
232233 with :
233234 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-
236237
237- - name : Build pktvisord + push symbol to bugsplat.com
238+ - name : Build pktvisord + push symbol to backtrace.io
238239 uses : ./.github/actions/build-cpp
239240 with :
240241 context : " ."
241242 build_type : " Release"
242243 asan : " OFF"
243244 bugsplat_key : ${{secrets.BUGSPLAT_KEY}}
244245 bugsplat_symbol_url : ${{secrets.BUGSPLAT_SYMBOL_URL}}
245- bugsplat : " true "
246+ bugsplat : " false "
246247 file : " ./Dockerfile"
248+ arch : " amd64"
247249
248250 - name : Build pktvisor-cli
249251 uses : ./.github/actions/build-go
@@ -255,15 +257,14 @@ jobs:
255257 run : ls -lha .
256258
257259 - name : Get VERSION
258- id : build
259260 run : |
260261 echo "VERSION=${{needs.unit-tests-linux.outputs.version_number}}" >> $GITHUB_ENV
261262
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 }}
267268
268269 - name : Login to Docker Hub
269270 uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
@@ -289,24 +290,33 @@ jobs:
289290 uses : docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
290291
291292 - name : Build + push - pktvisor (multi-arch)
292- env :
293- IMAGE_NAME : netboxlabs/pktvisor
294293 uses : docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
294+ id : docker_build
295295 with :
296296 builder : ${{ steps.buildx.outputs.name }}
297297 context : .
298298 file : ./docker/Dockerfile.crashhandler
299299 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
305316
306317 build-app-image-x64 :
307- needs : [ package-amd64 ]
318+ needs : [ merge-packages ]
308319 runs-on : ubuntu-latest
309- # if: github.event_name != 'pull_request'
310320 steps :
311321 - uses : actions/checkout@v4
312322
@@ -317,6 +327,13 @@ jobs:
317327 id : conan
318328 uses : turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d # v1.2
319329
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+
320337 - name : Configure CMake to generate VERSION
321338 shell : bash
322339 working-directory : ${{github.workspace}}/build
@@ -365,15 +382,13 @@ jobs:
365382
366383 - name : Build + push - pktvisor-prom-write
367384 env :
368- IMAGE_NAME : netboxlabs/pktvisor-prom-write
385+ PROM_IMAGE_NAME : netboxlabs/pktvisor-prom-write
369386 working-directory : ${{github.workspace}}/centralized_collection/prometheus/docker-grafana-agent
370387 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 }}
373390
374391 - name : Generate AppImage
375- env :
376- IMAGE_NAME : netboxlabs/pktvisor
377392 working-directory : ${{github.workspace}}/appimage
378393 run : |
379394 DEV_IMAGE="${{ env.IMAGE_NAME }}:${{ env.VERSION }}" DEV_MODE=t make pktvisor-x86_64.AppImage
@@ -406,8 +421,8 @@ jobs:
406421 path : ${{github.workspace}}/build/p/
407422 key : conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
408423 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
411426 uses : ./.github/actions/build-cpp
412427 with :
413428 context : " ."
@@ -417,6 +432,7 @@ jobs:
417432 bugsplat_symbol_url : ${{secrets.BUGSPLAT_SYMBOL_URL}}
418433 bugsplat : " false"
419434 file : " ./Dockerfile"
435+ arch : " arm64"
420436
421437 - name : Build pktvisor-cli
422438 uses : ./.github/actions/build-go
@@ -428,11 +444,11 @@ jobs:
428444 - name : Debug artifacts
429445 run : ls -lha .
430446
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 }}
436452
437453 - name : Login to Docker Hub
438454 uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
@@ -459,16 +475,65 @@ jobs:
459475
460476 - name : Build + push - pktvisor (multi-arch)
461477 id : docker_build
462- env :
463- IMAGE_NAME : netboxlabs/pktvisor
464478 uses : docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
465479 with :
466480 builder : ${{ steps.buildx.outputs.name }}
467481 context : .
468482 file : ./docker/Dockerfile.crashhandler
469483 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 }}
471527 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