Bug 1653697

Summary: OpenShift BitBucket webhook causes atomic-openshift-master-api service crash when pushing tagged commits
Product: OpenShift Container Platform Reporter: Antti Rahikainen <antti.rahikainen>
Component: BuildAssignee: Ben Parees <bparees>
Status: CLOSED WONTFIX QA Contact: wewang <wewang>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.9.0CC: aos-bugs, wzheng
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-27 15:06:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Failing BitBucket webhook payload
none
Succesful BitBucket webhook payload
none
openshift-logs none

Description Antti Rahikainen 2018-11-27 12:30:08 UTC
Description of problem:

If BitBucket webhook is used to triggeer build and git-commit contains git tag, OpenShift master-api-service crashes and coredump is created.


Version-Release number of selected component (if applicable):

oc version
oc v3.9.30
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth GSSAPI Kerberos SPNEGO


How reproducible:

Every time


Steps to Reproduce:
1. Create Bitbucket webhook to trigger a build using: Triggers: repo:push
2. Push some code to repository with tag to trigger the build
3. OpenShift master-api-service crashes

Actual results:

Openshift-master-api-service crashes and generates core-dump

Expected results:

Build starts normally


Additional info:

https://github.com/openshift/origin/blob/e004e6513ec755a7a106dc97516703847e470d0b/pkg/build/webhook/bitbucket/bitbucket.go#L159

On line 159 the parser expects lastCommits to be present on the JSON-payload.

But when push is tagged with some git-tag parser fails to read the commit information.

Comment 1 Antti Rahikainen 2018-11-27 12:31:39 UTC
Created attachment 1508809 [details]
Failing BitBucket webhook payload

Comment 2 Antti Rahikainen 2018-11-27 12:32:08 UTC
Created attachment 1508810 [details]
Succesful BitBucket webhook payload

Comment 3 Antti Rahikainen 2018-11-27 12:36:17 UTC
Created attachment 1508811 [details]
openshift-logs

Comment 4 Antti Rahikainen 2018-11-27 13:27:56 UTC
Seems to fixed on upstream 3.10: https://github.com/openshift/origin/blob/release-3.10/pkg/build/webhook/bitbucket/bitbucket.go

if len(event.Push.Changes) == 0 || len(event.Push.Changes[0].Commits) == 0 

So should this be backported to 3.9?

Where:

if len(event.Push.Changes) == 0

And webhook payload includes changes but no commits (just tags).

Comment 5 Ben Parees 2018-11-27 15:06:43 UTC
We would only backport it if there is a specific customer request and that customer cannot reasonably upgrade to 3.10.

Closing as won't fix for now, pending that request/requirement.