Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ func main() {
Usage: "Webhook event payload",
EnvVar: "PLUGIN_EVENT_PAYLOAD",
},
cli.StringFlag{
Name: "actor",
Usage: "User that triggered the event",
EnvVar: "PLUGIN_ACTOR",
},

// daemon flags
cli.StringFlag{
Expand Down Expand Up @@ -179,6 +184,7 @@ func run(c *cli.Context) error {
Verbose: c.Bool("action-verbose"),
Image: c.String("action-image"),
EventPayload: c.String("event-payload"),
Actor: c.String("actor"),
},
Daemon: daemon.Daemon{
Registry: c.String("docker.registry"),
Expand Down
7 changes: 7 additions & 0 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type (
Env map[string]string
Image string
EventPayload string // Webhook event payload
Actor string
Verbose bool
}

Expand Down Expand Up @@ -67,6 +68,12 @@ func (p Plugin) Exec() error {
"--detect-event",
}

// optional arguments
if p.Action.Actor != "" {
cmdArgs = append(cmdArgs, "--actor")
cmdArgs = append(cmdArgs, p.Action.Actor)
}

if p.Action.EventPayload != "" {
if err := ioutil.WriteFile(eventPayloadFile, []byte(p.Action.EventPayload), 0644); err != nil {
return errors.Wrap(err, "failed to write event payload to file")
Expand Down