Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1291 from brewkode/master
Browse files Browse the repository at this point in the history
fix: update pipeline webhook event type payload
  • Loading branch information
svanharmelen authored Nov 24, 2021
2 parents 16f298f + 0135063 commit cdfb4b0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
15 changes: 11 additions & 4 deletions event_webhook_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,15 +698,22 @@ type PipelineEvent struct {
AllowFailure bool `json:"allow_failure"`
User *EventUser `json:"user"`
Runner struct {
ID int `json:"id"`
Description string `json:"description"`
Active bool `json:"active"`
IsShared bool `json:"is_shared"`
ID int `json:"id"`
Description string `json:"description"`
Active bool `json:"active"`
IsShared bool `json:"is_shared"`
RunnerType bool `json:"runner_type"`
Tags []string `json:"tags"`
} `json:"runner"`
ArtifactsFile struct {
Filename string `json:"filename"`
Size int `json:"size"`
} `json:"artifacts_file"`
Environment struct {
Name string `json:"name"`
Action string `json:"action"`
DeploymentTier string `json:"deployment_tier"`
} `json:"environment"`
} `json:"builds"`
}

Expand Down
4 changes: 4 additions & 0 deletions event_webhook_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ func TestPipelineEventUnmarshal(t *testing.T) {
if event.Builds[0].AllowFailure != true {
t.Errorf("Builds.0.AllowFailure is %v, want %v", event.Builds[0].AllowFailure, true)
}

if event.Builds[0].Environment.Name != "production" {
t.Errorf("Builds.0.Environment.Name is %v, want %v", event.Builds[0].Environment.Name, "production")
}
}

func TestPushEventUnmarshal(t *testing.T) {
Expand Down
7 changes: 6 additions & 1 deletion testdata/webhooks/pipeline.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@
"artifacts_file":{
"filename": null,
"size": null
}
},
"environment": {
"name": "production",
"action": "start",
"deployment_tier": "production"
}
},
{
"id": 377,
Expand Down

0 comments on commit cdfb4b0

Please sign in to comment.