From af9e797908c0d5ed7780a5386aa773ecdd9cc51c Mon Sep 17 00:00:00 2001 From: Dan Duvall Date: Mon, 17 Sep 2018 16:00:05 -0700 Subject: Remove support for `sharedvolume` configuration Support for mounting a shared volume instead of copying application files was meant to provide an option for development use cases. This functionality has never been thoroughly tested or utilized for any use case. It should be removed for now. Relates tangentially to task T204591 that simplifies node support. Change-Id: Ib70cb7bceb504841897a38d732880ba376fe67c8 --- README.md | 1 - blubber.example.yaml | 1 - build/instructions.go | 13 ------------- build/instructions_test.go | 6 ------ config/common.go | 18 ++++++++---------- config/common_test.go | 3 --- config/flag_test.go | 3 --- config/variant.go | 14 ++++---------- config/variant_test.go | 13 ------------- docker/instructions.go | 4 ---- docker/instructions_test.go | 10 ---------- 11 files changed, 12 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index b50ba20..0c8dc4c 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ variants: development: includes: [build] - sharedvolume: true test: includes: [build] diff --git a/blubber.example.yaml b/blubber.example.yaml index 8f39c9b..e9b1a09 100644 --- a/blubber.example.yaml +++ b/blubber.example.yaml @@ -24,7 +24,6 @@ variants: development: includes: [build] - sharedvolume: true test: includes: [build] diff --git a/build/instructions.go b/build/instructions.go index d6cc1c3..4e48e88 100644 --- a/build/instructions.go +++ b/build/instructions.go @@ -173,19 +173,6 @@ func (user User) Compile() []string { return []string{quote(user.Name)} } -// Volume is a concrete build instruction for defining a volume mount point -// within the container. -// -type Volume struct { - Path string // volume/mount path -} - -// Compile returns the quoted volume path. -// -func (vol Volume) Compile() []string { - return []string{quote(vol.Path)} -} - // WorkingDirectory is a build instruction for defining the working directory // for future command and entrypoint instructions. // diff --git a/build/instructions_test.go b/build/instructions_test.go index 7cc2b20..0bf07b9 100644 --- a/build/instructions_test.go +++ b/build/instructions_test.go @@ -104,12 +104,6 @@ func TestUser(t *testing.T) { assert.Equal(t, []string{`"foo"`}, i.Compile()) } -func TestVolume(t *testing.T) { - i := build.Volume{"/foo/dir"} - - assert.Equal(t, []string{`"/foo/dir"`}, i.Compile()) -} - func TestWorkingDirectory(t *testing.T) { i := build.WorkingDirectory{"/foo/path"} 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 diff --git a/docker/instructions.go b/docker/instructions.go index 8f5c63c..4095eb4 100644 --- a/docker/instructions.go +++ b/docker/instructions.go @@ -51,10 +51,6 @@ func NewInstruction(bi build.Instruction) (Instruction, error) { case build.User: i.name = "USER" - case build.Volume: - i.name = "VOLUME" - i.array = true - case build.WorkingDirectory: i.name = "WORKDIR" } diff --git a/docker/instructions_test.go b/docker/instructions_test.go index b89a721..7124ff0 100644 --- a/docker/instructions_test.go +++ b/docker/instructions_test.go @@ -113,16 +113,6 @@ func TestUser(t *testing.T) { } } -func TestVolume(t *testing.T) { - i := build.Volume{"/foo/dir"} - - di, err := docker.NewInstruction(i) - - if assert.NoError(t, err) { - assert.Equal(t, "VOLUME [\"/foo/dir\"]\n", di.Compile()) - } -} - func TestWorkingDirectory(t *testing.T) { i := build.WorkingDirectory{"/foo/dir"} -- cgit v1.2.1