Build.snapcraft.io: Support webhook build trigger?

Not all upstreams are willing to maintain an official snap package, but I guess more of them are willing to set up a webhook(GitHub, SourceForge) to trigger a third-party snap build on every SCM push, I would like to request that build.snapcraft.io support this method.

This also makes repos that are not hosted on GitHub can automate the snap build without migrating their projects to GitHub.

Also filed at build.s.i: Support webhook build triggering · Issue #1362 · canonical-websites/snapcraft.io

2 Likes

Regular ping…

Regular ping……

definitely a good idea “in my opinion”!

1 Like

Could you elaborate more on what do you mean by webhook support?

Currently build.snapcraft.io sets a webhook at github, so whenever something is pushed to a repo configured in build.snapcraft.io a snap build would be triggered.
What do you mean by ‘webhook triggering third party snap build’? Where the snap code would be hosted? Where would snapcraft.yaml live (if upstreams are not willing to maintain snap package)?

My view is to be able to programmatically trigger a build without having to add a commit to the github repository. Answering your questions:

What do you mean by ‘webhook triggering third party snap build’?

A script or application hosted on my own infrastructure triggers the BSI build to initiate.

Where the snap code would be hosted?

GitHub

Where would snapcraft.yaml live (if upstreams are not willing to maintain snap package)?

GitHub

Currently build.snapcraft.io sets a webhook at github, so whenever something is pushed to a repo configured in build.snapcraft.io a snap build would be triggered.

I actually never noticed that. That’s half work done IMO.

What do you mean by ‘webhook triggering third party snap build’? Where the snap code would be hosted? Where would snapcraft.yaml live (if upstreams are not willing to maintain snap package)?

The snap code is hosted on GitHub by a third-party, and is set up publishing to build.snapcraft.io via the current webhook.

I would like to set up such webhook at the upstream repo(not necessarily on GitHub) as well, the necessary info (the webhook URL https://build.snapcraft.io/_user_id_/_repo_id_/webhook/notify and the secret if authentication is needed) should be accessible on build.snapcraft.io. As the third-party snap publisher doesn’t necessary have the write access to the upstream repo this information will be handed out to the upstream repo maintainer manually.

For those not aware, BSI means https://build.snapcraft.io
Let’s please not use that acronym.

5 Likes

Currently build webhooks are implemented for GitHub. Specifically we are listening for push event.

To support third party webhooks we would need to extend this not to limit ourselves to GitHub specific events and payload structure. Also we currently use same webhook URL to listen to both GitHub events (that trigger builds) and Launchpad events. Third party webhooks would need to fit into that or have a separate URL, so they don’t need to follow same restrictions.

And we need a UI (probably somewhere on a repository page) to show user webhook configuration to use (URL and secret).

1 Like

I agree that half work is done. Webhook works, but only for first ever created snap,
NEW USERS CANT UPLOAD IMAGES, SO I REMOVED, THAT RESTRICTION IS STUPID, THIS SCREENSHOT SHOWS THAT WEBHOOK WORKS AND ALL IS GREEN
upload : / / riUsle24GwMOlsy6gYIcaWmFoc4.png

if I add additional snaps from github, no github webhook is set.

It would be great if at least same password would work and webhook would be set. As it is not a problem to inspect password field and change, just click inspect element and you can see your password in field value, if you want to show your password in password field instead of ****, change simply
NEW USERS CANT UPLOAD IMAGES, SO I REMOVED, THAT RESTRICTION IS STUPID, THIS SCREENSHOT SHOWS ORIGINAL SETTING AS PASSWORD WITH ASTERIX
upload : // hPOq5Pjl9grhLyWfmNiRIDUVo5M.png
to
NEW USERS CANT UPLOAD IMAGES, SO I REMOVED, THAT RESTRICTION IS STUPID, THIS SCREENSHOT SHOWS WHICH FIELD TO CHANGE
upload : / / 3x5xIEQWRnucimF8cqXb0aDzeNF.png

However, trying to setup webhook with same secret and different url doesnt work, so either new secret is used on each webhook or webhook was not created at all on snapcraft.io, I suppose that both are currently the case.
NEW USERS CANT UPLOAD IMAGES, SO I REMOVED, THAT RESTRICTION IS STUPID, THIS SCREENSHOT SHOWS THAT WEBHOOK IS NOT WORKING
upload : / / A6domypv70Ghi0XKJYp83p8eYeM.png

As you see, webhook is not working on second snap:
NEW USERS CANT UPLOAD IMAGES, SO I REMOVED, THAT RESTRICTION IS STUPID, THIS SCREENSHOT SHOWS ALL FAILED HOOKS
upload : / / aFhLpSaBeRhMd4asiHreEGQcsVC.png

probably not part of this thread/post, but launchpad builds snaps too, offering additional architecture powerpc, would be nice if that could be added to snapcraft. Connection to launchpad works also well, if configured properly, building on launchpad does release on snapcraft too and combination of manually triggered builds on launchpad (automatic works too) for releases and snapcraft building on each commit is quite good but not perfect as I still miss one arch. That leads me to add simply additional remote url to my git and use actually launchpad for automatic build and release process.

PS: This restriction with screenshots is that stupid that I actually prefer to delete this post and close this account instead wasting my time on feedback here, but ok, I edited it.

you could just use https://imgur.com/ and link the pictures from your post …

It’s to prevent unwanted spam. Please respect our wishes not to be spammed. If you’d asked nicely I could have simply bumped your user level and you’d have no problems posting images. Happy to do that now.

2 Likes

@ogra
I could have also wasted more time to maybe optimize those images before upload as well to spare time in not posting at all, or?

@popey
thanks. I understand what for it is and your forum software does recognize SSO and shows even my SSO logo but it does not know that I am already snapcraft and launchpad member, I understand also that this forum software is not snapcraft platform, but if I can login and create my snap by simply logging in with my github account, why cant I log in the same way to this forum if this is the only place for support? I would call such method outaged and quite user unfriendly.

About upload, your forum software could have warned me that I can not post uploaded files during the upload, not letting me upload and write the reply and at the end to tell the user, such methods are over 10 years old and obsolete where my wasted bandwith would also matter (especially over gprs) and yes, I kinda did not expect it from snapcraft as I was quite impressed and though this forum software works better.

well, i was only trying to help you getting your pics across anyway until you gained enough user level. sorry if that bothered you though i dont think it justifies such an aggressive tone … i’ll keep out of your threads in the future …

1 Like

actually I tried to help a user who claimed he cant find his password, those screenshots show it, last two screenshots were showing that webhook fails, here you could have suggested to upload log instead.

I think it would be getting into nonsense discussion if I reply to you that suggested image host is not the only existing, beside that, if you assume that people are idiots and cant find a way to upload images, then you should have set as high prio that this forum uploads its pictures to suggested image hosters, then you could prevent also new users from spamming, as addition you could NOT display them as long as their reputation is not raised.

Beside all my explanations and being polite you comply about my aggressive tone, this is fully off-topic and you did not reply to any point of my questions/suggestions, I will even not ask how do you think you helped, as then you probably would call it rude. I dislike actually such attitude and I dont care if you read my posts or not.

(Apologies, I hastily commented on https://github.com/canonical-web-and-design/snapcraft.io/issues/2849 before realizing that discussion had been intentionally redirected here for visibilty.)

I’m very interested in this – I want to maintain my Snap on GitHub, but I cannot authorize snapcraft.io with admin access to all the repositories I have access to, so as far as I can tell my only option is to create a new GitHub account with access to just the organization/repository I want to grant access to so that I can authorize it, just so that snapcraft.io can install a webhook on my GitHub repository which I would happily configure myself directly without all this hoop jumping if it were an option.

So in my case, I want to use GitHub webhooks, but cannot reasonably authorize snapcraft.io to access all the organizations on my GitHub account.

2 Likes

Another bump for the same use case.

I maintain a snapcraft.yaml file and recently had my PR merged upstream so now I don’t need my repo anymore except that I can’t connect my account to the upstream repo. There doesn’t seem to be any documented method for manually adding a github webhook either so I’m stuck having to run git pull upstream master && git push origin master just so I can keep the snaps building.

[Edit] This other would also help the security minded folks out too with snapcraft asking for “too many permissions” c.f. Issues on publishing an official radare2 snap package

[Edit] Also related: Excessive permissions required to build from GitHub and Trigger snap build from GitHub Action

Once a GitHub repository was added on snapcraft.io and elevated permissions were granted, could you then revoke all permissions and still trigger the builds manually by clicking the button on https://snapcraft.io/{appID}/builds page? If yes, then I don’t understand why you need to grant those permissions in the first place (they should be made optional).

I removed Snapcraft from https://github.com/settings/applications and now the builds page on snapcraft.io is broken (I’m getting “Internal Server Error” message). How do I recover from that? I can no longer manage the builds or link the GitHub repo again.

Edit: Never mind, I figured out there is the “Set up webhook” button under the “Settings” tab.