Container images: Support "template" images and use it for cuda-tests
#11702
+92
−421
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Container images: Support "template" images and use it for
cuda-tests
The
gpu/cuda-tests
andgpu/cuda-tests-12-8
are duplicates of each other,other than the CUDA version they use. As more CUDA versions are added, this
isn't a scalable pattern.
This change adds support in the
Makefile
(more specificallytools/images.mk
) for "image templates" and "image template instances".If an image directory ends in
.tmpl
, it will be ignored from the set of imagesthat the
Makefile
recognizes. Instead, this directory can be used toinstantiate other images.
For example, given the following filesystem structure:
Then this will effectively create two images,
my-little-image.foo.bar
andmy-little-image.baz.qux
. It will not create amy-little-image.tmpl
image.The behavior of the template instance images is determined by the
TEMPLATE_VERSION
build argument passed tomy-little-image.tmpl/Dockerfile
.This argument takes on the value of everything after the first
.
character ofthe last component of the template instance image name. For example, the image
my-little-image.foo.bar
will be built withdocker build --build-arg=TEMPLATE_VERSION=foo.bar
, whereas themy-little-image.baz.quux
will be built with
docker build --build-arg=TEMPLATE_VERSION=baz.qux
. Themy-little-image.tmpl/Dockerfile
image definition file can use this variable tomake the necessary tweaks to distinguish these two images.
#codehealth