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"
|
"cuelang.org/go/cue"
|
||||||
"github.com/containerd/containerd/platforms"
|
"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/cmd/common"
|
||||||
"go.dagger.io/dagger/cmd/dagger/logger"
|
"go.dagger.io/dagger/cmd/dagger/logger"
|
||||||
"go.dagger.io/dagger/compiler"
|
"go.dagger.io/dagger/compiler"
|
||||||
@ -43,7 +44,7 @@ var computeCmd = &cobra.Command{
|
|||||||
|
|
||||||
st := &state.State{
|
st := &state.State{
|
||||||
Name: "FIXME",
|
Name: "FIXME",
|
||||||
Architecture: platforms.Format(platforms.DefaultSpec()),
|
Architecture: platforms.Format(specs.Platform{OS: "linux", Architecture: "amd64"}),
|
||||||
Path: args[0],
|
Path: args[0],
|
||||||
Plan: state.Plan{
|
Plan: state.Plan{
|
||||||
Module: args[0],
|
Module: args[0],
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
cueflow "cuelang.org/go/tools/flow"
|
cueflow "cuelang.org/go/tools/flow"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"go.dagger.io/dagger/compiler"
|
"go.dagger.io/dagger/compiler"
|
||||||
"go.dagger.io/dagger/solver"
|
"go.dagger.io/dagger/solver"
|
||||||
"go.dagger.io/dagger/state"
|
"go.dagger.io/dagger/state"
|
||||||
@ -199,18 +200,24 @@ func newPipelineRunner(computed *compiler.Value, s solver.Solver, platform strin
|
|||||||
}
|
}
|
||||||
v := compiler.Wrap(t.Value())
|
v := compiler.Wrap(t.Value())
|
||||||
|
|
||||||
platform, err := platforms.Parse(platform)
|
var pipelinePlatform specs.Platform
|
||||||
if err != nil {
|
if platform == "" {
|
||||||
// Record the error
|
pipelinePlatform = specs.Platform{OS: "linux", Architecture: "amd64"}
|
||||||
span.AddEvent("command", trace.WithAttributes(
|
} else {
|
||||||
attribute.String("error", err.Error()),
|
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)
|
p := NewPipeline(v, s, pipelinePlatform)
|
||||||
err = p.Run(ctx)
|
err := p.Run(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Record the error
|
// Record the error
|
||||||
span.AddEvent("command", trace.WithAttributes(
|
span.AddEvent("command", trace.WithAttributes(
|
||||||
|
@ -10,8 +10,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/containerd/platforms"
|
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"go.dagger.io/dagger/keychain"
|
"go.dagger.io/dagger/keychain"
|
||||||
"go.dagger.io/dagger/stdlib"
|
"go.dagger.io/dagger/stdlib"
|
||||||
@ -184,10 +182,6 @@ func (w *Project) Get(ctx context.Context, name string) (*State, error) {
|
|||||||
}
|
}
|
||||||
st.Project = w.Path
|
st.Project = w.Path
|
||||||
|
|
||||||
if st.Architecture == "" {
|
|
||||||
st.Architecture = platforms.DefaultString()
|
|
||||||
}
|
|
||||||
|
|
||||||
computed, err := os.ReadFile(path.Join(envPath, stateDir, computedFile))
|
computed, err := os.ReadFile(path.Join(envPath, stateDir, computedFile))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
st.Computed = string(computed)
|
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)
|
manifestPath := path.Join(envPath, manifestFile)
|
||||||
|
|
||||||
if arch == "" {
|
|
||||||
arch = platforms.Format(specs.Platform{OS: "linux", Architecture: "amd64"})
|
|
||||||
}
|
|
||||||
|
|
||||||
st := &State{
|
st := &State{
|
||||||
Path: envPath,
|
Path: envPath,
|
||||||
Project: w.Path,
|
Project: w.Path,
|
||||||
|
Reference in New Issue
Block a user