Update dagger new cmd to specify architecture when creating an environment

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau
2021-10-22 21:54:18 +02:00
parent caa03a37cc
commit e9de597654
3 changed files with 12 additions and 5 deletions

View File

@@ -240,7 +240,7 @@ func (w *Project) Save(ctx context.Context, st *State) error {
return nil
}
func (w *Project) Create(ctx context.Context, name string, plan Plan) (*State, error) {
func (w *Project) Create(ctx context.Context, name string, plan Plan, arch string) (*State, error) {
if _, err := w.Get(ctx, name); err == nil {
return nil, ErrExist
}
@@ -262,6 +262,10 @@ func (w *Project) Create(ctx context.Context, name string, plan Plan) (*State, e
manifestPath := path.Join(envPath, manifestFile)
if arch == "" {
arch = platforms.Format(platforms.DefaultSpec())
}
st := &State{
Path: envPath,
Project: w.Path,
@@ -269,7 +273,7 @@ func (w *Project) Create(ctx context.Context, name string, plan Plan) (*State, e
Package: pkg,
},
Name: name,
Architecture: platforms.DefaultString(),
Architecture: arch,
}
data, err := yaml.Marshal(st)