Add some minor tweaks to machine readable pathway in recipe upgrade
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
87e5909363
commit
c5d9d88359
@ -28,6 +28,8 @@ type imgPin struct {
|
|||||||
version tagcmp.Tag
|
version tagcmp.Tag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// anUpgrade represents a single service upgrade (as within a recipe), and the list of tags that it can be upgraded to,
|
||||||
|
// for serialization purposes.
|
||||||
type anUpgrade struct {
|
type anUpgrade struct {
|
||||||
Service string `json:"service"`
|
Service string `json:"service"`
|
||||||
Image string `json:"image"`
|
Image string `json:"image"`
|
||||||
@ -257,14 +259,17 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// there is always at least the item "skip" in compatibleStrings (a list of
|
||||||
|
// possible upgradable tags) and at least one other tag.
|
||||||
|
upgradableTags := compatibleStrings[1:]
|
||||||
upgrade := anUpgrade{
|
upgrade := anUpgrade{
|
||||||
Service: service.Name,
|
Service: service.Name,
|
||||||
Image: image,
|
Image: image,
|
||||||
Tag: tag.String(),
|
Tag: tag.String(),
|
||||||
UpgradeTags: make([]string, len(compatibleStrings[1:])),
|
UpgradeTags: make([]string, len(upgradableTags)),
|
||||||
}
|
}
|
||||||
|
|
||||||
for n, s := range compatibleStrings[1:] {
|
for n, s := range upgradableTags {
|
||||||
var sb strings.Builder
|
var sb strings.Builder
|
||||||
if _, err := sb.WriteString(s); err != nil {
|
if _, err := sb.WriteString(s); err != nil {
|
||||||
}
|
}
|
||||||
@ -308,16 +313,16 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||||||
jsonstring, err := json.Marshal(upgradeList)
|
jsonstring, err := json.Marshal(upgradeList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
} else {
|
|
||||||
fmt.Println(string(jsonstring))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
fmt.Println(string(jsonstring))
|
||||||
for _, upgrade := range upgradeList {
|
return nil
|
||||||
logrus.Infof("can upgrade service: %s, image: %s, tag: %s ::\n", upgrade.Service, upgrade.Image, upgrade.Tag)
|
}
|
||||||
for _, utag := range upgrade.UpgradeTags {
|
|
||||||
logrus.Infof(" %s\n", utag)
|
for _, upgrade := range upgradeList {
|
||||||
}
|
logrus.Infof("can upgrade service: %s, image: %s, tag: %s ::\n", upgrade.Service, upgrade.Image, upgrade.Tag)
|
||||||
|
for _, utag := range upgrade.UpgradeTags {
|
||||||
|
logrus.Infof(" %s\n", utag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user