diff --git a/cli/recipe/sync.go b/cli/recipe/sync.go index ebd7fb7b..f1f532c5 100644 --- a/cli/recipe/sync.go +++ b/cli/recipe/sync.go @@ -51,6 +51,7 @@ You may invoke this command in "wizard" mode and be prompted for input: if err != nil { logrus.Fatal(err) } + mainAppVersion := imagesTmp[mainApp] tags, err := recipe.Tags() @@ -79,9 +80,11 @@ will know that things are likely to change. Message: "which version do you want to begin with?", Options: []string{"0.1.0", "1.0.0"}, } + if err := survey.AskOne(edPrompt, &chosenVersion); err != nil { logrus.Fatal(err) } + nextTag = fmt.Sprintf("%s+%s", chosenVersion, mainAppVersion) } @@ -97,25 +100,30 @@ will know that things are likely to change. if err != nil { logrus.Fatal(err) } + var lastGitTag tagcmp.Tag iter, err := repo.Tags() if err != nil { logrus.Fatal(err) } + if err := iter.ForEach(func(ref *plumbing.Reference) error { obj, err := repo.TagObject(ref.Hash()) if err != nil { return err } + tagcmpTag, err := tagcmp.Parse(obj.Name) if err != nil { return err } + if (lastGitTag == tagcmp.Tag{}) { lastGitTag = tagcmpTag } else if tagcmpTag.IsGreaterThan(lastGitTag) { lastGitTag = tagcmpTag } + return nil }); err != nil { logrus.Fatal(err) @@ -126,7 +134,7 @@ will know that things are likely to change. if bumpType != 0 { // a bitwise check if the number is a power of 2 if (bumpType & (bumpType - 1)) != 0 { - logrus.Fatal("you can only use one of: --major, --minor, --patch.") + logrus.Fatal("you can only use one version flag: --major, --minor or --patch") } } @@ -137,12 +145,14 @@ will know that things are likely to change. if err != nil { logrus.Fatal(err) } + newTag.Patch = strconv.Itoa(now + 1) } else if internal.Minor { now, err := strconv.Atoi(newTag.Minor) if err != nil { logrus.Fatal(err) } + newTag.Patch = "0" newTag.Minor = strconv.Itoa(now + 1) } else if internal.Major { @@ -150,6 +160,7 @@ will know that things are likely to change. if err != nil { logrus.Fatal(err) } + newTag.Patch = "0" newTag.Minor = "0" newTag.Major = strconv.Itoa(now + 1) diff --git a/pkg/compose/compose.go b/pkg/compose/compose.go index 3d49c9e3..7433e1a3 100644 --- a/pkg/compose/compose.go +++ b/pkg/compose/compose.go @@ -142,7 +142,6 @@ func UpdateLabel(pattern, serviceName, label, recipeName string) error { logrus.Warn("no existing label found, cannot continue...") logrus.Fatalf("add \"%s\" manually, automagic insertion not supported yet", label) } - } return nil