forked from Ivasoft/github-actions
Allow KVM access on request
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
10
plugin.go
10
plugin.go
@@ -39,6 +39,7 @@ type (
|
||||
Actor string
|
||||
Verbose bool
|
||||
NoForcePull bool
|
||||
Kvm bool
|
||||
}
|
||||
|
||||
Plugin struct {
|
||||
@@ -94,7 +95,11 @@ func (p Plugin) Exec() error {
|
||||
}
|
||||
|
||||
if p.Action.NoForcePull {
|
||||
cmdArgs = append(cmdArgs, "-p=false")
|
||||
cmdArgs = append(cmdArgs, "--pull=false")
|
||||
}
|
||||
|
||||
if p.Action.Kvm {
|
||||
cmdArgs = append(cmdArgs, "--privileged")
|
||||
}
|
||||
|
||||
if p.Daemon.Disabled {
|
||||
@@ -111,6 +116,9 @@ func (p Plugin) Exec() error {
|
||||
bindModifiers = ":z"
|
||||
}
|
||||
cmdArgs = append(cmdArgs, "--container-options", fmt.Sprintf("--volume=%s:%s%s", hostWorkDirPath, guestWorkDirPath, bindModifiers))
|
||||
if p.Action.Kvm {
|
||||
cmdArgs = append(cmdArgs, "--volume=/dev/kvm:/dev/kvm")
|
||||
}
|
||||
}
|
||||
|
||||
cmd := exec.Command("act", cmdArgs...)
|
||||
|
||||
Reference in New Issue
Block a user