enter_chroot: keep .netrc on bots and add some logging

Since bots seem to have unreliable gitcookie settings atm, copy in
the .netrc file still.  We only do this on bots as users should be
able to fix their own systems.

BUG=chromium:1025578
TEST=CQ passes

Change-Id: I96f98523d59a9027db7772fd8373c91946be4192
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/1960560
Reviewed-by: Sean Abraham <seanabraham@chromium.org>
Reviewed-by: Mike Nichols <mikenichols@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh
index 4c7bcc2..2ea6cc0 100755
--- a/sdk_lib/enter_chroot.sh
+++ b/sdk_lib/enter_chroot.sh
@@ -83,6 +83,11 @@
   .gdata_token                # Auth token for Google Docs on chromium.org
   .inputrc                    # Preserve command line customizations
 )
+if [[ "${USER}" == "chrome-bot" ]]; then
+  # Builders still haven't migrated fully to gitcookies.
+  # https://crbug.com/1032944
+  FILES_TO_COPY_TO_CHROOT+=( .netrc )
+fi
 
 INNER_CHROME_ROOT=$FLAGS_chrome_root_mount  # inside chroot
 CHROME_ROOT_CONFIG="/var/cache/chrome_root"  # inside chroot
@@ -203,7 +208,13 @@
 
 copy_into_chroot_if_exists() {
   # $1 is file path outside of chroot to copy to path $2 inside chroot.
-  [ -e "$1" ] && user_cp -p "$1" "${FLAGS_chroot}/$2"
+  if [[ -e "$1" ]]; then
+    local verbose
+    if [[ "${USER}" == "chrome-bot" ]]; then
+      verbose="-v"
+    fi
+    user_cp ${verbose} "$1" "${FLAGS_chroot}/$2"
+  fi
 }
 
 # Usage: promote_api_keys