mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-25 01:46:30 +00:00
Use gitlab generic webhooks instead of drone-ci-service (#620)
Benefits: - the webhook delivery history of the drone-ci-service is broken (no way to check if a webhook was successfully delivered by Gitlab) - drone-ci-service has limited events support (for example no comment or branch deleted event) - independent from drone integration in general
This commit is contained in:
@@ -52,10 +52,9 @@ func parse(raw string, fn SecretFunc) (*Token, error) {
|
||||
}
|
||||
|
||||
func ParseRequest(r *http.Request, fn SecretFunc) (*Token, error) {
|
||||
token := r.Header.Get("Authorization")
|
||||
|
||||
// first we attempt to get the token from the
|
||||
// authorization header.
|
||||
token := r.Header.Get("Authorization")
|
||||
if len(token) != 0 {
|
||||
log.Trace().Msgf("token.ParseRequest: found token in header: %s", token)
|
||||
bearer := token
|
||||
@@ -65,6 +64,11 @@ func ParseRequest(r *http.Request, fn SecretFunc) (*Token, error) {
|
||||
return parse(bearer, fn)
|
||||
}
|
||||
|
||||
token = r.Header.Get("X-Gitlab-Token")
|
||||
if len(token) != 0 {
|
||||
return parse(token, fn)
|
||||
}
|
||||
|
||||
// then we attempt to get the token from the
|
||||
// access_token url query parameter
|
||||
token = r.FormValue("access_token")
|
||||
|
Reference in New Issue
Block a user