Save Docker image to workspace instead of pushing to ECR. (#26720)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26720
I'm trying to get rid of the need for CI jobs to have write access to ECR. Right now, they require write access because they push intermediate build results, which then get sucked down by downstream jobs. Instead of pushing back to ECR, we could just save them to CircleCI workspace. (There are some downsides to this approach: in particular, we save ALL layers to the workspace, not the new layers.) My original idea was to save to `~/built_image.tgz` and then load it.
Unfortunately, the Android tests have a substantially more complicated Docker structure which means my simple idea doesn't work. The current structure is that there are instantiations of `pytorch_linux_build` per configuration (e.g., `x86_32`, `x86_64`, ...). Then `gradle_build` collates these Docker images together and combines them to publish. To handle this case, the upstream jobs have to save Docker images to distinct filenames in the workspace for the load to work correctly. This is achieved by adding a new parameter to `pytorch_linux_build`, `saved_docker_filename`, which specifies where to put the image. Additionally, to pass this parameter to the jobs, I stopped using configuration generation for this case, as I couldn't figure out how to get the generator to conditionally add another line to the YAML for this case.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Differential Revision: D17843468
Pulled By: ezyang
fbshipit-source-id: c3f549e562c691b8f3f447705d4717c1fbb64040