Argo-cd: Argocd failing upon processing BitBucket webhooks

Created on 4 Dec 2019  Â·  5Comments  Â·  Source: argoproj/argo-cd

BitBucket's payload for the "refs updated" event contains date in the following format:
2019-12-04T11:59:03+0200
When BitBucket posts the payload to argocd server with such an event, 502 is received from argo

When I performed the curl myself, and changed the date to be in the format of
2019-12-04T11:59:03
I received 200, but Argo's logs showed this :
"level=info msg="Webhook processing failed: parsing time \"2019-12-04T11:59:03\" as \"2006-01-02T15:04:05Z0700\": cannot parse \"\" as \"Z0700\""

So support for such a timezone format is needed, and further surprises might be down the road, so it is better to test the full scenario of webhook from BitBucket, rather than just adding the support for this particular timezone

bug git

Most helpful comment

Yes, I will work

On Wed, Dec 4, 2019, 20:39 Alex Collins notifications@github.com wrote:

Would you like to submit a PR for this?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/argoproj/argo-cd/issues/2803?email_source=notifications&email_token=AEVDWBBJITMS3XTJRH63HM3QW72NJA5CNFSM4JVGGPGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF6B26Y#issuecomment-561782139,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AEVDWBFSGWMT3JTT4VQ3L7TQW72NJANCNFSM4JVGGPGA
.

All 5 comments

Would you like to submit a PR for this?

Yes, I will work

On Wed, Dec 4, 2019, 20:39 Alex Collins notifications@github.com wrote:

Would you like to submit a PR for this?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/argoproj/argo-cd/issues/2803?email_source=notifications&email_token=AEVDWBBJITMS3XTJRH63HM3QW72NJA5CNFSM4JVGGPGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF6B26Y#issuecomment-561782139,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AEVDWBFSGWMT3JTT4VQ3L7TQW72NJANCNFSM4JVGGPGA
.

Yes, I will work on this issue

On Thu, Dec 5, 2019, 14:47 Reggie K reginakagan@gmail.com wrote:

Yes, I will work

On Wed, Dec 4, 2019, 20:39 Alex Collins notifications@github.com wrote:

Would you like to submit a PR for this?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/argoproj/argo-cd/issues/2803?email_source=notifications&email_token=AEVDWBBJITMS3XTJRH63HM3QW72NJA5CNFSM4JVGGPGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF6B26Y#issuecomment-561782139,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AEVDWBFSGWMT3JTT4VQ3L7TQW72NJANCNFSM4JVGGPGA
.

Any news on this one? Or any workaround that worked for you?
I personally don't think the date format is causing the error. The error I get when I make the POST request to /api/webhook is:

2020/05/07 11:40:27 http: panic serving 10.42.0.0:62430: interface conversion: interface {} is nil, not []interface {} goroutine 5211 [running]: net/http.(*conn).serve.func1(0xc001140c80) /usr/local/go/src/net/http/server.go:1772 +0x139 panic(0x1d717e0, 0xc0012aa420) /usr/local/go/src/runtime/panic.go:973 +0x3e3 github.com/argoproj/argo-cd/util/webhook.affectedRevisionInfo(0x1eb2160, 0xc00000b2c0, 0xc000a29200, 0xc00106ea00, 0xc000a28200, 0xc000a28300, 0xc000b52500, 0xc00106e000) /go/src/github.com/argoproj/argo-cd/util/webhook/webhook.go:115 +0x1296 github.com/argoproj/argo-cd/util/webhook.(*ArgoCDWebhookHandler).HandleEvent(0xc0005ffae0, 0x1eb2160, 0xc00000b2c0) /go/src/github.com/argoproj/argo-cd/util/webhook/webhook.go:145 +0x50 github.com/argoproj/argo-cd/util/webhook.(*ArgoCDWebhookHandler).Handler(0xc0005ffae0, 0x242ac40, 0xc000daa460, 0xc0004ab400) /go/src/github.com/argoproj/argo-cd/util/webhook/webhook.go:223 +0x17a net/http.HandlerFunc.ServeHTTP(0xc000a0e480, 0x242ac40, 0xc000daa460, 0xc0004ab400) /usr/local/go/src/net/http/server.go:2012 +0x44 net/http.(*ServeMux).ServeHTTP(0xc0009d00c0, 0x242ac40, 0xc000daa460, 0xc0004ab400) /usr/local/go/src/net/http/server.go:2387 +0x1a5 github.com/argoproj/argo-cd/server.(*bug21955Workaround).ServeHTTP(0xc0009b6e40, 0x242ac40, 0xc000daa460, 0xc0004ab400) /go/src/github.com/argoproj/argo-cd/server/server.go:918 +0x13c github.com/argoproj/argo-cd/server.(*handlerSwitcher).ServeHTTP(0xc0009b8680, 0x242ac40, 0xc000daa460, 0xc0004ab400) /go/src/github.com/argoproj/argo-cd/server/server.go:894 +0x16c net/http.serverHandler.ServeHTTP(0xc0002f27e0, 0x242ac40, 0xc000daa460, 0xc0004ab400) /usr/local/go/src/net/http/server.go:2807 +0xa3 net/http.(*conn).serve(0xc001140c80, 0x24300c0, 0xc000588600) /usr/local/go/src/net/http/server.go:1895 +0x86c created by net/http.(*Server).Serve /usr/local/go/src/net/http/server.go:2933 +0x35c

So it's line 115 in webhook.go which is this one:
for _, l := range payload.Repository.Links["clone"].([]interface{}) {

I'm using ArgoCD version v1.5.3+095c5d6

The request is:

POST http://test.argocd/api/webhook
Headers:
X-Request-Id:1a700f04-3b5e-41fc-b3ea-bd777c57b68b
Content-Type:application/json; charset=utf-8
X-Event-Key:repo:refs_changed

The payload of the request is:
{ "eventKey": "repo:refs_changed", "date": "2020-05-07T13:50:11+0300", "actor": { "name": "firstname.lastname", "emailAddress": "[email protected]", "id": 14251, "displayName": "first last", "active": true, "slug": "some.slug", "type": "NORMAL" }, "repository": { "slug": "guestbook-argocd", "id": 2920, "name": "guestbook-argocd", "scmId": "git", "state": "AVAILABLE", "statusMessage": "Available", "forkable": true, "project": { "key": "TEST", "id": 983, "name": "SomeProjectName", "public": false, "type": "NORMAL" }, "public": true }, "changes": [ { "ref": { "id": "refs/heads/master", "displayId": "master", "type": "BRANCH" }, "refId": "refs/heads/master", "fromHash": "fa9db41cc9459cc9b0d9497e6a6ebc7340b46400", "toHash": "ab0b394abe5b9789e415cc6fa7e57ea3becdbf09", "type": "UPDATE" } ] }

Unfortunately, did not have the chance to work on it yet. For me, the issue
is low priority

On Thu, May 7, 2020, 14:36 chihaiaalex notifications@github.com wrote:

Any news on this one?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/argoproj/argo-cd/issues/2803#issuecomment-625200932,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AEVDWBHKFYFU6OVQBRIIZH3RQKMLXANCNFSM4JVGGPGA
.

Was this page helpful?
0 / 5 - 0 ratings