Fix engine to don't write architecture in values.yaml if no one provided.
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
parent
0839cfd1d0
commit
4a461a0021
@ -10,6 +10,7 @@ import (
|
||||
|
||||
"cuelang.org/go/cue"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"go.dagger.io/dagger/cmd/dagger/cmd/common"
|
||||
"go.dagger.io/dagger/cmd/dagger/logger"
|
||||
"go.dagger.io/dagger/compiler"
|
||||
@ -43,7 +44,7 @@ var computeCmd = &cobra.Command{
|
||||
|
||||
st := &state.State{
|
||||
Name: "FIXME",
|
||||
Architecture: platforms.Format(platforms.DefaultSpec()),
|
||||
Architecture: platforms.Format(specs.Platform{OS: "linux", Architecture: "amd64"}),
|
||||
Path: args[0],
|
||||
Plan: state.Plan{
|
||||
Module: args[0],
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"cuelang.org/go/cue"
|
||||
cueflow "cuelang.org/go/tools/flow"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"go.dagger.io/dagger/compiler"
|
||||
"go.dagger.io/dagger/solver"
|
||||
"go.dagger.io/dagger/state"
|
||||
@ -199,18 +200,24 @@ func newPipelineRunner(computed *compiler.Value, s solver.Solver, platform strin
|
||||
}
|
||||
v := compiler.Wrap(t.Value())
|
||||
|
||||
platform, err := platforms.Parse(platform)
|
||||
if err != nil {
|
||||
// Record the error
|
||||
span.AddEvent("command", trace.WithAttributes(
|
||||
attribute.String("error", err.Error()),
|
||||
))
|
||||
var pipelinePlatform specs.Platform
|
||||
if platform == "" {
|
||||
pipelinePlatform = specs.Platform{OS: "linux", Architecture: "amd64"}
|
||||
} else {
|
||||
p, err := platforms.Parse(platform)
|
||||
if err != nil {
|
||||
// Record the error
|
||||
span.AddEvent("command", trace.WithAttributes(
|
||||
attribute.String("error", err.Error()),
|
||||
))
|
||||
|
||||
return err
|
||||
return err
|
||||
}
|
||||
pipelinePlatform = p
|
||||
}
|
||||
|
||||
p := NewPipeline(v, s, platform)
|
||||
err = p.Run(ctx)
|
||||
p := NewPipeline(v, s, pipelinePlatform)
|
||||
err := p.Run(ctx)
|
||||
if err != nil {
|
||||
// Record the error
|
||||
span.AddEvent("command", trace.WithAttributes(
|
||||
|
@ -10,8 +10,6 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd/platforms"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/rs/zerolog/log"
|
||||
"go.dagger.io/dagger/keychain"
|
||||
"go.dagger.io/dagger/stdlib"
|
||||
@ -184,10 +182,6 @@ 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,10 +257,6 @@ func (w *Project) Create(ctx context.Context, name string, plan Plan, arch strin
|
||||
|
||||
manifestPath := path.Join(envPath, manifestFile)
|
||||
|
||||
if arch == "" {
|
||||
arch = platforms.Format(specs.Platform{OS: "linux", Architecture: "amd64"})
|
||||
}
|
||||
|
||||
st := &State{
|
||||
Path: envPath,
|
||||
Project: w.Path,
|
||||
|
Reference in New Issue
Block a user