Update pipeline to make it easier to clean up old registry images
Currently, each pipeline creates a new image repository named after the branch with develop
and latest
images.
For some reason, GitLab's clean up settings are not clearing these image repositories and tags out. Maybe using a single image repository and multiple tags will make it easier to clean up old tagged images and reduce the size of the project.
Try using these image tag names to make it easier for GitLab's auto clean up features to work:
DEVELOPMENT_CONTAINER_IMAGE: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}.development
BACKEND_DEVELOPMENT_CONTAINER_IMAGE: ${CI_REGISTRY_IMAGE}/backend:${CI_COMMIT_REF_SLUG}.development
The build script can be updated to allow passing in a build folder context. So from: https://gitlab.com/starting-spark/porter/frontend/-/blob/master/gitlab/templates.yaml#L21-25
- /kaniko/executor
--context ${CI_PROJECT_DIR}
--dockerfile ${CI_PROJECT_DIR}/Dockerfile
--target ${ENVIRONMENT}
--destination ${IMAGE_TAG}
to something like this:
- /kaniko/executor
--context ${CI_PROJECT_DIR}/backend # or some other variable
--dockerfile ${CI_PROJECT_DIR}/Dockerfile
--target ${ENVIRONMENT}
--destination ${IMAGE_TAG}
Edited by Zhao Li