-
Notifications
You must be signed in to change notification settings - Fork 278
/
phase_factory.go
40 lines (33 loc) · 1.19 KB
/
phase_factory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package build
import "context"
type RunnerCleaner interface {
Run(ctx context.Context) error
Cleanup() error
}
type PhaseFactory interface {
New(provider *PhaseConfigProvider) RunnerCleaner
}
type DefaultPhaseFactory struct {
lifecycleExec *LifecycleExecution
}
type PhaseFactoryCreator func(*LifecycleExecution) PhaseFactory
func NewDefaultPhaseFactory(lifecycleExec *LifecycleExecution) PhaseFactory {
return &DefaultPhaseFactory{lifecycleExec: lifecycleExec}
}
func (m *DefaultPhaseFactory) New(provider *PhaseConfigProvider) RunnerCleaner {
return &Phase{
ctrConf: provider.ContainerConfig(),
hostConf: provider.HostConfig(),
name: provider.Name(),
docker: m.lifecycleExec.docker,
infoWriter: provider.InfoWriter(),
errorWriter: provider.ErrorWriter(),
handler: provider.handler,
uid: m.lifecycleExec.opts.Builder.UID(),
gid: m.lifecycleExec.opts.Builder.GID(),
appPath: m.lifecycleExec.opts.AppPath,
containerOps: provider.containerOps,
postContainerRunOps: provider.postContainerRunOps,
fileFilter: m.lifecycleExec.opts.FileFilter,
}
}