Update clang_debian8 and clang_ubuntu16_04 base images (r340178) (#179)

* Update clang_debian8 and clang_ubuntu16_04 base images (r340178)

Also pin the container used by
//test/configs:debian8_clang_autoconfig_test to a specific digest.
diff --git a/WORKSPACE b/WORKSPACE
index ebc9119..e30307b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -69,6 +69,16 @@
     tag = "16.04",
 )
 
+# TODO(xingao) Switch to use "marketplace.gcr.io" registry once Buildkite support proper auth.
+# Pinned to gcr.io/cloud-marketplace/google/clang-debian8@sha256:ac3b1fdc22c0f2b95abe67f2daf33788425fab52d4e6845900bfe1a42443098f
+# solely for testing purpose used by //test/configs:debian8_clang_autoconfig_test.
+container_pull(
+    name = "debian8-clang-test",
+    digest = "sha256:ac3b1fdc22c0f2b95abe67f2daf33788425fab52d4e6845900bfe1a42443098f",
+    registry = "l.gcr.io",
+    repository = "google/clang-debian8",
+)
+
 # The Debian snapshot datetime to use.
 # This is kept up-to-date with https://github.com/GoogleCloudPlatform/base-images-docker/blob/master/WORKSPACE.
 DEB_SNAPSHOT = "20180312T052343Z"
diff --git a/rules/toolchain_containers.bzl b/rules/toolchain_containers.bzl
index 0ad4985..3f221f1 100644
--- a/rules/toolchain_containers.bzl
+++ b/rules/toolchain_containers.bzl
@@ -23,8 +23,8 @@
         ###########################################################
         # Clang images                                            #
         ###########################################################
-        # gcr.io/cloud-marketplace/google/clang-debian8:r337145
-        "debian8_clang": "sha256:de1116d36eafe16890afd64b6bc6809a3ed5b3597ed7bc857980749270894677",
-        # gcr.io/cloud-marketplace/google/clang-ubuntu:r337145
-        "ubuntu16_04_clang": "sha256:fbf123ca7c7696f53864da4f7d1d9470f9ef4ebfabc4344f44173d1951faee6f",
+        # gcr.io/cloud-marketplace/google/clang-debian8
+        "debian8_clang": "sha256:0946899544c00537b2af06790e72ba86aa39b16e0e05aef8f53ed79d1f89f2a0",
+        # gcr.io/cloud-marketplace/google/clang-ubuntu
+        "ubuntu16_04_clang": "sha256:79a24c15949bd5770acac41b444c5c0b7f9723dcbc708c67d87ecf71e32c9126",
     }
diff --git a/test/configs/BUILD b/test/configs/BUILD
index 2fe7cd4..0cfedfd 100644
--- a/test/configs/BUILD
+++ b/test/configs/BUILD
@@ -20,6 +20,7 @@
 load("@bazel_toolchains//rules:docker_config.bzl", "docker_toolchain_autoconfig")
 load(
     "@bazel_toolchains//rules:environments.bzl",
+    "clang_env",
     "debian8_clang_default_keys",
     "debian8_clang_default_packages",
     "debian8_clang_default_repos",
@@ -136,13 +137,30 @@
     test = True,
 )
 
+# For test purpose only. Used by //test/configs:debian8_clang_autoconfig_test.
+# debian8_clang_autoconfig_test compares configs generated by this target and those
+# already published in the repo to make sure the current docker_toolchain_autoconfig
+# can generate the exact same configs as before.
+# Container: gcr.io/cloud-marketplace/google/clang-debian8@sha256:ac3b1fdc22c0f2b95abe67f2daf33788425fab52d4e6845900bfe1a42443098f
+docker_toolchain_autoconfig(
+    name = "debian8-clang-0.3.0-bazel_0.10.0-autoconfig",
+    additional_repos = debian8_clang_default_repos(),
+    base = "@debian8-clang-test//image",
+    bazel_version = "0.10.0",
+    env = clang_env(),
+    keys = debian8_clang_default_keys(),
+    packages = debian8_clang_default_packages(),
+    tags = ["manual"],
+    test = True,
+)
+
 sh_test(
     name = "debian8_clang_autoconfig_test",
     size = "medium",
     timeout = "long",
     srcs = ["debian8_clang_autoconfig_test.sh"],
     data = [
-        "//configs/debian8_clang:debian8-clang-0.3.0-bazel_0.10.0-autoconfig",
+        ":debian8-clang-0.3.0-bazel_0.10.0-autoconfig",
         "@bazel_toolchains_test//file",
     ],
 )
diff --git a/test/configs/debian8_clang_autoconfig_test.sh b/test/configs/debian8_clang_autoconfig_test.sh
index f01904c..87ee969 100755
--- a/test/configs/debian8_clang_autoconfig_test.sh
+++ b/test/configs/debian8_clang_autoconfig_test.sh
@@ -28,7 +28,7 @@
 BAZEL_VERSION=0.10.0
 CONFIG_VERSION=0.3.0
 TEST_CONFIGS_DIR=${TEST_TMPDIR}/bazel-toolchains-${COMMIT}/configs/debian8_clang/${CONFIG_VERSION}/bazel_${BAZEL_VERSION}/
-AUTOCONFIG_SCRIPT=${WORKSPACE_ROOT}/configs/debian8_clang/debian8-clang-${CONFIG_VERSION}-bazel_${BAZEL_VERSION}-autoconfig
+AUTOCONFIG_SCRIPT=${WORKSPACE_ROOT}/test/configs/debian8-clang-${CONFIG_VERSION}-bazel_${BAZEL_VERSION}-autoconfig
 
 # Helper function for always delete the containers / temporary files on exit
 function cleanup_on_finish {