Skip to content

Commit

Permalink
update messages to lang
Browse files Browse the repository at this point in the history
  • Loading branch information
Racer159 committed Feb 21, 2024
1 parent 1f07fef commit 7518206
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cmd/tools/crane.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func pruneImages(_ *cobra.Command, _ []string) error {
func doPruneImagesForPackages(zarfState *types.ZarfState, zarfPackages []types.DeployedPackage, registryEndpoint string) error {
authOption := config.GetCraneAuthOption(zarfState.RegistryInfo.PushUsername, zarfState.RegistryInfo.PushPassword)

spinner := message.NewProgressSpinner("Looking up images within package definitions")
spinner := message.NewProgressSpinner(lang.CmdToolsRegistryPruneLookup)
defer spinner.Stop()

// Determine which image digests are currently used by Zarf packages
Expand Down Expand Up @@ -276,7 +276,7 @@ func doPruneImagesForPackages(zarfState *types.ZarfState, zarfPackages []types.D
}
}

spinner.Updatef("Cataloging images in the registry")
spinner.Updatef(lang.CmdToolsRegistryPruneCatalog)

// Find which images and tags are in the registry currently
imageCatalog, err := crane.Catalog(registryEndpoint, authOption)
Expand All @@ -300,7 +300,7 @@ func doPruneImagesForPackages(zarfState *types.ZarfState, zarfPackages []types.D
}
}

spinner.Updatef("Calculating images to prune")
spinner.Updatef(lang.CmdToolsRegistryPruneCalculate)

// Figure out which images are in the registry but not needed by packages
imageDigestsToPrune := map[string]bool{}
Expand Down Expand Up @@ -337,7 +337,7 @@ func doPruneImagesForPackages(zarfState *types.ZarfState, zarfPackages []types.D
}
}
if confirm {
spinner := message.NewProgressSpinner("Deleting unused images")
spinner := message.NewProgressSpinner(lang.CmdToolsRegistryPruneDelete)
defer spinner.Stop()

// Delete the digest references that are to be pruned
Expand Down
4 changes: 4 additions & 0 deletions src/config/lang/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ $ zarf tools registry digest reg.example.com/stefanprodan/podinfo:6.4.0
CmdToolsRegistryPruneFlagConfirm = "Confirm the image prune action to prevent accidental deletions"
CmdToolsRegistryPruneImageList = "The following image digests will be pruned from the registry:"
CmdToolsRegistryPruneNoImages = "There are no images to prune"
CmdToolsRegistryPruneLookup = "Looking up images within package definitions"
CmdToolsRegistryPruneCatalog = "Cataloging images in the registry"
CmdToolsRegistryPruneCalculate = "Calculating images to prune"
CmdToolsRegistryPruneDelete = "Deleting unused images"

CmdToolsRegistryInvalidPlatformErr = "Invalid platform '%s': %s"
CmdToolsRegistryFlagVerbose = "Enable debug logs"
Expand Down

0 comments on commit 7518206

Please sign in to comment.