In this chapter we will go through the caching feature of CEKit.
CEKit has a built-in cache for artifacts. It’s purpose is to speed up the build process for subsequent builds.
By default cached artifacts are located in the
Cache location can be changed when you specify the
--work-dir parameter. In such case cache
will be located in a
cache directory located inside the directory specified by the
Every cached artifact is identified with a UUID (version 4). This identifier is also used as the file name (in the cache directory) for the artifact itself.
Each cached artifact contains metadata too. This includes information about computed checksums for this artifact
as well as names which were used to refer to the artifact. Metadata is stored in the cache directory too, the
file name is the UUID of the artifact with a
1258069e-7194-426d-a6ab-ade0a27b8290 UUID assigned with it, then it will be found
~/.cekit/cache/1258069e-7194-426d-a6ab-ade0a27b8290 path and the metadata can be found in the
Artifacts in cache are discovered by the hash value.
While adding an artifact to the cache, CEKit is computing it’s checksums for all currently supported algorithms (
sha512). This makes it possible to refer the same artifact in descriptors using different algorithms.
This also means that CEKit is using cache only for artifacts which define at least one hash.
CEKit is automatically caching all artifacts used to build the image. Consider following image descriptor snippet:
- name: jolokia-1.3.6-bin.tar.gz
This artifact will be automatically added into the cache during image build. This is useful as the artifact will be automatically copied from cache instead of downloading it again on any rebuild.
CEKit provides command line tool called
cekit-cache which is used to manage cache.
It has a
--work-dir (by default set to
~/.cekit) parameter which sets CEKit’s working directory. This is where the
cache directory will be
If you customize
--work-dir – make sure you use the same path for
You can also set the path in the configuration file.
CEKit supports caching artifacts manually. This is very usefull if you need to introduce non-public
artifact to a CEKit. To cache an artifact you need to specify path to the artifact on filesystem or its URL and
at least one of the supported hashes (
Caching local artifact
$ cekit-cache add path/to/file --md5 checksum
Caching remote artifact
$ cekit-cache add https://foo.bar/baz --sha256 checksum
To list all artifact known to CEKit cache you need to run following command:
$ cekit-cache ls
After running the command you can see following output:
If you are not interested in particular artifact from cache, you can delete it by executing following command:
$ cekit-cache rm uuid
You can get uuid of any artifact by invoking
cekit-cache ls command. Please consult Listing cached artifacts.
To wipe whole artifact cache you need to run the
cekit-cache clear command. This will ask you for confirmation
of the removal step.
$ cekit-cache clear