forked from vmware-archive/atc
/
factory.go
145 lines (123 loc) · 2.71 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package exec
import (
"io"
"time"
"code.cloudfoundry.org/clock"
"code.cloudfoundry.org/lager"
"github.com/concourse/atc"
"github.com/concourse/atc/worker"
)
//go:generate counterfeiter . Factory
// Factory is used when building up the steps for a build.
type Factory interface {
// Get constructs a GetStep factory.
Get(
lager.Logger,
StepMetadata,
SourceName,
worker.Identifier,
worker.Metadata,
GetDelegate,
atc.ResourceConfig,
atc.Tags,
int,
atc.Params,
atc.Version,
atc.ResourceTypes,
time.Duration,
time.Duration,
) StepFactory
// Put constructs a PutStep factory.
Put(
lager.Logger,
StepMetadata,
worker.Identifier,
worker.Metadata,
PutDelegate,
atc.ResourceConfig,
atc.Tags,
int,
atc.Params,
atc.ResourceTypes,
time.Duration,
time.Duration,
) StepFactory
// DependentGet constructs a GetStep factory whose version is determined by
// the previous step.
DependentGet(
lager.Logger,
StepMetadata,
SourceName,
worker.Identifier,
worker.Metadata,
GetDelegate,
atc.ResourceConfig,
atc.Tags,
int,
atc.Params,
atc.ResourceTypes,
time.Duration,
time.Duration,
) StepFactory
// Task constructs a TaskStep factory.
Task(
lager.Logger,
SourceName,
worker.Identifier,
worker.Metadata,
TaskDelegate,
Privileged,
atc.Tags,
int,
TaskConfigSource,
atc.ResourceTypes,
map[string]string,
map[string]string,
string,
clock.Clock,
time.Duration,
time.Duration,
) StepFactory
}
// StepMetadata is used to inject metadata to make available to the step when
// it's running.
type StepMetadata interface {
Env() []string
}
//go:generate counterfeiter . TaskDelegate
// TaskDelegate is used to record events related to a TaskStep's runtime
// behavior.
type TaskDelegate interface {
Initializing(atc.TaskConfig)
Started()
Finished(ExitStatus)
Failed(error)
ImageVersionDetermined(worker.VolumeIdentifier) error
Stdout() io.Writer
Stderr() io.Writer
}
// ResourceDelegate is used to record events related to a resource's runtime
// behavior.
type ResourceDelegate interface {
Initializing()
Completed(ExitStatus, *VersionInfo)
Failed(error)
ImageVersionDetermined(worker.VolumeIdentifier) error
Stdout() io.Writer
Stderr() io.Writer
}
//go:generate counterfeiter . GetDelegate
// GetDelegate is used to record events related to a GetStep's runtime
// behavior.
type GetDelegate interface {
ResourceDelegate
}
//go:generate counterfeiter . PutDelegate
// PutDelegate is used to record events related to a PutStep's runtime
// behavior.
type PutDelegate interface {
ResourceDelegate
}
// Privileged is used to indicate whether the given step should run with
// special privileges (i.e. as an administrator user).
type Privileged bool