osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ci/+/43344?usp=email )


Change subject: jobs/ttcn3-testsuites-testenv: use tmpfs
......................................................................

jobs/ttcn3-testsuites-testenv: use tmpfs

Reduce wear on the server's SSDs by having the cache in /tmp (which is
now a tmpfs for the jenkins nodes). Move it to the workspace in case the
job fails, so we can analyze what happened.

Related: OS#7068
Change-Id: I4e9cd491f528bda2f556fc6922d8780785d058f6
---
M jobs/ttcn3-testsuites-testenv.yml
1 file changed, 25 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/44/43344/1

diff --git a/jobs/ttcn3-testsuites-testenv.yml 
b/jobs/ttcn3-testsuites-testenv.yml
index c75f7b8..59b168c 100644
--- a/jobs/ttcn3-testsuites-testenv.yml
+++ b/jobs/ttcn3-testsuites-testenv.yml
@@ -642,20 +642,28 @@

           podman pull "$IMAGE"

+          test -n "$WORKSPACE"
+          CACHE_TMPFS=/tmp/jenkins/"$(basename "$WORKSPACE")"
+
           # Clean up leftover apt partial directories, which the host system
           # user can't remove directly
-          for i in _cache/podman/var-lib-apt-debian-*/lists/partial; do
-            if [ -e "$i" ]; then
-              podman run \
-                --rm \
-                -v "$PWD:/build" \
-                -w /build \
-                osmocom-build/debian-trixie-osmo-ttcn3-testenv \
-                rm -rvf "$i"
-            fi
-          done
+          fix_cache_tmpfs_permissions() {{
+            local i

-          rm -rf logs _cache .linux
+            for i in "$CACHE_TMPFS"/podman/var-lib-apt-debian-*/lists/partial; 
do
+              if [ -e "$i" ]; then
+                podman run \
+                  --rm \
+                  -v "$CACHE_TMPFS:$CACHE_TMPFS" \
+                  osmocom-build/debian-trixie-osmo-ttcn3-testenv \
+                  rm -rvf "$i"
+              fi
+            done
+          }}
+
+          # Clean up from previous job (possibly aborted)
+          fix_cache_tmpfs_permissions
+          rm -rf logs .linux _cache "$CACHE_TMPFS"

           if [ "$KERNEL" != "none" ]; then
             mv linux .linux
@@ -679,7 +687,7 @@
           if ! ./testenv.py run \
             {testsuite} \
             --podman \
-            --cache "$PWD"/_cache \
+            --cache "$CACHE_TMPFS" \
             --ccache ~/ccache/testenv \
             --log-dir "$PWD"/logs \
             $TESTENV_ARGS; then
@@ -689,7 +697,11 @@
           # Free up space from downloaded apt packages, build artifacts etc.
           # The osmo-ttcn3-hacks deps dir and ccache are persistent.
           if [ "$RC" = 0 ]; then
-            rm -rf _cache .linux
+            rm -rf "$CACHE_TMPFS" .linux
+          else
+            fix_cache_tmpfs_permissions
+            rm -f .linux
+            mv "$CACHE_TMPFS" _cache
           fi

           uptime | grep --color=always -o "load.*"

--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/43344?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I4e9cd491f528bda2f556fc6922d8780785d058f6
Gerrit-Change-Number: 43344
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>

Reply via email to