Temporary workaround for Kokoro bug

`git status` on Kokoro has started reporting all symlinks as dirty.
This breaks is_repo_dirty checks in our build scripts. Temporarily
work around the problem by ignoring dirtiness of submodules as symlinks
are only present in third_party/linux/ and prebuilts/.

Bug: 152398137
Change-Id: Id412d766b988c114b4a6af33db2defaae612a7a2
diff --git a/build/bash/common.inc b/build/bash/common.inc
index 4d7bd73..dd70247 100644
--- a/build/bash/common.inc
+++ b/build/bash/common.inc
@@ -81,6 +81,14 @@
 # Runs on all projects if Repo is detected.
 function is_repo_dirty() {
 	local cmd=(git status --porcelain=v1)
+
+	# Temporary workaround for b/152398137 (all symlinks dirty on Kokoro).
+	# All affected files are in submodules, skip them.
+	if [ "${HAFNIUM_IGNORE_SUBMODULE_STATUS:-false}" == "true" ]
+	then
+		cmd+=(--ignore-submodules)
+	fi
+
 	if is_repo_build
 	then
 		# This source tree was checked out using `repo`. Check the
@@ -127,4 +135,15 @@
 		# manifest and symlink files here.
 		"$(get_script_dir)/symlink_repo.py" "${ROOT_DIR}"
 	fi
+
+	##
+	## Temporary workaround for b/152398137 (all symlinks dirty on Kokoro).
+	## The `is_kokoro_build` check does not work inside container builds.
+	## Use an environment variable with HAFNIUM_ prefix to pass that
+	## information into the container (run_in_container.sh propagates them).
+	##
+	if is_kokoro_build
+	then
+		export HAFNIUM_IGNORE_SUBMODULE_STATUS=true
+	fi
 }