ci: introduce helper to preserve select env variables under sudo

Change-Id: I317a3c03d7188501f819b79ddfa6f0a2946a9866
Refs: #4610
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index 83f7d37..0c952ec 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -13,7 +13,7 @@
 fi
 
 # Cleanup
-sudo env "PATH=$PATH" ./waf --color=yes distclean
+sudo_preserve_env PATH -- ./waf --color=yes distclean
 
 if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
   # Configure/build in optimized mode with tests
@@ -21,14 +21,14 @@
   ./waf --color=yes build -j${WAF_JOBS:-1}
 
   # Cleanup
-  sudo env "PATH=$PATH" ./waf --color=yes distclean
+  sudo_preserve_env PATH -- ./waf --color=yes distclean
 
   # Configure/build in optimized mode without tests
   ./waf --color=yes configure
   ./waf --color=yes build -j${WAF_JOBS:-1}
 
   # Cleanup
-  sudo env "PATH=$PATH" ./waf --color=yes distclean
+  sudo_preserve_env PATH -- ./waf --color=yes distclean
 fi
 
 # Configure/build in debug mode with tests
@@ -38,4 +38,4 @@
 # (tests will be run against debug version)
 
 # Install
-sudo env "PATH=$PATH" ./waf --color=yes install
+sudo_preserve_env PATH -- ./waf --color=yes install