Cloned from launchpad blueprint https://blueprints.launchpad.net/tripleo/+spec/tripleo-diskimage-builder-parallel-builds.
Currently if you run parallel builds for diskimage-builder on a system the builds fail, because the diskimage-builder uses the common “~/.cache/image-create” directory to cache OS image files, git repositories, Python or Ruby packages etc. to create the images.
If we want to enable parallel builds, then we need to identify and tie the builds to the correct “~/.cache/image-create” folder. To do this we can use mktemp and let diskimage-builder use this directory as the cache directory instead of “DIB_IMAGE_CACHE” (~/.cache/image-create).
export CACHE_DIR=$(mktemp -d ~/.cache/image-create.XXXXXXXX)
This will create the "~/.cache/image-create.XXXXXXXX" directory and let the diskimage-builder use it for its respective builds.
Also, to enable diskimage-builder to build with the correct "~/.cache/image-create.XXXXXXXX" directory for “--offline” mode; the script should force the user to specify the respective “image-create.XXXXXXXX” folder to refer to for the build.
Specification URL (additional information):