Bug 1500731 - Bitbucket Server 5.4 Webhook push sends X-Event-Key repo:refs_changed.
Summary: Bitbucket Server 5.4 Webhook push sends X-Event-Key repo:refs_changed.
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Build
Version: 3.6.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 3.7.0
Assignee: Ben Parees
QA Contact: Wenjing Zheng
Depends On:
TreeView+ depends on / blocked
Reported: 2017-10-11 11:46 UTC by Ruben Romero Montes
Modified: 2017-11-28 22:16 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: The BitBucket build trigger webhook did not handle older versions of the webhook payload. Consequence: Builds could not be triggered by older versions of BitBucket Server. Fix: Add support for the older payload format. Result: Builds can be triggered by older versions of BitBucket.
Clone Of:
Last Closed: 2017-11-28 22:16:24 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:3188 normal SHIPPED_LIVE Moderate: Red Hat OpenShift Container Platform 3.7 security, bug, and enhancement update 2017-11-29 02:34:54 UTC

Description Ruben Romero Montes 2017-10-11 11:46:27 UTC
Description of problem:
The BitBucket Cloud version [1] is not sending the same type of X-Event-Key for a pus than the Server 5.4 version [2]

[1] https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html
[2] https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html

OpenShift is not able to process these requests when the type is BitBucket. It does process them when the type is Generic.

Version-Release number of selected component (if applicable):
Openshift Container Platform 3.6
BitBucket Server 5.4

How reproducible:

Steps to Reproduce:
1. Configure a BuildTrigger to use a bitbucket webhook
2. Configure a webhook on a Bitbucket 5.4 server
3. git push on the repository

Actual results:
Date: Thu, 05 Oct 2017 05:59:21 GMT
Cache-Control: no-store
Content-Type: application/json
Via: 1.1 localhost (Apache-HttpClient/4.4.1 (cache))
Content-Length: 162
{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unknown Bitbucket X-Event-Key repo:refs_changed","reason":"BadRequest","code":400}

Expected results:
Date	Mon, 09 Oct 2017 15:23:59 GMT
Content-Length	1752
Content-Type	text/plain; charset=utf-8
Cache-Control	no-store

{"kind":"Build","apiVersion":"build.openshift.io/v1","metadata":{"name":"example-2","namespace":"bitbucket-webhook","selfLink":"/oapi/v1/namespaces/bitbucket-webhook/buildconfigs/example-2/instantiate","uid":"dfa814e4-ad05-11e7-b9c8-123713f594ec","resourceVersion":"103224428","creationTimestamp":"2017-10-09T15:23:59Z","labels":{"app":"example","buildconfig":"example","openshift.io/build-config.name":"example","openshift.io/build.start-policy":"Serial"},"annotations":{"openshift.io/build-config.name":"example","openshift.io/build.number":"2"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"example","uid":"7010a15e-ad05-11e7-b9c8-123713f594ec","controller":true}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"uri":"https://ruben-rh@bitbucket.org/ruben-rh/demo.git","ref":"master"}},"revision":{"type":"Git","git":{"commit":"16299257006b037ee8b5fefd3cda6b04803fb8ae","author":{},"committer":{},"message":"test created online with Bitbucket"}},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"registry.access.redhat.com/rhscl/nodejs-4-rhel7@sha256:51dbd18b3ae97a9d16a00d4566ce56a318a4001978dcc08b678b08751c861e35"}}},"output":{"to":{"kind":"ImageStreamTag","name":"example:latest"},"pushSecret":{"name":"builder-dockercfg-v45x0"}},"resources":{},"postCommit":{},"nodeSelector":null,"triggeredBy":[{"message":"Bitbucket WebHook","bitbucketWebHook":{"revision":{"type":"Git","git":{"commit":"16299257006b037ee8b5fefd3cda6b04803fb8ae","author":{},"committer":{},"message":"test created online with Bitbucket"}},"secret":"df59ce89***"}}]},"status":{"phase":"New","config":{"kind":"BuildConfig","namespace":"bitbucket-webhook","name":"example"},"output":{}}}

Additional info:

Comment 1 Ben Parees 2017-10-12 03:38:39 UTC
according to the doc:
A user pushes one or more commits to a repository. This payload, with an event key of repo:push, provides the following fields:

Comment 4 XiuJuan Wang 2017-11-01 10:02:37 UTC
Verified on ocp 3.7[1] with bitbucket 5.4 server.When push to repo,bitbucket webhook could trigger build successully without error.

[1]openshift v3.7.0-0.188.0
kubernetes v1.7.6+a08f5eeb62

Comment 7 errata-xmlrpc 2017-11-28 22:16:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.