Merge pull request #1074 from TomChv/feat/pipeline-platform-config

Handle running architecture configuration
This commit is contained in:
Sam Alba
2021-11-01 16:14:20 -07:00
committed by GitHub
14 changed files with 162 additions and 29 deletions

View File

@@ -9,6 +9,8 @@ import (
"strings"
"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"
@@ -41,8 +43,9 @@ var computeCmd = &cobra.Command{
doneCh := common.TrackCommand(ctx, cmd)
st := &state.State{
Name: "FIXME",
Path: args[0],
Name: "FIXME",
Architecture: platforms.Format(specs.Platform{OS: "linux", Architecture: "amd64"}),
Path: args[0],
Plan: state.Plan{
Module: args[0],
},

View File

@@ -73,6 +73,7 @@ var editCmd = &cobra.Command{
lg.Fatal().Err(err).Msg("failed to decode file")
}
st.Name = newState.Name
st.Architecture = newState.Architecture
st.Plan = newState.Plan
st.Inputs = newState.Inputs

View File

@@ -34,7 +34,7 @@ var newCmd = &cobra.Command{
st, err := project.Create(ctx, name, state.Plan{
Package: viper.GetString("package"),
})
}, viper.GetString("architecture"))
if err != nil {
lg.Fatal().Err(err).Msg("failed to create environment")
@@ -46,6 +46,7 @@ var newCmd = &cobra.Command{
func init() {
newCmd.Flags().StringP("package", "p", "", "references the name of the Cue package within the module to use as a plan. Default: defer to cue loader")
newCmd.Flags().StringP("architecture", "a", "", "architecture of the running pipeline. Default: host architecture")
if err := viper.BindPFlags(newCmd.Flags()); err != nil {
panic(err)
}