forked from hashicorp/nomad
/
targets.go
46 lines (39 loc) · 1.57 KB
/
targets.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
package provisioning
import "testing"
// ProvisioningTargets is a set of hosts that will get a Nomad and/or Consul
// deployment.
type ProvisioningTargets struct {
Servers []*ProvisioningTarget `json:"servers"`
Clients []*ProvisioningTarget `json:"clients"`
}
// ProvisioningTarget is a specific host that will get a Nomad and/or Consul
// deployment.
type ProvisioningTarget struct {
Deployment Deployment `json:"deployment"`
Runner map[string]interface{} `json:"runner"`
runner ProvisioningRunner
}
type Deployment struct {
// Note: these override each other. NomadLocalBinary > NomadSha > NomadVersion
NomadLocalBinary string `json:"nomad_local_binary"`
NomadSha string `json:"nomad_sha"`
NomadVersion string `json:"nomad_version"`
RemoteBinaryPath string `json:"remote_binary_path"`
Platform string `json:"platform"`
Bundles []Bundle `json:"bundles"`
Steps []string `json:"steps"`
}
// Bundle is an arbitrary collection of files to support Nomad, Consul,
// etc. that will be placed as part of provisioning.
type Bundle struct {
Source string `json:"source"`
Destination string `json:"destination"`
}
// ProvisioningRunner is the interface for how a Provisioner will connect
// with a target and execute steps. Each target has its own runner.
type ProvisioningRunner interface {
Open(t *testing.T) error // start the runner, caching connection info
Run(string) error // run one step
Copy(string, string) error // copy a file
Close() // clean up the runner, call in a defer
}