@@ -27,14 +27,8 @@ const (
27
27
CustomBuilderSchema = "olm.builder.custom"
28
28
)
29
29
30
- type ContainerConfig struct {
31
- ContainerTool string
32
- BaseImage string
33
- WorkingDir string
34
- }
35
-
36
30
type BuilderConfig struct {
37
- ContainerCfg ContainerConfig
31
+ WorkingDir string
38
32
OutputType string
39
33
}
40
34
@@ -95,13 +89,13 @@ func (bb *BasicBuilder) Build(ctx context.Context, reg image.Registry, dir strin
95
89
return fmt .Errorf ("error rendering basic template: %v" , err )
96
90
}
97
91
98
- destPath := path .Join (bb .builderCfg .ContainerCfg . WorkingDir , dir , basicConfig .Output )
92
+ destPath := path .Join (bb .builderCfg .WorkingDir , dir , basicConfig .Output )
99
93
100
94
return build (dcfg , destPath , bb .builderCfg .OutputType )
101
95
}
102
96
103
97
func (bb * BasicBuilder ) Validate (dir string ) error {
104
- return validate (bb .builderCfg . ContainerCfg , dir )
98
+ return validate (bb .builderCfg , dir )
105
99
}
106
100
107
101
type SemverBuilder struct {
@@ -157,13 +151,13 @@ func (sb *SemverBuilder) Build(ctx context.Context, reg image.Registry, dir stri
157
151
return fmt .Errorf ("error rendering semver template: %v" , err )
158
152
}
159
153
160
- destPath := path .Join (sb .builderCfg .ContainerCfg . WorkingDir , dir , semverConfig .Output )
154
+ destPath := path .Join (sb .builderCfg .WorkingDir , dir , semverConfig .Output )
161
155
162
156
return build (dcfg , destPath , sb .builderCfg .OutputType )
163
157
}
164
158
165
159
func (sb * SemverBuilder ) Validate (dir string ) error {
166
- return validate (sb .builderCfg . ContainerCfg , dir )
160
+ return validate (sb .builderCfg , dir )
167
161
}
168
162
169
163
type RawBuilder struct {
@@ -217,13 +211,13 @@ func (rb *RawBuilder) Build(ctx context.Context, _ image.Registry, dir string, t
217
211
return fmt .Errorf ("error parsing raw input file: %s, %v" , rawConfig .Input , err )
218
212
}
219
213
220
- destPath := path .Join (rb .builderCfg .ContainerCfg . WorkingDir , dir , rawConfig .Output )
214
+ destPath := path .Join (rb .builderCfg .WorkingDir , dir , rawConfig .Output )
221
215
222
216
return build (dcfg , destPath , rb .builderCfg .OutputType )
223
217
}
224
218
225
219
func (rb * RawBuilder ) Validate (dir string ) error {
226
- return validate (rb .builderCfg . ContainerCfg , dir )
220
+ return validate (rb .builderCfg , dir )
227
221
}
228
222
229
223
type CustomBuilder struct {
@@ -284,15 +278,15 @@ func (cb *CustomBuilder) Build(ctx context.Context, reg image.Registry, dir stri
284
278
return fmt .Errorf ("error parsing custom command output: %s, %v" , strings .Join (cmdString , "'" ), err )
285
279
}
286
280
287
- destPath := path .Join (cb .builderCfg .ContainerCfg . WorkingDir , dir , customConfig .Output )
281
+ destPath := path .Join (cb .builderCfg .WorkingDir , dir , customConfig .Output )
288
282
289
283
// custom template should output a valid FBC to STDOUT so we can
290
284
// build the FBC just like all the other templates.
291
285
return build (dcfg , destPath , cb .builderCfg .OutputType )
292
286
}
293
287
294
288
func (cb * CustomBuilder ) Validate (dir string ) error {
295
- return validate (cb .builderCfg . ContainerCfg , dir )
289
+ return validate (cb .builderCfg , dir )
296
290
}
297
291
298
292
func writeDeclCfg (dcfg declcfg.DeclarativeConfig , w io.Writer , output string ) error {
@@ -306,12 +300,12 @@ func writeDeclCfg(dcfg declcfg.DeclarativeConfig, w io.Writer, output string) er
306
300
}
307
301
}
308
302
309
- func validate (containerCfg ContainerConfig , dir string ) error {
303
+ func validate (builderCfg BuilderConfig , dir string ) error {
310
304
311
- path := path .Join (containerCfg .WorkingDir , dir )
305
+ path := path .Join (builderCfg .WorkingDir , dir )
312
306
s , err := os .Stat (path )
313
307
if err != nil {
314
- return fmt .Errorf ("directory not found. validation path needs to be composed of ContainerConfig .WorkingDir+Component[].Destination.Path: %q: %v" , path , err )
308
+ return fmt .Errorf ("directory not found. validation path needs to be composed of BuilderConfig .WorkingDir+Component[].Destination.Path: %q: %v" , path , err )
315
309
}
316
310
if ! s .IsDir () {
317
311
return fmt .Errorf ("%q is not a directory" , path )
0 commit comments