Remove old images by tag, and test the step after a deploy (closes #216)
Check / check (pull_request) Skipped
Check / check (pull_request) Skipped
Old images are now removed by their upaas-<app>:<N> tag, without force, so Docker deletes an image only when no other tag (such as another app's build of the same source) and no container still uses it. Removing by ID with force could delete another app's rollback image. The step after a deploy (record the new image, keep the replaced one for rollback, remove the rest) is its own function, tested against a fake Docker API, so the test fails if the removal is dropped or runs before the images are updated. Model: opus-5-5
This commit is contained in:
@@ -90,9 +90,14 @@ func (svc *Service) GetBuildDirExported(appName string) string {
|
||||
return svc.GetBuildDir(appName)
|
||||
}
|
||||
|
||||
// UnusedImages exposes unusedImages for testing.
|
||||
func UnusedImages(images []docker.ImageID, app *models.App) []docker.ImageID {
|
||||
return unusedImages(images, app)
|
||||
// RecordDeployedImage exposes recordDeployedImage for testing.
|
||||
func (svc *Service) RecordDeployedImage(
|
||||
ctx context.Context,
|
||||
app *models.App,
|
||||
deployment *models.Deployment,
|
||||
imageID docker.ImageID,
|
||||
) error {
|
||||
return svc.recordDeployedImage(ctx, app, deployment, imageID)
|
||||
}
|
||||
|
||||
// BuildContainerOptionsExported exposes buildContainerOptions for testing.
|
||||
|
||||
Reference in New Issue
Block a user