Skip to content

Remove temporary container images after successful build

Issue/feature addressed

When building the docker images, temporary images are pushed to the container repositories. Once the docker build completes (and is optionally deployed), these are no longer needed.

Proposed solution

Use the regctl utility to delete the images from the container repositories after a successful build.

Implementation

Clean-up jobs are added to perform the clean for each of the container repositories for which a temporary image is created. These jobs depend on all the previous build/test/deploy jobs as necessary to avoid deleting an image when it is still needed by another job. The regctl utility from https://github.com/regclient/regclient is used to perform the delete. For security reasons, and to ensure minimal reliance on external websites, the latest version of this utility is copied into https://www.nektar.info/thirdparty and it is downloaded from there in the job.

Tests

The clean-up jobs are themselves tests. The temporary images are observed to be no longer present after the pipeline completes.

Suggested reviewers

@dmoxey @CFD-Xing

Notes

Please add any other information that could be useful for reviewers.

Checklist

  • [ ] Functions and classes, or changes to them, are documented.
  • [ ] User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by Chris Cantwell

Merge request reports

Loading