Lyndon
Lyndon

Reputation: 613

OpenShift 3 GitHub Webhook Setup

I have managed to create on OpenShift 3 a project and an app that uses Tomcat 8.

I have managed to get it working in Eclipse Oxygen and the code can be pushed to GitHub.

I can make changes to the code in the Eclipse IDE, push the changes to GitHub and then in Openshift Online, I can manually build. I can see the change out on the web, so all is well so far.

I have tried to get the GitHub Webhook working but so far, I am unsuccessful.


In OpenShift Online:

Following instructions here: Triggering Builds

Then running the following command:

./oc describe bc myapp

Gives the output:

Name:           myapp
Namespace:      my-project-1
Created:        24 hours ago
Labels:         app=myapp
Annotations:    openshift.io/generated-by=OpenShiftNewApp
Latest Version: 8

Strategy:       Source
URL:            https://github.com/<MyCompanyName>/os-sample-java-web.git
From Image:     ImageStreamTag openshift/jboss-webserver30-tomcat8-openshift:latest
Output to:      ImageStreamTag myapp:latest

Build Run Policy:       Serial
Triggered by:           ImageChange, Config
Webhook GitHub:
    URL:    https://api.starter-ca-central-1.openshift.com:443/oapi/v1/namespaces/my-project-1/buildconfigs/myapp/webhooks/Geglxxxxxthk0u/github
Webhook Generic:
    URL:            https://api.starter-ca-central-1.openshift.com:443/oapi/v1/namespaces/my-project-1/buildconfigs/myapp/webhooks/SiyGxxxxxxxx7oHLP/generic
    AllowEnv:       false

In GitHub Create Webhook:

Payload URL

https://api.starter-ca-central-1.openshift.com/oapi/v1/namespaces/my-project-1/buildconfigs/myapp/webhooks/Geglxxxxxthk0u/github

Content Type

application/json

Secret

Geglxxxxxthk0u

Note. The ping on the webhook in GitHub got a green tick and status 200 so it looks ok.


The above password can also be seen in the OpenShift Online page Edit Build Config myapp as: triggers: - github: secret: Geglxxxxxthk0u type: GitHub

So it looks right to me.

But it does not work, so what am I missing?

Upvotes: 2

Views: 2082

Answers (1)

luciddreamz
luciddreamz

Reputation: 2093

Don't enter the secret in GitHub. The secret is included in the payload URL.

Just for clarity, using your original fields entered, this should be:

  • Payload URL: https://api.starter-ca-central-1.openshift.com/oapi/v1/namespaces/my-project-1/buildconfigs/myapp/webhooks/Geglxxxxxthk0u/github

  • Content Type: application/json

  • Secret: (leave blank)

Upvotes: 1

Related Questions