From 2036470398dfe8f3d2158c7d372f6b5637a1646e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Thu, 15 Apr 2021 10:11:55 +0200 Subject: [PATCH 1/5] repository/progress: Format progress (#1312) --- pkg/repository/clone_mirror.go | 2 +- pkg/repository/progress.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/repository/clone_mirror.go b/pkg/repository/clone_mirror.go index 510a07eae8..cb9e44b4eb 100644 --- a/pkg/repository/clone_mirror.go +++ b/pkg/repository/clone_mirror.go @@ -383,7 +383,7 @@ func download(targetDir, tmpDir string, repo *V1Repository, item *v1manifest.Ver // Skip installed file if exists file valid if utils.IsExist(dstFile) { if err := validate(targetDir); err == nil { - fmt.Println("Skip exists file:", filepath.Join(targetDir, item.URL)) + fmt.Println("Skipping existing file:", filepath.Join(targetDir, item.URL)) return nil } } diff --git a/pkg/repository/progress.go b/pkg/repository/progress.go index f46de8fd98..951dc99a88 100644 --- a/pkg/repository/progress.go +++ b/pkg/repository/progress.go @@ -42,7 +42,7 @@ func (p *ProgressBar) Start(url string, size int64) { p.size = size p.bar = pb.Start64(size) p.bar.Set(pb.Bytes, true) - p.bar.SetTemplateString(fmt.Sprintf(`download %s {{counters . }} {{percent . }} {{speed . }}`, url)) + p.bar.SetTemplateString(fmt.Sprintf(`download %s {{counters . }} {{percent . }} {{speed . "%%s/s" "? MiB/s"}}`, url)) } // SetCurrent implement the DownloadProgress interface From 1d16f0d540916d349248212600a990ce8536a352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Fri, 16 Apr 2021 08:53:51 +0200 Subject: [PATCH 2/5] mirror clone: Improve handling of latest versions (#1313) --- pkg/repository/clone_mirror.go | 3 +++ pkg/utils/semver.go | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/pkg/repository/clone_mirror.go b/pkg/repository/clone_mirror.go index cb9e44b4eb..2489182239 100644 --- a/pkg/repository/clone_mirror.go +++ b/pkg/repository/clone_mirror.go @@ -464,6 +464,9 @@ func combineVersions(versions *[]string, if latest == "" { continue } + if selectedVersion != utils.LatestVersionAlias { + fmt.Printf("%s %s/%s %s not found, using %s instead.\n", manifest.ID, os, arch, selectedVersion, latest) + } selectedVersion = latest } if !result.Exist(selectedVersion) { diff --git a/pkg/utils/semver.go b/pkg/utils/semver.go index b29d6f22a0..7f51ee0761 100644 --- a/pkg/utils/semver.go +++ b/pkg/utils/semver.go @@ -23,6 +23,9 @@ import ( // NightlyVersionAlias represents latest build of master branch. const NightlyVersionAlias = "nightly" +// LatestVersionAlias represents the latest build (excluding nightly versions). +const LatestVersionAlias = "latest" + // FmtVer converts a version string to SemVer format, if the string is not a valid // SemVer and fails to parse and convert it, an error is raised. func FmtVer(ver string) (string, error) { @@ -33,6 +36,11 @@ func FmtVer(ver string) (string, error) { return v, nil } + // latest version is an alias + if strings.ToLower(v) == LatestVersionAlias { + return v, nil + } + if !strings.HasPrefix(ver, "v") { v = fmt.Sprintf("v%s", ver) } From 31c26b2cfb7780490005bdd48d6a91df56e6b726 Mon Sep 17 00:00:00 2001 From: Sparkle <1284531+baurine@users.noreply.github.com> Date: Mon, 19 Apr 2021 11:43:24 +0800 Subject: [PATCH 3/5] mirror: add `tiup mirror show` command to print current mirror address (#1317) --- cmd/mirror.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmd/mirror.go b/cmd/mirror.go index 9dca968b44..a0a7f6e6df 100644 --- a/cmd/mirror.go +++ b/cmd/mirror.go @@ -66,6 +66,7 @@ of components or the repository itself.`, newMirrorCloneCmd(), newMirrorMergeCmd(), newMirrorPublishCmd(), + newMirrorShowCmd(), newMirrorSetCmd(), newMirrorModifyCmd(), newMirrorGrantCmd(), @@ -139,6 +140,21 @@ func newMirrorSignCmd() *cobra.Command { return cmd } +// the `mirror show` sub command +func newMirrorShowCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "show", + Short: "Show mirror address", + Long: `Show current mirror address`, + RunE: func(cmd *cobra.Command, args []string) error { + fmt.Println(environment.Mirror()) + return nil + }, + } + + return cmd +} + // the `mirror set` sub command func newMirrorSetCmd() *cobra.Command { var ( From f1444c357d2a8128397a6e422c40bd1cbeaf5744 Mon Sep 17 00:00:00 2001 From: FiatLux Date: Mon, 19 Apr 2021 11:43:52 +0800 Subject: [PATCH 4/5] Update feature-request.md (#1316) --- .github/ISSUE_TEMPLATE/feature-request.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index db4d13a8a7..f969f1c774 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -12,8 +12,11 @@ labels: type/feature-request **Describe the feature you'd like:** +**Why the featue is needed:** + + **Describe alternatives you've considered:** **Teachability, Documentation, Adoption, Migration Strategy:** - + From 150c90be68f9764fe7c05c8f8d3ffde81d94719c Mon Sep 17 00:00:00 2001 From: Allen Zhong Date: Mon, 19 Apr 2021 17:09:52 +0800 Subject: [PATCH 5/5] playground: update version selection examples (#1318) --- components/playground/playground.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/playground/playground.go b/components/playground/playground.go index d408953a43..269f03da4a 100644 --- a/components/playground/playground.go +++ b/components/playground/playground.go @@ -677,12 +677,12 @@ func (p *Playground) bootCluster(ctx context.Context, env *environment.Environme } options.version = version.String() - fmt.Println(color.YellowString(`Use the latest stable version: %s + fmt.Println(color.YellowString(`No TiDB version specified, using the latest stable version: %s +If you'd like to use a TiDB version other than %s, cancel and retry with the following arguments: Specify version manually: tiup playground - The stable version: tiup playground v4.0.0 The nightly version: tiup playground nightly -`, options.version)) +`, options.version, options.version)) } if !utils.Version(options.version).IsNightly() {