Bug 1382915 - oc start-build --from-webhook failed with github webhook
Summary: oc start-build --from-webhook failed with github webhook
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Build
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Jim Minter
QA Contact: Wang Haoran
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-08 09:54 UTC by XiaochuanWang
Modified: 2016-12-09 21:49 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-09 21:49:46 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description XiaochuanWang 2016-10-08 09:54:47 UTC
Description of problem:
Failed to start build from GitHub webhook URL which is correct

Version-Release number of selected component (if applicable):
openshift v1.4.0-alpha.0+e22007f

How reproducible:
Always

Steps to Reproduce:
1. oc new-app https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-stibuild.json 
2. Go to web console, go to build config page, check "Configuration" and copy the link of "Github webhook URL"
3. oc start-build --from-webhook="https://xxx.xxx.xxx.xxx:8443/oapi/v1/namespaces/xiaocwan-p/buildconfigs/ruby-sample-build/webhooks/secret101/github"
4. (only to compare) oc start-build --from-webhook="https://xxx.xxx.xxx.xxx:8443/oapi/v1/namespaces/xiaocwan-p/buildconfigs/ruby-sample-build/webhooks/secret101/generic"

Actual results:
3. error: server rejected our request 500
remote: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Internal error occurred: hook failed: missing X-GitHub-Event or X-Gogs-Event","reason":"InternalError","details":{"causes":[{"message":"hook failed: missing X-GitHub-Event or X-Gogs-Event"}]},"code":500}
4. generic webhook succeed

Expected results:
3. Should start build successfully

Additional info:
Please refer to attachment for log.

This bug exposed when the bug https://bugzilla.redhat.com/show_bug.cgi?id=1373788 fixed

Comment 2 XiaochuanWang 2016-10-09 09:53:20 UTC
Tested against OCP openshift/oc 3.2.1.16, also reproduced this issue by Comment 1 steps.

"--from-webhook" from both build config web page and `oc describe bc` lost the port, still github failed but generic succeed.

# oc start-build --from-webhook=https://xxx.com/oapi/v1/namespaces/xiaocwan-p/buildconfigs/ruby-sample-build/webhooks/secret101/github -n xiaocwan-p

error: server rejected our request 500
remote: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Internal error occurred: hook failed: missing X-GitHub-Event or X-Gogs-Event","reason":"InternalError","details":{"causes":[{"message":"hook failed: missing X-GitHub-Event or X-Gogs-Event"}]},"code":500}

Comment 3 Cesar Wong 2016-10-25 17:20:38 UTC
oc start-build --from-webhook is only meant to work with the generic webhook. The CLI help needs to be updated to make this clear.

Comment 4 Jim Minter 2016-11-08 10:30:19 UTC
https://github.com/openshift/origin/pull/11822

Comment 5 Wang Haoran 2016-11-15 04:54:38 UTC
verified with:
 openshift v3.4.0.25+1f36858
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0

Comment 6 XiaochuanWang 2016-11-15 05:26:55 UTC
$ oc start-build --from-webhook=https://xxx.amazonaws.com:8443/oapi/v1/namespaces/xiaocwan-t/buildconfigs/ruby-sample-build/webhooks/secret101/github 
warning: the '--from-webhook' flag should be called with a generic webhook URL.
error: server rejected our request 400
remote: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"missing X-GitHub-Event, X-Gogs-Event or X-Gitlab-Event","reason":"BadRequest","code":400}

generic webhook works normally
Verified on origin oc v1.4.0-alpha.1+afb4f8d-181


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