diff --git a/cmd/mirror.go b/cmd/mirror.go index eb024441fe..15721ac3e1 100644 --- a/cmd/mirror.go +++ b/cmd/mirror.go @@ -670,8 +670,8 @@ func newMirrorCloneCmd() *cobra.Command { } defer repo.Mirror().Close() - var versionMapper = func(ver string) string { - return spec.TiDBComponentVersion(ver, "") + var versionMapper = func(comp string) string { + return spec.TiDBComponentVersion(comp, "") } return repository.CloneMirror(repo, components, versionMapper, args[0], args[1:], options) diff --git a/pkg/cluster/manager.go b/pkg/cluster/manager.go index 20176eff64..2e0bb4be49 100644 --- a/pkg/cluster/manager.go +++ b/pkg/cluster/manager.go @@ -817,9 +817,6 @@ func (m *Manager) Upgrade(clusterName string, clusterVersion string, opt operato for _, comp := range topo.ComponentsByUpdateOrder() { for _, inst := range comp.Instances() { version := m.bindVersion(inst.ComponentName(), clusterVersion) - if version == "" { - return perrs.Errorf("unsupported component: %v", inst.ComponentName()) - } compInfo := componentInfo{ component: inst.ComponentName(), version: version, diff --git a/pkg/cluster/spec/bindversion.go b/pkg/cluster/spec/bindversion.go index 058b502d45..4a7692bb75 100644 --- a/pkg/cluster/spec/bindversion.go +++ b/pkg/cluster/spec/bindversion.go @@ -31,6 +31,8 @@ func TiDBComponentVersion(comp, version string) string { return "v0.7.0" case ComponentCheckCollector: return "v0.3.1" + case ComponentSpark, ComponentTiSpark: + return "" // empty version should be treate as the the last stable one default: return version } diff --git a/pkg/repository/v1_repository.go b/pkg/repository/v1_repository.go index ca9494b39b..14355fb313 100644 --- a/pkg/repository/v1_repository.go +++ b/pkg/repository/v1_repository.go @@ -731,6 +731,13 @@ func (r *V1Repository) ComponentVersion(id, version string, includeYanked bool) if v0manifest.Version(version).IsNightly() && manifest.Nightly != "" { version = manifest.Nightly } + if version == "" { + v, _, err := r.LatestStableVersion(id, includeYanked) + if err != nil { + return nil, err + } + version = v.String() + } vi := manifest.VersionItem(r.PlatformString(), version, includeYanked) if vi == nil { return nil, fmt.Errorf("version %s on %s for component %s not found", version, r.PlatformString(), id)