Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the issue that tiup-cluster can't deploy arm64 binary #1229

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/cluster/manager/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/pingcap/tiup/pkg/environment"
"github.com/pingcap/tiup/pkg/logger/log"
"github.com/pingcap/tiup/pkg/meta"
"github.com/pingcap/tiup/pkg/repository"
"github.com/pingcap/tiup/pkg/set"
"github.com/pingcap/tiup/pkg/utils"
)
Expand Down Expand Up @@ -270,7 +271,10 @@ func (m *Manager) Deploy(
case spec.ComponentTiSpark:
env := environment.GlobalEnv()
var sparkVer utils.Version
if sparkVer, _, iterErr = env.V1Repository().LatestStableVersion(spec.ComponentSpark, false); iterErr != nil {
if sparkVer, _, iterErr = env.V1Repository().WithOptions(repository.Options{
GOOS: inst.OS(),
GOARCH: inst.Arch(),
}).LatestStableVersion(spec.ComponentSpark, false); iterErr != nil {
return
}
t = t.DeploySpark(inst, sparkVer.String(), "" /* default srcPath */, deployDir)
Expand Down
6 changes: 5 additions & 1 deletion pkg/cluster/manager/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/pingcap/tiup/pkg/environment"
"github.com/pingcap/tiup/pkg/logger/log"
"github.com/pingcap/tiup/pkg/meta"
"github.com/pingcap/tiup/pkg/repository"
"github.com/pingcap/tiup/pkg/utils"
"golang.org/x/mod/semver"
)
Expand Down Expand Up @@ -121,7 +122,10 @@ func (m *Manager) Upgrade(name string, clusterVersion string, opt operator.Optio
switch inst.ComponentName() {
case spec.ComponentTiSpark:
env := environment.GlobalEnv()
sparkVer, _, err := env.V1Repository().LatestStableVersion(spec.ComponentSpark, false)
sparkVer, _, err := env.V1Repository().WithOptions(repository.Options{
GOOS: inst.OS(),
GOARCH: inst.Arch(),
}).LatestStableVersion(spec.ComponentSpark, false)
if err != nil {
return err
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/cluster/task/copy_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/pingcap/tiup/pkg/cluster/spec"
"github.com/pingcap/tiup/pkg/environment"
"github.com/pingcap/tiup/pkg/repository"
)

// CopyComponent is used to copy all files related the specific version a component
Expand All @@ -38,7 +39,10 @@ func (c *CopyComponent) Execute(ctx context.Context) error {
// If the version is not specified, the last stable one will be used
if c.version == "" {
env := environment.GlobalEnv()
ver, _, err := env.V1Repository().LatestStableVersion(c.component, false)
ver, _, err := env.V1Repository().WithOptions(repository.Options{
GOOS: c.os,
GOARCH: c.arch,
}).LatestStableVersion(c.component, false)
if err != nil {
return err
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/cluster/task/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

operator "github.com/pingcap/tiup/pkg/cluster/operation"
"github.com/pingcap/tiup/pkg/environment"
"github.com/pingcap/tiup/pkg/repository"
)

// Downloader is used to download the specific version of a component from
Expand All @@ -45,7 +46,10 @@ func (d *Downloader) Execute(_ context.Context) error {
// If the version is not specified, the last stable one will be used
if d.version == "" {
env := environment.GlobalEnv()
ver, _, err := env.V1Repository().LatestStableVersion(d.component, false)
ver, _, err := env.V1Repository().WithOptions(repository.Options{
GOOS: d.os,
GOARCH: d.arch,
}).LatestStableVersion(d.component, false)
if err != nil {
return err
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/repository/v1_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func NewV1Repo(mirror Mirror, opts Options, local v1manifest.LocalManifests) *V1
const maxTimeStampSize uint = 1024
const maxRootSize uint = 1024 * 1024

// WithOptions clone a new V1Repository with given options
func (r *V1Repository) WithOptions(opts Options) *V1Repository {
return NewV1Repo(r.Mirror(), opts, r.Local())
}

// Mirror returns Mirror
func (r *V1Repository) Mirror() Mirror {
return r.mirror
Expand Down