Skip to content

Commit

Permalink
cluster: nightly version could not be compared (#1702)
Browse files Browse the repository at this point in the history
  • Loading branch information
srstack authored Jan 7, 2022
1 parent 410c25c commit f7a536b
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion pkg/cluster/task/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import (
operator "github.com/pingcap/tiup/pkg/cluster/operation"
"github.com/pingcap/tiup/pkg/cluster/spec"
"github.com/pingcap/tiup/pkg/crypto"
"github.com/pingcap/tiup/pkg/environment"
logprinter "github.com/pingcap/tiup/pkg/logger/printer"
"github.com/pingcap/tiup/pkg/meta"
"github.com/pingcap/tiup/pkg/proxy"
"github.com/pingcap/tiup/pkg/tui"
"github.com/pingcap/tiup/pkg/utils"
)

// Builder is used to build TiUP task
Expand Down Expand Up @@ -242,10 +244,31 @@ func (b *Builder) BackupComponent(component, fromVer string, host, deployDir str

// InitConfig appends a CopyComponent task to the current task collection
func (b *Builder) InitConfig(clusterName, clusterVersion string, specManager *spec.SpecManager, inst spec.Instance, deployUser string, ignoreCheck bool, paths meta.DirPaths) *Builder {
// get nightly version
var componentVersion utils.Version
meta := specManager.NewMetadata()

// full version
componentVersion = utils.Version(clusterVersion)
if err := specManager.Metadata(clusterName, meta); err == nil {
// get nightly version
if clusterVersion == utils.NightlyVersionAlias {
componentVersion, _, err = environment.GlobalEnv().V1Repository().LatestNightlyVersion(inst.ComponentName())
if err != nil {
componentVersion = utils.Version(clusterVersion)
}
}

// dm cluster does not require a full nightly version
if meta.GetTopology().Type() == spec.TopoTypeDM {
componentVersion = utils.Version(clusterVersion)
}
}

b.tasks = append(b.tasks, &InitConfig{
specManager: specManager,
clusterName: clusterName,
clusterVersion: clusterVersion,
clusterVersion: string(componentVersion),
instance: inst,
deployUser: deployUser,
ignoreCheck: ignoreCheck,
Expand Down

0 comments on commit f7a536b

Please sign in to comment.