Skip to content

Commit

Permalink
feat: Always keep latest released version of Kurtosis images (#1473)
Browse files Browse the repository at this point in the history
## Description:
<!-- Describe this change, how it works, and the motivation behind it.
-->
Before this PR, images were deleted based on if they were being used by
any container and were not dev versions. This caused the latest released
version to be deleted if there were no enclaves active.

After this PR, the algorithm is:
- Keep all dev versions
- Keep the latest released version
- Keep all images that are used by at least one container

## Is this change user facing?
YES
<!-- If yes, please add the "user facing" label to the PR -->
<!-- If yes, don't forget to include docs changes where relevant -->

## References (if applicable):
<!-- Add relevant Github Issues, Discord threads, or other helpful
information. -->
#1457
  • Loading branch information
victorcolombo committed Oct 10, 2023
1 parent 542d435 commit 7fbdfd0
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/go-connections/nat"
kurtosis_sdk_version "github.com/kurtosis-tech/kurtosis/api/golang/kurtosis_version"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/consts"
docker_manager_types "github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_manager/types"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/compute_resources"
Expand Down Expand Up @@ -304,7 +305,7 @@ func (manager *DockerManager) ListUnusedImages(ctx context.Context) ([]types.Ima
continue
}
for _, tag := range image.RepoTags {
if strings.Contains(tag, kurtosisTagPrefix) && containsSemVer(tag) {
if strings.Contains(tag, kurtosisTagPrefix) && containsSemVer(tag) && !strings.Contains(tag, kurtosis_sdk_version.KurtosisVersion) {
unusedImages = append(unusedImages, image)
}
}
Expand Down

0 comments on commit 7fbdfd0

Please sign in to comment.