forked from vmware-archive/atc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resource_in.go
44 lines (37 loc) · 818 Bytes
/
resource_in.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
package resource
import (
"os"
"github.com/concourse/atc"
"github.com/concourse/atc/worker"
)
type inRequest struct {
Source atc.Source `json:"source"`
Params atc.Params `json:"params,omitempty"`
Version atc.Version `json:"version,omitempty"`
}
func (resource *resource) Get(
volume worker.Volume,
ioConfig IOConfig,
source atc.Source,
params atc.Params,
version atc.Version,
signals <-chan os.Signal,
ready chan<- struct{},
) (VersionedSource, error) {
var vr versionResult
runner := resource.runScript(
"/opt/resource/in",
[]string{ResourcesDir("get")},
inRequest{source, params, version},
&vr,
ioConfig.Stderr,
nil,
nil,
true,
)
err := runner.Run(signals, ready)
if err != nil {
return nil, err
}
return NewGetVersionedSource(volume, vr.Version, vr.Metadata), nil
}