api: test: Supply --out-dir to build-dockerimages.py

Chroot state is starting to get pulled out to an output directory, so we
need to supply out-dir as an argument now.

BUG=b:265885353
TEST=./run_tests

Cq-Depend: chromium:4617188
Change-Id: I4c975d669d90c7090dab3c5922791f013f608e24
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4618378
Auto-Submit: Brian Norris <briannorris@chromium.org>
Reviewed-by: Lizzy Presland <zland@google.com>
Commit-Queue: Lizzy Presland <zland@google.com>
Reviewed-by: Derek Beckett <dbeckett@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
diff --git a/api/controller/test.py b/api/controller/test.py
index d42e3bb..aa2e180 100644
--- a/api/controller/test.py
+++ b/api/controller/test.py
@@ -213,8 +213,7 @@
 
 @faux.success(_BuildTestServiceContainersResponse)
 @faux.error(_BuildTestServiceContainersFailedResponse)
-@validate.require("build_target.name")
-@validate.require("chroot.path")
+@validate.require("build_target.name", "chroot.path", "chroot.out_path")
 @validate.check_constraint("tags", _ValidDockerTag)
 @validate.check_constraint("labels", _ValidDockerLabelKey)
 @validate.validation_complete
@@ -242,7 +241,13 @@
         # Note that we use an output file instead of stdout to avoid any issues
         # with maintaining stdout hygiene.  Stdout and stderr are combined to
         # form the error log in response to any errors.
-        cmd = [build_script, chroot.path, sysroot.path]
+        cmd = [
+            build_script,
+            chroot.path,
+            sysroot.path,
+            "--out-dir",
+            chroot.out_path,
+        ]
 
         if input_proto.HasField("repository"):
             cmd += ["--host", input_proto.repository.hostname]