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 and AstroProfundis committed Jan 10, 2022
1 parent 4f90d0f commit 517f535
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 @@ -24,9 +24,11 @@ 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"
"github.com/pingcap/tiup/pkg/logger/log"
"github.com/pingcap/tiup/pkg/meta"
"github.com/pingcap/tiup/pkg/proxy"
"github.com/pingcap/tiup/pkg/utils"
)

// Builder is used to build TiUP task
Expand Down Expand Up @@ -230,10 +232,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 517f535

Please sign in to comment.