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

@@ -235,7 +235,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
}
@@ -263,7 +263,8 @@ func (w *Project) Create(ctx context.Context, name string, plan Plan) (*State, e
Plan: Plan{
Package: pkg,
},
Name: name,
Name: name,
Architecture: arch,
}
data, err := yaml.Marshal(st)

View File

@@ -32,9 +32,10 @@ func TestProject(t *testing.T) {
// Create
st, err := project.Create(ctx, "test", Plan{
Module: ".",
})
}, "linux/amd64")
require.NoError(t, err)
require.Equal(t, "test", st.Name)
require.Equal(t, "linux/amd64", st.Architecture)
// Open
project, err = Open(ctx, root)
@@ -51,6 +52,7 @@ func TestProject(t *testing.T) {
env, err := project.Get(ctx, "test")
require.NoError(t, err)
require.Equal(t, "test", env.Name)
require.Equal(t, "linux/amd64", env.Architecture)
// Save
require.NoError(t, env.SetInput("foo", TextInput("bar")))
@@ -82,7 +84,7 @@ func TestEncryption(t *testing.T) {
_, err = project.Create(ctx, "test", Plan{
Module: ".",
})
}, "linux/amd64")
require.NoError(t, err)
// Set a plaintext input, make sure it is not encrypted

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"`