Skip to content

Commit

Permalink
Merge branch 'master' into fix-root-err
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Apr 19, 2021
2 parents d899163 + 150c90b commit bff1887
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ labels: type/feature-request
**Describe the feature you'd like:**
<!-- A clear and concise description of what you want to happen. -->

**Why the featue is needed:**
<!-- Why the feature is needed by users? If you can, explain some scenarios how users might use this. -->

**Describe alternatives you've considered:**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Teachability, Documentation, Adoption, Migration Strategy:**
<!-- If you can, explain some scenarios how users might use this, situations it would be helpful in. Any API designs, mockups, or diagrams are also helpful. -->
<!-- Any API designs, mockups, or diagrams are helpful. -->
16 changes: 16 additions & 0 deletions cmd/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ of components or the repository itself.`,
newMirrorCloneCmd(),
newMirrorMergeCmd(),
newMirrorPublishCmd(),
newMirrorShowCmd(),
newMirrorSetCmd(),
newMirrorModifyCmd(),
newMirrorGrantCmd(),
Expand Down Expand Up @@ -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 (
Expand Down
6 changes: 3 additions & 3 deletions components/playground/playground.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <version>
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() {
Expand Down
5 changes: 4 additions & 1 deletion pkg/repository/clone_mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/repository/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions pkg/utils/semver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
}
Expand Down

0 comments on commit bff1887

Please sign in to comment.