Origin: Build not starting after webhook (http status 200)

Created on 23 Jun 2016  路  12Comments  路  Source: openshift/origin

After webhook is issued, no build is starting.

Any help appreciated. Thanks!

Version

openshift v1.3.0-alpha.1-473-gb617847
kubernetes v1.3.0-alpha.3-599-g2746284
etcd 2.3.0+git

Steps To Reproduce
  1. configure a webhook in github enterprise with ssl verify ignore, commit/push or just execute with curl:
    curl -H "Content-Type: application/json
    X-GitHub-Event: push" -X POST -k -i --data @data.json https://:/oapi/v1/namespaces//buildconfigs//webhooks//github
    Current Result

HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Cache-Control: no-store
Date: Thu, 23 Jun 2016 00:06:43 GMT
Content-Length: 0
Content-Type: text/plain; charset=utf-8

---> no build

Expected Result

HTTP/1.1 200 OK

---> new build triggered

Additional Information

[Note] Determining if client configuration exists for client/cluster diagnostics
Info: Successfully read a client config file at '/var/lib/origin/openshift.local.config/master/admin.kubeconfig'
Info: Using context for cluster-admin access: 'default/10-97-165-212:8443/system:admin'

[Note] Running diagnostic: ConfigContexts[default/10-97-165-212:8443/system:admin]
Description: Validate client config context is complete and has connectivity

Info: The current client config context is 'default/10-97-165-212:8443/system:admin':
The server URL is 'https://10.97.165.212:8443'
The user authentication is 'system:admin/10-97-165-212:8443'
The current project is 'default'
Successfully requested project list; has access to project(s):
[mytest openshift openshift-infra default]

[Note] Running diagnostic: DiagnosticPod
Description: Create a pod to run diagnostics from the application standpoint

WARN: [DCli2013 from diagnostic DiagnosticPod@openshift/origin/pkg/diagnostics/client/run_diagnostics_pod.go:157]
See the warnings below in the output from the diagnostic pod:
[Note] Running diagnostic: PodCheckAuth
Description: Check that service account credentials authenticate as expected

   Info:  Service account token successfully authenticated to master

   WARN:  [DP1007 from diagnostic PodCheckAuth@openshift/origin/pkg/diagnostics/pod/auth.go:116]
          DNS resolution for registry address docker-registry.default.svc.cluster.local returned no results; either the integrated registry is not deployed, or container DNS configuration is incorrect.

   [Note] Running diagnostic: PodCheckDns
          Description: Check that DNS within a pod works as expected

   [Note] Summary of diagnostics execution (version v1.3.0-alpha.1):
   [Note] Warnings seen: 1

[Note] Running diagnostic: ClusterRegistry
Description: Check that there is a working Docker registry

WARN: [DClu1002 from diagnostic ClusterRegistry@openshift/origin/pkg/diagnostics/cluster/registry.go:186]
There is no "docker-registry" service in project "default". This is not strictly required to
be present; however, it is required for builds, and its absence probably
indicates an incomplete installation.

   Please consult the documentation and use the 'oadm registry' command
   to create a Docker registry.

[Note] Running diagnostic: ClusterRoleBindings
Description: Check that the default ClusterRoleBindings are present and contain the expected subjects

[Note] Running diagnostic: ClusterRoles
Description: Check that the default ClusterRoles are present and contain the expected permissions

[Note] Running diagnostic: ClusterRouterName
Description: Check there is a working router

WARN: [DClu2001 from diagnostic ClusterRouter@openshift/origin/pkg/diagnostics/cluster/router.go:129]
There is no "router" DeploymentConfig. The router may have been named
something different, in which case this warning may be ignored.

   A router is not strictly required; however it is needed for accessing
   pods from external networks and its absence likely indicates an incomplete
   installation of the cluster.

   Use the 'oadm router' command to create a router.

[Note] Running diagnostic: MasterNode
Description: Check if master is also running node (for Open vSwitch)

Info: Found a node with same IP as master: mo-fcfee501f

[Note] Skipping diagnostic: MetricsApiProxy
Description: Check the integrated heapster metrics can be reached via the API proxy
Because: The heapster service does not exist in the openshift-infra project at this time,
so it is not available for the Horizontal Pod Autoscaler to use as a source of metrics.

[Note] Running diagnostic: NodeDefinitions
Description: Check node records on master

[Note] Skipping diagnostic: ServiceExternalIPs
Description: Check for existing services with ExternalIPs that are disallowed by master config
Because: No master config file was detected

[Note] Summary of diagnostics execution (version v1.3.0-alpha.1-473-gb617847):
[Note] Warnings seen: 3

componenbuild kinquestion prioritP2

Most helpful comment

The source referenced in the BuildConfig assumes master as your branch unless you specify otherwise. See https://docs.okd.io/3.11/dev_guide/builds/build_inputs.html#source-code

All 12 comments

please provide your buildconfig json definition and the content of data.json

apiVersion: v1
kind: BuildConfig
metadata:
name: example-docker-build
namespace: mytest
selfLink: /oapi/v1/namespaces/mytest/buildconfigs/example-docker-build
uid: 0f2afdfd-38c8-11e6-807e-005056874ab0
resourceVersion: '6471'
creationTimestamp: '2016-06-22T22:24:18Z'
spec:
triggers:
-
type: GitHub
github:
secret: examplesecret
runPolicy: Serial
source:
type: Git
git:
uri: 'https://github/GLDS-Build/openshift-docker-example'
sourceSecret:
name: sslignore
secrets: null
strategy:
type: Docker
dockerStrategy:
env:
-
name: http_proxy
value: 'http://proxy:8080/'
-
name: https_proxy
value: 'http://proxy:8080/'
-
name: ftp_proxy
value: 'http://proxy:8080/'
output:
to:
kind: DockerImage
name: 'dockerdevregistry:5000/gldstest/dockerexample'
resources:
postCommit:
script: "echo 'import smtplib, sys\nmsg = \"Check docker run -ti dockerdevregistry:5000/gldstest/dockerexample /bin/bash\"\nm = \"From: [email protected]\r\nTo: [email protected]\r\nSubject: New example docker build created\r\nX-Mailer: Python\r\n\r\n\"\nsmtp = smtplib.SMTP()\nsmtp.connect(\"10.16.7.199\")\nsmtp.sendmail(\"[email protected]\", \"[email protected]\", m+msg)\nsmtp.close()' | python"
status:
lastVersion: 8

data.json:

{
"zen": "Responsive is better than fast.",
"hook_id": 11591,
"hook": {
"type": "Repository",
"id": 11591,
"name": "web",
"active": true,
"events": [
"push"
],
"config": {
"url": "https://10.97.165.212:8443/osapi/v1/namespaces/MyTest/buildconfigs/example-docker-build/webhooks/examplesecret/github",
"content_type": "json",
"insecure_ssl": "0"
},
"updated_at": "2016-06-22T22:41:49Z",
"created_at": "2016-06-22T22:41:49Z",
"url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/hooks/11591",
"test_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/hooks/11591/test",
"ping_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/hooks/11591/pings",
"last_response": {
"code": null,
"status": "unused",
"message": null
}
},
"repository": {
"id": 47649,
"name": "openshift-docker-example",
"full_name": "GLDS-Build/openshift-docker-example",
"owner": {
"login": "GLDS-Build",
"id": 8653,
"avatar_url": "https://github/avatars/u/8653?",
"gravatar_id": "",
"url": "https://github/api/v3/users/GLDS-Build",
"html_url": "https://github/GLDS-Build",
"followers_url": "https://github/api/v3/users/GLDS-Build/followers",
"following_url": "https://github/api/v3/users/GLDS-Build/following{/other_user}",
"gists_url": "https://github/api/v3/users/GLDS-Build/gists{/gist_id}",
"starred_url": "https://github/api/v3/users/GLDS-Build/starred{/owner}{/repo}",
"subscriptions_url": "https://github/api/v3/users/GLDS-Build/subscriptions",
"organizations_url": "https://github/api/v3/users/GLDS-Build/orgs",
"repos_url": "https://github/api/v3/users/GLDS-Build/repos",
"events_url": "https://github/api/v3/users/GLDS-Build/events{/privacy}",
"received_events_url": "https://github/api/v3/users/GLDS-Build/received_events",
"type": "Organization",
"site_admin": false
},
"private": false,
"html_url": "https://github/GLDS-Build/openshift-docker-example",
"description": "",
"fork": false,
"url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example",
"forks_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/forks",
"keys_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/keys{/key_id}",
"collaborators_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/collaborators{/collaborator}",
"teams_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/teams",
"hooks_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/hooks",
"issue_events_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/issues/events{/number}",
"events_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/events",
"assignees_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/assignees{/user}",
"branches_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/branches{/branch}",
"tags_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/tags",
"blobs_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/git/blobs{/sha}",
"git_tags_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/git/tags{/sha}",
"git_refs_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/git/refs{/sha}",
"trees_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/git/trees{/sha}",
"statuses_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/statuses/{sha}",
"languages_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/languages",
"stargazers_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/stargazers",
"contributors_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/contributors",
"subscribers_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/subscribers",
"subscription_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/subscription",
"commits_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/commits{/sha}",
"git_commits_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/git/commits{/sha}",
"comments_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/comments{/number}",
"issue_comment_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/issues/comments{/number}",
"contents_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/contents/{+path}",
"compare_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/compare/{base}...{head}",
"merges_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/merges",
"archive_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/{archive_format}{/ref}",
"downloads_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/downloads",
"issues_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/issues{/number}",
"pulls_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/pulls{/number}",
"milestones_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/milestones{/number}",
"notifications_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/notifications{?since,all,participating}",
"labels_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/labels{/name}",
"releases_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/releases{/id}",
"deployments_url": "https://github/api/v3/repos/GLDS-Build/openshift-docker-example/deployments",
"created_at": "2016-06-22T21:55:10Z",
"updated_at": "2016-06-22T21:56:37Z",
"pushed_at": "2016-06-22T22:33:47Z",
"git_url": "git://github/GLDS-Build/openshift-docker-example.git",
"ssh_url": "git@github:GLDS-Build/openshift-docker-example.git",
"clone_url": "https://github/GLDS-Build/openshift-docker-example.git",
"svn_url": "https://github/GLDS-Build/openshift-docker-example",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": null,
"has_issues": false,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"open_issues_count": 0,
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "master"
},
"sender": {
"login": "greatsun",
"id": 296,
"avatar_url": "https://github/avatars/u/296?",
"gravatar_id": "",
"url": "https://github/api/v3/users/greatsun",
"html_url": "https://github/greatsun",
"followers_url": "https://github/api/v3/users/greatsun/followers",
"following_url": "https://github/api/v3/users/greatsun/following{/other_user}",
"gists_url": "https://github/api/v3/users/greatsun/gists{/gist_id}",
"starred_url": "https://github/api/v3/users/greatsun/starred{/owner}{/repo}",
"subscriptions_url": "https://github/api/v3/users/greatsun/subscriptions",
"organizations_url": "https://github/api/v3/users/greatsun/orgs",
"repos_url": "https://github/api/v3/users/greatsun/repos",
"events_url": "https://github/api/v3/users/greatsun/events{/privacy}",
"received_events_url": "https://github/api/v3/users/greatsun/received_events",
"type": "User",
"site_admin": false
}
}

I hope that helps. As I said, I get status 200 back, but build doesn't start.

Any help is appreciated. Thanks.

your url does not look right:

curl -H "Content-Type: application/json X-GitHub-Event: push" -X POST -k -i --data @data.json https://:/oapi/v1/namespaces//buildconfigs//webhooks//github

it should be something like:
https://API_HOST:API_PORT/oapi/v1/namespaces/YOUR_NAMESPACE/buildconfigs/YOUR_BUILDCONFIG_NAME/webhooks/YOURSECRET/github

unless you intentionally stripped that information from your paste.

are you able to start the build using oc start-build, or from the webconsole?

The URL in the original request is right as far as I can see. Please have a look:

curl -H "Content-Type: application/json
X-GitHub-Event: push" -X POST --data @data.json https://:8443/oapi/v1/namespaces/mytest/buildconfigs/example-docker-build/webhooks/examplesecret/github -k -i

Return from openshift:

HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Cache-Control: no-store
Date: Fri, 01 Jul 2016 08:10:22 GMT
Content-Length: 0
Content-Type: text/plain; charset=utf-8

Any help is still appreciated.

Thanks!

are you able to start the build using oc start-build, or from the webconsole?

closing due to lack of information, will reopen if information is provided.

I am experiencing the same behavior. Starting builds from console works, the generic also works. When the github hook is triggered openshift comes back with 200 and empty body but nothing happens.

@joost-van-weenen please open a new issue and provide:

  • openshift version information
  • buildconfig definition
  • the name of the branch you are pushing changes to in github
  • also if you can run your apiserver/master with loglevel 4 and gather those logs after the event, we can probably see what is happening when the webhook event comes in.

The most likely cause is that the push event branch does not match the branch your buildconfig is configured to use. That does not result in an error response (the event is valid, we just take no action on it).

I don't have enough details, but wanted to share some findings as I also ran into this issue.
openshift 3.11
gitlab

If, in gitlab, you change the 'default' branch to anything but master and your post event is anything but master, there seems to be problems (openshift responds HTTP 200, empty body). But as soon as you swap back to master everything in gitlab, it works as expected. I'm unsure if there are special configurations you need in the BuildConfig for non-master builds for -webhooks- to work, but wanted to at least share this finding.

The source referenced in the BuildConfig assumes master as your branch unless you specify otherwise. See https://docs.okd.io/3.11/dev_guide/builds/build_inputs.html#source-code

Was this page helpful?
0 / 5 - 0 ratings