diff --git a/handlers.go b/handlers.go index 907c137..c9973c5 100644 --- a/handlers.go +++ b/handlers.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "net/http" + "net/url" "path/filepath" "strings" @@ -96,12 +97,19 @@ func (gh *GithubWebhookHandler) ServeHTTP(rw http.ResponseWriter, req *http.Requ } else { debugf("resource %s/%s has no path filter: %#v", pipeline.Name, resource.Name, resource.Source) } - webhookURL := fmt.Sprintf("%s/api/v1/teams/%s/pipelines/%s/resources/%s/check/webhook?webhook_token=%s", + queryParams := url.Values{} + for key, vals := range pipeline.QueryParams { + for _, val := range vals { + queryParams.Add(key, val) + } + } + queryParams.Set("webhook_token", resource.WebhookToken) + webhookURL := fmt.Sprintf("%s/api/v1/teams/%s/pipelines/%s/resources/%s/check/webhook?%s", concourseURL, pipeline.Team, pipeline.Name, resource.Name, - resource.WebhookToken, + queryParams.Encode(), ) gh.queue.Add(webhookURL) } diff --git a/resource_cache.go b/resource_cache.go index f41b9cc..b81ce40 100644 --- a/resource_cache.go +++ b/resource_cache.go @@ -3,17 +3,19 @@ package main import ( "fmt" "log" + "net/url" "sync" "github.com/concourse/concourse/atc" ) type Pipeline struct { - ID int - Name string - Version string - Team string - Resources []atc.ResourceConfig + ID int + Name string + Version string + Team string + Resources []atc.ResourceConfig + QueryParams url.Values } var ( @@ -60,10 +62,11 @@ func UpdateCache(cclient client) error { //add or replace cache for pipeline if !inCache || cachedPipeline.(Pipeline).Version != version { newCacheObj := Pipeline{ - ID: pipeline.ID, - Name: pipeline.Name, - Team: pipeline.TeamName, - Version: version, + ID: pipeline.ID, + Name: pipeline.Name, + Team: pipeline.TeamName, + Version: version, + QueryParams: pipeline.Ref().QueryParams(), } for _, resource := range config.Resources { //Skip resources without webhook tokens