enter_chroot: Copy user's local LUCI creds into the chroot.

Currently, when you authenticate with luci on the command-line, the
creds that get stored locally don't get propagated into the chroot.
This will fix that by copying them into the expected location when
entering the chroot, similar to how .gitcookies get propagated.

BUG=chromium:1046143
TEST=entered chroot
Change-Id: I6b2737eed4fce3269f2df24eb2114a8343c231ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2025614
Tested-by: Ben Pastene <bpastene@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh
index 64efce1..5615140 100755
--- a/sdk_lib/enter_chroot.sh
+++ b/sdk_lib/enter_chroot.sh
@@ -79,6 +79,8 @@
 # These config files are to be copied into chroot if they exist in home dir.
 # Additionally, git relevant files are copied by setup_git.
 FILES_TO_COPY_TO_CHROOT=(
+  # Creds used to authenticate with LUCI services.
+  .config/chrome_infra/auth/creds.json
   .gdata_cred.txt             # User/password for Google Docs on chromium.org
   .gdata_token                # Auth token for Google Docs on chromium.org
   .inputrc                    # Preserve command line customizations
@@ -209,6 +211,11 @@
 copy_into_chroot_if_exists() {
   # $1 is file path outside of chroot to copy to path $2 inside chroot.
   if [[ -e "$1" ]]; then
+    local dir
+    dir=$(dirname "${FLAGS_chroot}/$2")
+    if [[ ! -d "${dir}" ]]; then
+      user_mkdir "${dir}"
+    fi
     user_cp "$1" "${FLAGS_chroot}/$2"
   fi
 }