fedora-copr / copr

RPM build system - upstream for https://copr.fedorainfracloud.org/
114 stars 62 forks source link

webhook request history #304

Open fedora-copr-github-bot opened 1 year ago

fedora-copr-github-bot commented 1 year ago

Original issue: https://pagure.io/copr/copr/issue/304 Opened: 2018-05-30 08:06:16 Opened by: jkastner

when github sends request after master update, owner of github repo can see history, but if owner of copr is not also owner/admin of github repo, there is no chance to figure out what is going wrong (no new build launched). in this particular case - in @freecad/freecad copr first commit started build, but consequent two commits, following first one have not started new builds. as we are not admins/owners of github.com/freecad/freecad we can't see history of copr webhook requests and figure out where was problem


przemof commented at 2018-05-30 22:39:26:

I asked the admin of the FreeCAD github repo and looks like the delivery was OK, but I think there should be 2 deliveries not one. That's from the github: Request:

Request URL: https://copr.fedorainfracloud.org/webho ... 09fd38369/
Request method: POST
content-type: application/json
Expect:
User-Agent: GitHub-Hookshot/dc07019
X-GitHub-Delivery: c514dd00-61d4-11e8-91b5-3257e09c1fc7
X-GitHub-Event: ping 

Payload:

{
"zen": "Speak like a human.",
"hook_id": 31071129,
"hook": {
"type": "Organization",
"id": 31071129,
"name": "web",
"active": true,
"events": [
"push"
],
"config": {
"content_type": "json",
"insecure_ssl": "0",
"url": "https://copr.fedorainfracloud.org/webho ... 09fd38369/"
},
"updated_at": "2018-05-27T17:38:30Z",
"created_at": "2018-05-27T17:38:30Z",
"url": "https://api.github.com/orgs/FreeCAD/hooks/31071129",
"ping_url": "https://api.github.com/orgs/FreeCAD/hoo ... 1129/pings"
},
"organization": {
"login": "FreeCAD",
"id": 2306237,
"url": "https://api.github.com/orgs/FreeCAD",
"repos_url": "https://api.github.com/orgs/FreeCAD/repos",
"events_url": "https://api.github.com/orgs/FreeCAD/events",
"hooks_url": "https://api.github.com/orgs/FreeCAD/hooks",
"issues_url": "https://api.github.com/orgs/FreeCAD/issues",
"members_url": "https://api.github.com/orgs/FreeCAD/members{/member}",
"public_members_url": "https://api.github.com/orgs/FreeCAD/pub ... rs{/member}",
"avatar_url": "https://avatars1.githubusercontent.com/u/2306237?v=4",
"description": "The FreeCAD project"
},
"sender": {
"login": "wwmayer",
"id": 7101741,
"avatar_url": "https://avatars0.githubusercontent.com/u/7101741?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/wwmayer",
"html_url": "https://github.com/wwmayer",
"followers_url": "https://api.github.com/users/wwmayer/followers",
"following_url": "https://api.github.com/users/wwmayer/fo ... other_user}",
"gists_url": "https://api.github.com/users/wwmayer/gists{/gist_id}",
"starred_url": "https://api.github.com/users/wwmayer/st ... ner}{/repo}",
"subscriptions_url": "https://api.github.com/users/wwmayer/subscriptions",
"organizations_url": "https://api.github.com/users/wwmayer/orgs",
"repos_url": "https://api.github.com/users/wwmayer/repos",
"events_url": "https://api.github.com/users/wwmayer/events{/privacy}",
"received_events_url": "https://api.github.com/users/wwmayer/received_events",
"type": "User",
"site_admin": false
}
} 

Response:

Content-Length: 2
Content-Type: text/html; charset=utf-8
Date: Sun, 27 May 2018 17:38:32 GMT
Server: Apache/2.4.33 (Fedora) OpenSSL/1.1.0h-fips mod_wsgi/4.5.15 Python/3.6
Strict-Transport-Security: max-age=31536000; preload  

przemof commented at 2018-05-31 11:06:24:

I have a test repo on github and as far as I can tell there is a problem on copr end. The builds are simply not triggered. The copr end has the last build executed 4 days ago. The github log shows there were 4 deliveries executed in the last 4 days. I can provide logs from both sides if it helps.


clime commented at 2018-06-11 09:55:02:

@przemof: hello, what's the copr and a package that should be rebuilt on a received webhook? Can you link those? You can also contact me on #fedora-buildsys for online solution to this problem.


przemof commented at 2018-06-11 10:59:34:

@clime : That's one [1] - it's linked with github main FreeCAD repo [2]. I don't have admin access to the main FreeCAD repo on github, so I made a test project [3] linked with my FreeCAD repo [4]. We should try to find why it doesn't work on [3] and [4] as I have full access on both sides.

[1] https://copr.fedorainfracloud.org/coprs/g/freecad/nightly/ [2] https://github.com/FreeCAD/FreeCAD [3] https://copr.fedorainfracloud.org/coprs/g/freecad/przemof-test-from-github/ [4] https://github.com/PrzemoF/FreeCAD


clime commented at 2018-06-11 15:41:41:

@clime : That's one [1] - it's linked with github main FreeCAD repo [2]. I don't have admin access to the main FreeCAD repo on github, so I made a test project [3] linked with my FreeCAD repo [4]. We should try to find why it doesn't work on [3] and [4] as I have full access on both sides. [1] https://copr.fedorainfracloud.org/coprs/g/freecad/nightly/ [2] https://github.com/FreeCAD/FreeCAD [3] https://copr.fedorainfracloud.org/coprs/g/freecad/przemof-test-from-github/ [4] https://github.com/PrzemoF/FreeCAD

The problem for the coprs is that the freecad package in both cases has

 Subdirectory:    package/fedora/

With this setting, only changes in the respective repo subdirectory will cause a rebuilt. Others are ignored. You probably want to leave Subdirectory empty and set

 Path to .spec file:    package/fedora/freecad.spec

instead.

This is something that we should have documented but we don't have documentation describing it at the moment :(. Sorry for this.


clime commented at 2018-06-11 15:43:37:

Additional small note: X-GitHub-Event: ping do not cause a rebuild.


przemof commented at 2018-06-11 18:10:54:

Thank you! I made the suggested change and it seems to be OK :-) I'll be sure after 2-3 pushes.


przemof commented at 2018-06-11 18:23:18:

The change triggers the builder, but I need to run rpkg in packages/fedora as there is located file rpkg.macros. Before the change:

Running: rpkg -C /etc/rpkg.conf srpm --outdir /var/lib/copr-rpmbuild/results/tmphvee9sd0 --spec /tmp/tmpmxxho7xx/FreeCAD/package/fedora/freecad.spec

cmd: ['rpkg', '-C', '/etc/rpkg.conf', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results/tmphvee9sd0', '--spec', '/tmp/tmpmxxho7xx/FreeCAD/package/fedora/freecad.spec'] cwd: /tmp/tmpmxxho7xx/FreeCAD/package/fedora

After the change: Running: rpkg -C /etc/rpkg.conf srpm --outdir /var/lib/copr-rpmbuild/results/tmp23_olfwx --spec /tmp/tmps4csgmib/FreeCAD/package/fedora/freecad.spec

cmd: ['rpkg', '-C', '/etc/rpkg.conf', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results/tmp23_olfwx', '--spec', '/tmp/tmps4csgmib/FreeCAD/package/fedora/freecad.spec'] cwd: /tmp/tmps4csgmib/FreeCAD

If you have any idea how to work around that, please let me know.


clime commented at 2018-06-11 18:55:04:

The change triggers the builder, but I need to run rpkg in packages/fedora as there is located file rpkg.macros. Before the change: Running: rpkg -C /etc/rpkg.conf srpm --outdir /var/lib/copr-rpmbuild/results/tmphvee9sd0 --spec /tmp/tmpmxxho7xx/FreeCAD/package/fedora/freecad.spec cmd: ['rpkg', '-C', '/etc/rpkg.conf', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results/tmphvee9sd0', '--spec', '/tmp/tmpmxxho7xx/FreeCAD/package/fedora/freecad.spec'] cwd: /tmp/tmpmxxho7xx/FreeCAD/package/fedora After the change: Running: rpkg -C /etc/rpkg.conf srpm --outdir /var/lib/copr-rpmbuild/results/tmp23_olfwx --spec /tmp/tmps4csgmib/FreeCAD/package/fedora/freecad.spec cmd: ['rpkg', '-C', '/etc/rpkg.conf', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results/tmp23_olfwx', '--spec', '/tmp/tmps4csgmib/FreeCAD/package/fedora/freecad.spec'] cwd: /tmp/tmps4csgmib/FreeCAD If you have any idea how to work around that, please let me know.

The only way to workaround it is to move rpkg.macros to the top-level or create a symlink from the top-level to the subdirectory.

The only other way that would tackle this issue (that I can think of currently) were package-specific webhooks in Copr that would always trigger a rebuild but that feature probably won't come any time soon :(.

You could also switch the building method to make-srpm and install, then invoke rpkg from there in the correct directory (package/fedora) but it's a little bit cumbersome solution compared to what you have now.


clime commented at 2018-07-06 23:47:39:

Opened: https://pagure.io/copr/copr/issue/335

praiskup commented 1 year ago

Copy-pasting from #2631: Ken Dreyer commented at 2018-05-18 20:12:07:

Description of problem: It is easy to accidentally forget to click "Webhook rebuild" when setting up a new Copr.

Version-Release number of selected component (if applicable): copr-frontend-1.131-1

Steps to Reproduce:

Create a new Copr
Add a new package
Decide to enable webhooks for the Copr
Click around in "Settings", discover the "Webhooks" tab

Actual results: The "Webhooks" tab makes no mention of the fact that "Webhook rebuild" must be checked for each package in the Copr.

There is a sentence "Enable automatic rebuilds for the package." I failed to understand "automatic rebuilds" == "allow webhooks" in my case.

Expected results: Couple of suggestions, in order of difficulty :)

A) The Webhooks page should explain what "automatic rebuilds" means, whether that's Aynita or the "Webhook rebuild" checkbox.

B) The Webhooks page could dynamically display a warning to the user if there are zero packages with "Webhook rebuild" checked, because this means that nothing will happen even when we hit this copr's webhook API endpoints.

C) It would be great if the webhook API endpoint returned something other than HTTP 200 OK when accepting a webhook for a Copr with no packages enabled for automated rebuilds. This would make it easier to see that something is wrong when clicking around in GitHub's webhook console. (dunno how difficult it would be to provide this type of config validation when handling the incoming webhook requests)

FrostyX commented 2 months ago

Reopening the issue. Thanks to PR #3342 we now store some of the webhook data to our database but we don't display the webhook history table to users yet. That will be done in a separate PR.