feat: support skipping upgrades

This commit is contained in:
decentral1se 2022-01-02 15:46:35 +01:00
parent 33ff04c686
commit a71b070921
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
1 changed files with 14 additions and 4 deletions

View File

@ -38,6 +38,10 @@ Some image tags cannot be parsed because they do not follow some sort of
semver-like convention. In this case, all possible tags will be listed and it
is up to the end-user to decide.
The command is interactive and will show a select input which allows you to
make a seclection. Use the "?" key to see more help on navigating this
interface.
You may invoke this command in "wizard" mode and be prompted for input:
abra recipe upgrade
@ -154,7 +158,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
logrus.Fatal(err)
}
var compatibleStrings []string
compatibleStrings := []string{"skip"}
for _, compat := range compatible {
skip := false
for _, catlVersion := range catlVersions {
@ -224,6 +228,8 @@ You may invoke this command in "wizard" mode and be prompted for input:
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 {
@ -231,10 +237,14 @@ You may invoke this command in "wizard" mode and be prompted for input:
}
}
}
if err := recipe.UpdateTag(image, upgradeTag); err != nil {
logrus.Fatal(err)
if upgradeTag != "skip" {
if err := recipe.UpdateTag(image, upgradeTag); err != nil {
logrus.Fatal(err)
}
logrus.Infof("tag upgraded from %s to %s for %s", tag.String(), upgradeTag, image)
} else {
logrus.Warnf("not upgrading %s, skipping as requested", image)
}
logrus.Infof("tag upgraded from %s to %s for %s", tag.String(), upgradeTag, image)
}
return nil