ci: update .travis.yml and jenkins scripts

Change-Id: I22034ef33a13910e2a5639deec4a5609b5a6ad99
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index 9ee5a78..8907de1 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -6,8 +6,14 @@
 
 set -x
 
+if [[ $JOB_NAME == *"code-coverage" ]]; then
+    COVERAGE="--with-coverage"
+elif [[ -z $DISABLE_ASAN ]]; then
+    ASAN="--with-sanitizer=address"
+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
@@ -15,29 +21,24 @@
   ./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
-if [[ $JOB_NAME == *"code-coverage" ]]; then
-    COVERAGE="--with-coverage"
-elif [[ -n $BUILD_WITH_ASAN || -z $TRAVIS ]]; then
-    ASAN="--with-sanitizer=address"
-fi
-./waf --color=yes configure --debug --with-tests $COVERAGE $ASAN
+./waf --color=yes configure --debug --with-tests $ASAN $COVERAGE
 ./waf --color=yes build -j${WAF_JOBS:-1}
 
 # (tests will be run against debug version)
 
 # Install
-sudo env "PATH=$PATH" ./waf --color=yes install
+sudo_preserve_env PATH -- ./waf --color=yes install
 
 if has Linux $NODE_LABELS; then
     sudo ldconfig