diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/common.go | 18 | ||||
-rw-r--r-- | config/common_test.go | 3 | ||||
-rw-r--r-- | config/flag_test.go | 3 | ||||
-rw-r--r-- | config/variant.go | 14 | ||||
-rw-r--r-- | config/variant_test.go | 13 |
5 files changed, 12 insertions, 39 deletions
diff --git a/config/common.go b/config/common.go index 0bdd4e4..32311b8 100644 --- a/config/common.go +++ b/config/common.go @@ -8,15 +8,14 @@ import ( // and each configured variant. // type CommonConfig struct { - Base string `yaml:"base" validate:"omitempty,baseimage"` // name/path to base image - Apt AptConfig `yaml:"apt"` // APT related - Node NodeConfig `yaml:"node"` // Node related - Python PythonConfig `yaml:"python"` // Python related - Builder BuilderConfig `yaml:"builder"` // Builder related - Lives LivesConfig `yaml:"lives"` // application owner/dir - Runs RunsConfig `yaml:"runs"` // runtime environment - SharedVolume Flag `yaml:"sharedvolume"` // use volume for app - EntryPoint []string `yaml:"entrypoint"` // entry-point executable + Base string `yaml:"base" validate:"omitempty,baseimage"` // name/path to base image + Apt AptConfig `yaml:"apt"` // APT related + Node NodeConfig `yaml:"node"` // Node related + Python PythonConfig `yaml:"python"` // Python related + Builder BuilderConfig `yaml:"builder"` // Builder related + Lives LivesConfig `yaml:"lives"` // application owner/dir + Runs RunsConfig `yaml:"runs"` // runtime environment + EntryPoint []string `yaml:"entrypoint"` // entry-point executable } // Merge takes another CommonConfig and merges its fields this one's. @@ -32,7 +31,6 @@ func (cc *CommonConfig) Merge(cc2 CommonConfig) { cc.Builder.Merge(cc2.Builder) cc.Lives.Merge(cc2.Lives) cc.Runs.Merge(cc2.Runs) - cc.SharedVolume.Merge(cc2.SharedVolume) if len(cc.EntryPoint) < 1 { cc.EntryPoint = cc2.EntryPoint diff --git a/config/common_test.go b/config/common_test.go index 535e64b..ba9333e 100644 --- a/config/common_test.go +++ b/config/common_test.go @@ -12,7 +12,6 @@ func TestCommonConfigYAML(t *testing.T) { cfg, err := config.ReadConfig([]byte(`--- version: v3 base: fooimage - sharedvolume: true entrypoint: ["/bin/foo"] variants: build: {}`)) @@ -20,13 +19,11 @@ func TestCommonConfigYAML(t *testing.T) { assert.Nil(t, err) assert.Equal(t, "fooimage", cfg.Base) - assert.Equal(t, true, cfg.SharedVolume.True) assert.Equal(t, []string{"/bin/foo"}, cfg.EntryPoint) variant, err := config.ExpandVariant(cfg, "build") assert.Equal(t, "fooimage", variant.Base) - assert.Equal(t, true, variant.SharedVolume.True) assert.Equal(t, []string{"/bin/foo"}, variant.EntryPoint) } diff --git a/config/flag_test.go b/config/flag_test.go index d4e2c70..b70174d 100644 --- a/config/flag_test.go +++ b/config/flag_test.go @@ -13,10 +13,8 @@ func TestFlagMerge(t *testing.T) { version: v3 base: foo runs: { insecurely: true } - sharedvolume: false variants: development: - sharedvolume: true runs: { insecurely: false }`)) if assert.NoError(t, err) { @@ -24,7 +22,6 @@ func TestFlagMerge(t *testing.T) { if assert.NoError(t, err) { assert.False(t, variant.Runs.Insecurely.True) - assert.True(t, variant.SharedVolume.True) } } } diff --git a/config/variant.go b/config/variant.go index 7886cfe..cc4d802 100644 --- a/config/variant.go +++ b/config/variant.go @@ -23,14 +23,12 @@ func (vc *VariantConfig) Merge(vc2 VariantConfig) { } // InstructionsForPhase injects build instructions related to artifact -// copying, volume definition or copying of application files, and all common -// configuration. +// copying, copying of application files, and all common configuration. // // PhaseInstall // -// If VariantConfig.Copies is not set, either copy in application files or -// define a shared volume. Otherwise, delegate to -// ArtifactsConfig.InstructionsForPhase. +// If VariantConfig.Copies is not set, copy in application files. Otherwise, +// delegate to ArtifactsConfig.InstructionsForPhase. // func (vc *VariantConfig) InstructionsForPhase(phase build.Phase) []build.Instruction { instructions := vc.CommonConfig.InstructionsForPhase(phase) @@ -53,11 +51,7 @@ func (vc *VariantConfig) InstructionsForPhase(phase build.Phase) []build.Instruc uid, gid = vc.Lives.UID, vc.Lives.GID if vc.Copies == "" { - if vc.SharedVolume.True { - instructions = append(instructions, build.Volume{vc.Lives.In}) - } else { - instructions = append(instructions, build.Copy{[]string{"."}, "."}) - } + instructions = append(instructions, build.Copy{[]string{"."}, "."}) } case build.PhasePostInstall: diff --git a/config/variant_test.go b/config/variant_test.go index d40437c..b073654 100644 --- a/config/variant_test.go +++ b/config/variant_test.go @@ -68,19 +68,6 @@ func TestVariantLoops(t *testing.T) { func TestVariantConfigInstructions(t *testing.T) { t.Run("PhaseInstall", func(t *testing.T) { - t.Run("shared volume", func(t *testing.T) { - cfg := config.VariantConfig{} - cfg.Lives.In = "/srv/service" - cfg.SharedVolume.True = true - - assert.Equal(t, - []build.Instruction{ - build.Volume{"/srv/service"}, - }, - cfg.InstructionsForPhase(build.PhaseInstall), - ) - }) - t.Run("standard source copy", func(t *testing.T) { cfg := config.VariantConfig{} cfg.Lives.UID = 123 |