-
Notifications
You must be signed in to change notification settings - Fork 18
/
unix.go
41 lines (31 loc) · 995 Bytes
/
unix.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
package platform
import (
"fmt"
"path"
)
type UnixPlatform struct{}
func NewUnix() Platform {
return &UnixPlatform{}
}
func (platform *UnixPlatform) ProjectDirMountpoint() string {
return "/project-dir"
}
func (platform *UnixPlatform) WorkingVolumeMountpoint() string {
return "/tmp/cirrus-ci"
}
func (platform *UnixPlatform) AgentImage(version string) string {
return AgentImageBase + version
}
func (platform *UnixPlatform) CopyCommand(populate bool) []string {
copyCmd := fmt.Sprintf("cp /bin/cirrus-ci-agent %s",
path.Join(platform.WorkingVolumeMountpoint(), WorkingVolumeAgentBinary))
if populate {
copyCmd += fmt.Sprintf(" && rsync -r --filter=':- .gitignore' %s/ %s",
platform.ProjectDirMountpoint(),
path.Join(platform.WorkingVolumeMountpoint(), WorkingVolumeWorkingDir))
}
return []string{"/bin/sh", "-c", copyCmd}
}
func (platform *UnixPlatform) AgentBinaryPath() string {
return path.Join(platform.WorkingVolumeMountpoint(), WorkingVolumeAgentBinary)
}