recipe/upgrade: Add non-interactive mode.

Add support for -n which just outputs the list of compatible tags for each image.
This commit is contained in:
Cassowary 2023-04-12 14:58:21 -07:00 committed by Gitea
parent 2dcbfa1d65
commit 62f8103fc2
1 changed files with 15 additions and 9 deletions

View File

@ -240,15 +240,21 @@ You may invoke this command in "wizard" mode and be prompted for input:
compatibleStrings = append(compatibleStrings, regVersion)
}
}
prompt := &survey.Select{
Message: msg,
Help: "enter / return to confirm, choose 'skip' to not upgrade this tag, vim mode is enabled",
VimMode: true,
Options: compatibleStrings,
}
if err := survey.AskOne(prompt, &upgradeTag); err != nil {
logrus.Fatal(err)
if internal.NoInput {
logrus.Infof("potential upgrades for service: %s, image: %s, tag: %s ::\t", service.Name, image, tag)
for _, upgradableVersion := range compatibleStrings[1:] {
logrus.Infof("\t%s\n", upgradableVersion)
}
} else {
prompt := &survey.Select{
Message: msg,
Help: "enter / return to confirm, choose 'skip' to not upgrade this tag, vim mode is enabled",
VimMode: true,
Options: compatibleStrings,
}
if err := survey.AskOne(prompt, &upgradeTag); err != nil {
logrus.Fatal(err)
}
}
}
}