From 56a49e24d754f0cd74a2eb6d062f3c538419a849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jiri=20Dan=C4=9Bk?= Date: Mon, 25 Nov 2024 17:48:14 +0100 Subject: [PATCH] RHOAIENG-16076: fix(gha): move the trivy db to the lvm volume as to not run out of disk space When I was testing this in the all-in-one PR, I had 4096 MB reserved on /. I did not realize that trivy relied on that disk space. ``` build (codeserver-ubi9-python-3.11) / build System.IO.IOException: No space left on device : '/home/runner/runners/2.320.0/_diag/Worker_20241125-163906-utc.log' Unhandled exception. System.IO.IOException: No space left on device : '/home/runner/runners/2.320.0/_diag/Worker_20241125-163906-utc.log' at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset) at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite() at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at System.Diagnostics.TextWriterTraceListener.Flush() at GitHub.Runner.Common.HostTraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id) at GitHub.Runner.Common.HostTraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String message) at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message) at GitHub.Runner.Worker.Worker.RunAsync(String pipeIn, String pipeOut) at GitHub.Runner.Worker.Program.MainAsync(IHostContext context, String[] args) System.IO.IOException: No space left on device : '/home/runner/runners/2.320.0/_diag/Worker_20241125-163906-utc.log' at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset) at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite() at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at System.Diagnostics.TextWriterTraceListener.Flush() at GitHub.Runner.Common.HostTraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id) at GitHub.Runner.Common.HostTraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String message) at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message) at GitHub.Runner.Common.Tracing.Error(Exception exception) at GitHub.Runner.Worker.Program.MainAsync(IHostContext context, String[] args) at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset) at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite() at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at System.Diagnostics.TextWriterTraceListener.Flush() at System.Diagnostics.TraceSource.Flush() at GitHub.Runner.Common.TraceManager.Dispose(Boolean disposing) at GitHub.Runner.Common.TraceManager.Dispose() at GitHub.Runner.Common.HostContext.Dispose(Boolean disposing) at GitHub.Runner.Common.HostContext.Dispose() at GitHub.Runner.Worker.Program.Main(String[] args) ``` --- .github/workflows/build-notebooks-TEMPLATE.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-notebooks-TEMPLATE.yaml b/.github/workflows/build-notebooks-TEMPLATE.yaml index 0b9fcbcf2..ee1483fa5 100644 --- a/.github/workflows/build-notebooks-TEMPLATE.yaml +++ b/.github/workflows/build-notebooks-TEMPLATE.yaml @@ -25,6 +25,7 @@ jobs: # GitHub image registry used for storing $(CONTAINER_ENGINE)'s cache CACHE: "ghcr.io/${{ github.repository }}/workbench-images/build-cache" TRIVY_VERSION: 0.57.1 + TRIVY_VULNDB: "/home/runner/.local/share/containers/trivy_db" # Targets (and their folder) that should be scanned using FS instead of IMAGE scan due to resource constraints TRIVY_SCAN_FS_JSON: '{}' @@ -164,17 +165,17 @@ jobs: - name: Pre-pull Trivy vulnerabilities DB if: ${{ steps.resolve-target.outputs.target }} run: | - mkdir trivy_db + mkdir ${TRIVY_VULNDB} podman run --rm \ --env PODMAN_SOCK \ - -v ${PWD}/trivy_db:/cache \ + -v ${TRIVY_VULNDB}:/cache \ docker.io/aquasec/trivy:$TRIVY_VERSION \ --cache-dir /cache \ image \ --download-db-only podman run --rm \ --env PODMAN_SOCK \ - -v ${PWD}/trivy_db:/cache \ + -v ${TRIVY_VULNDB}:/cache \ docker.io/aquasec/trivy:$TRIVY_VERSION \ --cache-dir /cache \ image \ @@ -233,7 +234,7 @@ jobs: podman run --rm \ $PODMAN_ARGS \ -v ${REPORT_FOLDER}:/report \ - -v ${PWD}/trivy_db:/cache \ + -v ${TRIVY_VULNDB}:/cache \ docker.io/aquasec/trivy:$TRIVY_VERSION \ --cache-dir /cache \ $SCAN_TYPE \