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

remove goarch from image base and support for automated platform arch… #201

Merged
merged 1 commit into from
Nov 19, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions platform/host_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ func (bh *BraveHost) StopUnit(name string) error {
fmt.Println("Stopping unit: ", name)
err = Stop(lxdServer, name)
if err != nil {
return errors.New("Failed to stop unit: " + err.Error())
return errors.New("failed to stop unit: " + err.Error())
}

return nil
Expand All @@ -811,7 +811,7 @@ func (bh *BraveHost) StartUnit(name string) error {
if remoteName == shared.BravetoolsRemote {
err := bh.Backend.Start()
if err != nil {
return errors.New("Failed to start backend: " + err.Error())
return errors.New("failed to start backend: " + err.Error())
}
}

Expand All @@ -828,7 +828,7 @@ func (bh *BraveHost) StartUnit(name string) error {
fmt.Println("Starting unit: ", name)
err = Start(lxdServer, name)
if err != nil {
return errors.New("Failed to start unit: " + err.Error())
return errors.New("failed to start unit: " + err.Error())
}

return nil
Expand Down
19 changes: 16 additions & 3 deletions platform/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,20 @@ func Launch(ctx context.Context, localLxd lxd.InstanceServer, name string, alias

a := strings.Split(alias, "/")
if len(a) < 3 {
alias = alias + "/" + runtime.GOARCH
arch, err := GetLXDServerArch(localLxd)
imageArch := arch

switch arch {
case "aarch64":
imageArch = "arm64"
case "x86_64":
imageArch = "amd64"
}

if err != nil {
return fingerprint, err
}
alias = alias + "/" + imageArch
}

operation := shared.Info("Importing " + alias)
Expand Down Expand Up @@ -565,12 +578,12 @@ func Launch(ctx context.Context, localLxd lxd.InstanceServer, name string, alias

op, err := localLxd.CreateContainer(req)
if err != nil {
return fingerprint, errors.New("Failed to create unit: " + err.Error())
return fingerprint, errors.New("failed to create unit: " + err.Error())
}

err = op.Wait()
if err != nil {
return fingerprint, errors.New("Error waiting: " + err.Error())
return fingerprint, errors.New("error waiting: " + err.Error())
}

// Wait for container to be properly set up while checking for interrupts
Expand Down
8 changes: 4 additions & 4 deletions shared/bravefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"net/http"
"runtime"
"strings"

"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -80,10 +79,11 @@ type Bravefile struct {

// NewBravefile ..
func NewBravefile() *Bravefile {

return &Bravefile{
Base: ImageDescription{
Architecture: runtime.GOARCH,
},
// Base: ImageDescription{
// Architecture: runtime.GOARCH,
// },
PlatformService: Service{
Resources: Resources{
CPU: DefaultUnitCpuLimit,
Expand Down