Bug 1373788 - When master port is 443, oc start build by webhook from webconsole lost url port and failed with unknown signed certification.
Summary: When master port is 443, oc start build by webhook from webconsole lost url p...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Cesar Wong
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-07 07:19 UTC by XiaochuanWang
Modified: 2017-03-08 18:43 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Comparison of master host/port with that specified by the user fails because the user-specified URL may not contain the default port (when using 443). Consequence: The build fails to trigger. Fix: Fix the comparison of the host/port to account for default port. Result: Start build works when the master port is 443 and is using a self-signed certificate.
Clone Of:
Environment:
Last Closed: 2017-01-18 12:53:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1393943 0 unspecified CLOSED oc login is not using CA in kubeconfig file when server does not include port. 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2017:0066 0 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.4 RPM Release Advisory 2017-01-18 17:23:26 UTC

Internal Links: 1393943

Description XiaochuanWang 2016-09-07 07:19:04 UTC
Description of problem:
Start build by webhook url from console(no port for the webhookurl) failed with unknown signed certification.

Version-Release number of selected component (if applicable):
oc/openshift 3.3.0.30

How reproducible:
Always

Steps to Reproduce:
1. oc process -f https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-stibuild.json | oc create -f -
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/oapi/v1/namespaces/xiaocwan-sti/buildconfigs/ruby-sample-build/webhooks/secret101/generic' --loglevel=8

Actual results:
2 "GitHub webhook URL" and "GitHub webhook URL" on web-console lost the port (:443) compared to `oc describe bc/<bc>`
3 Start build with webhook (without port) will lead the below error:
Unable to connect to the server: x509: certificate signed by unknown authority
I0907 10:28:35.308518   26281 startbuild.go:609] Triggering hook https://xxx/oapi/v1/namespaces/xiaocwan-p/buildconfigs/ruby-sample-build/webhooks/secret101/github
I0907 10:28:36.168264   26281 helpers.go:199] Connection error: Post https://xxx/oapi/v1/namespaces/xiaocwan-p/buildconfigs/ruby-sample-build/webhooks/secret101/github: x509: certificate signed by unknown authority
F0907 10:28:36.168322   26281 helpers.go:110] Unable to connect to the server: x509: certificate signed by unknown authority

Expected results:
2. webhook url on web console should keep same with `oc describe bc`
3. New build start with "build "ruby-sample-build-2" started"

Additional info:
`oc describe bc/<bc>` has the port and it will not raise the error.
Not reproduced on env:8443

Comment 1 Jessica Forrester 2016-09-07 12:27:10 UTC
443 is an optional port, it should not be required, it looks like there is a bug on oc start-build

Comment 2 Ben Parees 2016-09-21 08:30:28 UTC
sorry didn't realize Cesar had a pull open for this:
https://github.com/openshift/origin/pull/10836

Comment 3 XiaochuanWang 2016-09-30 07:45:22 UTC
Reproduced by same steps as comment 0 on latest origin which port is 8443, ami: rhel7_5101
oc/openshift v1.4.0-alpha.0+75ee6c9

Please refer to attachment for the full log.

Comment 5 Cesar Wong 2016-09-30 12:46:20 UTC
@XiaochuanWang I'm not sure that you reproduced the issue. If you logged in to the cluster and decided to skip certificate verification, then you will still get a certificate error when invoking start-build --from-webhook. However, if you are logged in with a valid certificate (oc login --certificate-authority=/path/to/ca.crt), then the webhook invocation should not complain about an invalid certificate. This part was working as long as the URL to the cluster had a port that was not 443. If the URL to the cluster had a 443 port, then you could reproduce this bug.

Comment 6 XiaochuanWang 2016-10-08 09:21:45 UTC
Not reproduced on OCP openshift 3.3.1.1
Steps:
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 "Generic webhook URL"
3. oc start-build --from-webhook='https://xxx:8443/oapi/v1/namespaces/xiaocwan-sti/buildconfigs/ruby-sample-build/webhooks/secret101/generic'

New build started, URL from web console is same with `oc describe bc`.

(To compare:) # oc start-build --from-webhook='https://xxx/oapi/v1/namespaces/xiaocwan-sti/buildconfigs/ruby-sample-build/webhooks/secret101/generic'
The connection to the server xxx.xxx.xxx.com was refused - did you specify the right host or port?

Comment 7 XiaochuanWang 2016-10-11 07:22:27 UTC
Also not reproduced on OCP openshift/oc 3.3.1.1 with port 443 env, steps are same as Comment 6.

Comment 9 errata-xmlrpc 2017-01-18 12:53:42 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.

https://access.redhat.com/errata/RHBA-2017:0066


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