Browse Source

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
Dan Duvall 1 year ago
parent
commit
af9e797908

+ 0
- 1
README.md View File

@@ -31,7 +31,6 @@ variants:
31 31
 
32 32
   development:
33 33
     includes: [build]
34
-    sharedvolume: true
35 34
 
36 35
   test:
37 36
     includes: [build]

+ 0
- 1
blubber.example.yaml View File

@@ -24,7 +24,6 @@ variants:
24 24
 
25 25
   development:
26 26
     includes: [build]
27
-    sharedvolume: true
28 27
 
29 28
   test:
30 29
     includes: [build]

+ 0
- 13
build/instructions.go View File

@@ -173,19 +173,6 @@ func (user User) Compile() []string {
173 173
 	return []string{quote(user.Name)}
174 174
 }
175 175
 
176
-// Volume is a concrete build instruction for defining a volume mount point
177
-// within the container.
178
-//
179
-type Volume struct {
180
-	Path string // volume/mount path
181
-}
182
-
183
-// Compile returns the quoted volume path.
184
-//
185
-func (vol Volume) Compile() []string {
186
-	return []string{quote(vol.Path)}
187
-}
188
-
189 176
 // WorkingDirectory is a build instruction for defining the working directory
190 177
 // for future command and entrypoint instructions.
191 178
 //

+ 0
- 6
build/instructions_test.go View File

@@ -104,12 +104,6 @@ func TestUser(t *testing.T) {
104 104
 	assert.Equal(t, []string{`"foo"`}, i.Compile())
105 105
 }
106 106
 
107
-func TestVolume(t *testing.T) {
108
-	i := build.Volume{"/foo/dir"}
109
-
110
-	assert.Equal(t, []string{`"/foo/dir"`}, i.Compile())
111
-}
112
-
113 107
 func TestWorkingDirectory(t *testing.T) {
114 108
 	i := build.WorkingDirectory{"/foo/path"}
115 109
 

+ 8
- 10
config/common.go View File

@@ -8,15 +8,14 @@ import (
8 8
 // and each configured variant.
9 9
 //
10 10
 type CommonConfig struct {
11
-	Base         string        `yaml:"base" validate:"omitempty,baseimage"` // name/path to base image
12
-	Apt          AptConfig     `yaml:"apt"`                                 // APT related
13
-	Node         NodeConfig    `yaml:"node"`                                // Node related
14
-	Python       PythonConfig  `yaml:"python"`                              // Python related
15
-	Builder      BuilderConfig `yaml:"builder"`                             // Builder related
16
-	Lives        LivesConfig   `yaml:"lives"`                               // application owner/dir
17
-	Runs         RunsConfig    `yaml:"runs"`                                // runtime environment
18
-	SharedVolume Flag          `yaml:"sharedvolume"`                        // use volume for app
19
-	EntryPoint   []string      `yaml:"entrypoint"`                          // entry-point executable
11
+	Base       string        `yaml:"base" validate:"omitempty,baseimage"` // name/path to base image
12
+	Apt        AptConfig     `yaml:"apt"`                                 // APT related
13
+	Node       NodeConfig    `yaml:"node"`                                // Node related
14
+	Python     PythonConfig  `yaml:"python"`                              // Python related
15
+	Builder    BuilderConfig `yaml:"builder"`                             // Builder related
16
+	Lives      LivesConfig   `yaml:"lives"`                               // application owner/dir
17
+	Runs       RunsConfig    `yaml:"runs"`                                // runtime environment
18
+	EntryPoint []string      `yaml:"entrypoint"`                          // entry-point executable
20 19
 }
21 20
 
22 21
 // Merge takes another CommonConfig and merges its fields this one's.
@@ -32,7 +31,6 @@ func (cc *CommonConfig) Merge(cc2 CommonConfig) {
32 31
 	cc.Builder.Merge(cc2.Builder)
33 32
 	cc.Lives.Merge(cc2.Lives)
34 33
 	cc.Runs.Merge(cc2.Runs)
35
-	cc.SharedVolume.Merge(cc2.SharedVolume)
36 34
 
37 35
 	if len(cc.EntryPoint) < 1 {
38 36
 		cc.EntryPoint = cc2.EntryPoint

+ 0
- 3
config/common_test.go View File

@@ -12,7 +12,6 @@ func TestCommonConfigYAML(t *testing.T) {
12 12
 	cfg, err := config.ReadConfig([]byte(`---
13 13
     version: v3
14 14
     base: fooimage
15
-    sharedvolume: true
16 15
     entrypoint: ["/bin/foo"]
17 16
     variants:
18 17
       build: {}`))
@@ -20,13 +19,11 @@ func TestCommonConfigYAML(t *testing.T) {
20 19
 	assert.Nil(t, err)
21 20
 
22 21
 	assert.Equal(t, "fooimage", cfg.Base)
23
-	assert.Equal(t, true, cfg.SharedVolume.True)
24 22
 	assert.Equal(t, []string{"/bin/foo"}, cfg.EntryPoint)
25 23
 
26 24
 	variant, err := config.ExpandVariant(cfg, "build")
27 25
 
28 26
 	assert.Equal(t, "fooimage", variant.Base)
29
-	assert.Equal(t, true, variant.SharedVolume.True)
30 27
 	assert.Equal(t, []string{"/bin/foo"}, variant.EntryPoint)
31 28
 }
32 29
 

+ 0
- 3
config/flag_test.go View File

@@ -13,10 +13,8 @@ func TestFlagMerge(t *testing.T) {
13 13
     version: v3
14 14
     base: foo
15 15
     runs: { insecurely: true }
16
-    sharedvolume: false
17 16
     variants:
18 17
       development:
19
-        sharedvolume: true
20 18
         runs: { insecurely: false }`))
21 19
 
22 20
 	if assert.NoError(t, err) {
@@ -24,7 +22,6 @@ func TestFlagMerge(t *testing.T) {
24 22
 
25 23
 		if assert.NoError(t, err) {
26 24
 			assert.False(t, variant.Runs.Insecurely.True)
27
-			assert.True(t, variant.SharedVolume.True)
28 25
 		}
29 26
 	}
30 27
 }

+ 4
- 10
config/variant.go View File

@@ -23,14 +23,12 @@ func (vc *VariantConfig) Merge(vc2 VariantConfig) {
23 23
 }
24 24
 
25 25
 // InstructionsForPhase injects build instructions related to artifact
26
-// copying, volume definition or copying of application files, and all common
27
-// configuration.
26
+// copying, copying of application files, and all common configuration.
28 27
 //
29 28
 // PhaseInstall
30 29
 //
31
-// If VariantConfig.Copies is not set, either copy in application files or
32
-// define a shared volume. Otherwise, delegate to
33
-// ArtifactsConfig.InstructionsForPhase.
30
+// If VariantConfig.Copies is not set, copy in application files. Otherwise,
31
+// delegate to ArtifactsConfig.InstructionsForPhase.
34 32
 //
35 33
 func (vc *VariantConfig) InstructionsForPhase(phase build.Phase) []build.Instruction {
36 34
 	instructions := vc.CommonConfig.InstructionsForPhase(phase)
@@ -53,11 +51,7 @@ func (vc *VariantConfig) InstructionsForPhase(phase build.Phase) []build.Instruc
53 51
 		uid, gid = vc.Lives.UID, vc.Lives.GID
54 52
 
55 53
 		if vc.Copies == "" {
56
-			if vc.SharedVolume.True {
57
-				instructions = append(instructions, build.Volume{vc.Lives.In})
58
-			} else {
59
-				instructions = append(instructions, build.Copy{[]string{"."}, "."})
60
-			}
54
+			instructions = append(instructions, build.Copy{[]string{"."}, "."})
61 55
 		}
62 56
 
63 57
 	case build.PhasePostInstall:

+ 0
- 13
config/variant_test.go View File

@@ -68,19 +68,6 @@ func TestVariantLoops(t *testing.T) {
68 68
 
69 69
 func TestVariantConfigInstructions(t *testing.T) {
70 70
 	t.Run("PhaseInstall", func(t *testing.T) {
71
-		t.Run("shared volume", func(t *testing.T) {
72
-			cfg := config.VariantConfig{}
73
-			cfg.Lives.In = "/srv/service"
74
-			cfg.SharedVolume.True = true
75
-
76
-			assert.Equal(t,
77
-				[]build.Instruction{
78
-					build.Volume{"/srv/service"},
79
-				},
80
-				cfg.InstructionsForPhase(build.PhaseInstall),
81
-			)
82
-		})
83
-
84 71
 		t.Run("standard source copy", func(t *testing.T) {
85 72
 			cfg := config.VariantConfig{}
86 73
 			cfg.Lives.UID = 123

+ 0
- 4
docker/instructions.go View File

@@ -51,10 +51,6 @@ func NewInstruction(bi build.Instruction) (Instruction, error) {
51 51
 	case build.User:
52 52
 		i.name = "USER"
53 53
 
54
-	case build.Volume:
55
-		i.name = "VOLUME"
56
-		i.array = true
57
-
58 54
 	case build.WorkingDirectory:
59 55
 		i.name = "WORKDIR"
60 56
 	}

+ 0
- 10
docker/instructions_test.go View File

@@ -113,16 +113,6 @@ func TestUser(t *testing.T) {
113 113
 	}
114 114
 }
115 115
 
116
-func TestVolume(t *testing.T) {
117
-	i := build.Volume{"/foo/dir"}
118
-
119
-	di, err := docker.NewInstruction(i)
120
-
121
-	if assert.NoError(t, err) {
122
-		assert.Equal(t, "VOLUME [\"/foo/dir\"]\n", di.Compile())
123
-	}
124
-}
125
-
126 116
 func TestWorkingDirectory(t *testing.T) {
127 117
 	i := build.WorkingDirectory{"/foo/dir"}
128 118
 

Loading…
Cancel
Save