Răsfoiți Sursa

ci: Remove superuser tools from PATH in Linux jobs

Our Linux CI jobs incidentally run as `root` in their containers, but
do not need any superuser tools.  Drop `sbin` entries from the `PATH`.
This also avoids finding user tools through Fedora 42's `sbin -> bin`
symbolic links.
Brad King 8 luni în urmă
părinte
comite
01d0f037b6
1 a modificat fișierele cu 7 adăugiri și 0 ștergeri
  1. 7 0
      .gitlab/ci/env.sh

+ 7 - 0
.gitlab/ci/env.sh

@@ -22,3 +22,10 @@ fi
 if test -r ".gitlab/ci/env_${CMAKE_CONFIGURATION}.sh"; then
   source ".gitlab/ci/env_${CMAKE_CONFIGURATION}.sh"
 fi
+
+case "$(uname -s)-$(uname -m)" in
+    Linux-*)
+        # Remove superuser tools from PATH.
+        export PATH=$(echo "$PATH" | sed 's|:[^:]*/sbin:|:|g')
+        ;;
+esac