Update dagger engine to uses a given architecture instead of default one.

Check #1071 for more details

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau
2021-10-22 20:52:25 +02:00
parent 428aca1c03
commit caa03a37cc
9 changed files with 63 additions and 25 deletions

View File

@@ -10,6 +10,7 @@ import (
"path/filepath"
"strings"
"github.com/containerd/containerd/platforms"
"github.com/rs/zerolog/log"
"go.dagger.io/dagger/keychain"
"go.dagger.io/dagger/stdlib"
@@ -182,6 +183,10 @@ func (w *Project) Get(ctx context.Context, name string) (*State, error) {
}
st.Project = w.Path
if st.Architecture == "" {
st.Architecture = platforms.DefaultString()
}
computed, err := os.ReadFile(path.Join(envPath, stateDir, computedFile))
if err == nil {
st.Computed = string(computed)
@@ -263,7 +268,8 @@ func (w *Project) Create(ctx context.Context, name string, plan Plan) (*State, e
Plan: Plan{
Package: pkg,
},
Name: name,
Name: name,
Architecture: platforms.DefaultString(),
}
data, err := yaml.Marshal(st)

View File

@@ -24,6 +24,9 @@ type State struct {
// FIXME: store multiple names?
Name string `yaml:"name,omitempty"`
// Architecture execution
Architecture string `yaml:"architecture,omitempty"`
// User Inputs
Inputs map[string]Input `yaml:"inputs,omitempty"`