[gitea] Webhooks and bots

All things Programming
Post Reply
User avatar
Naib
Site Admin
Posts: 1036
Joined: Sat Dec 19, 2020 2:20 am

[gitea] Webhooks and bots

Post by Naib »

This isn't really gitea specific (just the testcase for the exam question).
I am using gitea in a few places (nice lightweight forge frontend) and have managed to start weaning some colleagues off of using git as a bare repository on a network share to using this. I am still facing an awful lot of pushback from a bunch of naysayers that appear to like the sound of their voice over actually doing anything ... "but it doesn't do x, but we don't have our spekial workflow" ... (guess what a random directory on the main NAS doesn't have that, with the extra special sauce that anyone can push anywhere). Their prefered "solution" is the typical design by committee with opinionated process resulting in an unworkable behemoth that is still not fit for deployment after 5+years ...

Gitea pretty much does what is needed but I wanted to expand on it via some sort of butler bot to mitigate the (small) aspects of the criticism that is valid and its purely todo with what other FOSS groups do: a bot that pre-checks an issue:

I have a simple bot working that reacts to an issue being opened/edited and thus I am writing this ci-bot to simply check that certain data exists in the report, shown in a template

1) unit PN
2) firmware version
3) hardware mod standard

if such information isn't present the bot will respond with something like "please ensure the requested data is provided" and sets associated labels (feedback needed etc...). If these things are set, remove any comments it made and sets (type/new) etc...

A nice pet project over xmas to then deploy in a week or so.

What else would be a good thing for this bot todo?
The best argument against democracy is a five-minute conversation with the average voter

Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
User avatar
antae
Director of Sandbags
Posts: 534
Joined: Sat Dec 19, 2020 8:49 am
Location: Ukraine

Re: [gitea] Webhooks and bots

Post by antae »

Naib wrote: Mon Dec 20, 2021 5:42 pm if such information isn't present the bot will respond with something like "please ensure the requested data is provided" and sets associated labels (feedback needed etc...). If these things are set, remove any comments it made and sets (type/new) etc...
Then schedule ticket autoclose in 1 month due to lack of data
Naib wrote: Mon Dec 20, 2021 5:42 pm What else would be a good thing for this bot todo?
These things look harmless:
  • Generate release reports and publish to internal wiki
  • Provide a button to retrigger CI/rerun tests
  • Let people know who need to push to help with approving PR or solving merge conflicts
Off Topic
The possibility to introduce a new thing often meets a stubbornness in a society, and it highly depends on business flows in your team and the introducing a new thing highly depends on the level of passionarity around. Need to think what repetitive manual tasks are being performed again and again and look if a bot can do them. Everyone should want it. If not, it will be hard to introduce the bot due to barriers in understanding. People who are not passionaries(Rus.) they may think the bot will take their work and they will be fired after that, or the bot will take care on their familiar routine so they will have to get their butt up and get out of their zone of comfort. Sometimes they do not want to understand that the bot is not a silver bullet, but it can bring useful things.
My opinion ^_^ may differ from yours. That's OK. Difference makes us humans, not robots.
User avatar
Naib
Site Admin
Posts: 1036
Joined: Sat Dec 19, 2020 2:20 am

Re: [gitea] Webhooks and bots

Post by Naib »

stale is a good one and so is the release reports.

Wider CI will require Drone/Woodpecker (on my roadmap but right now got a low-resource VM as a "ok will will see what you are talking about)
The best argument against democracy is a five-minute conversation with the average voter

Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
User avatar
Naib
Site Admin
Posts: 1036
Joined: Sat Dec 19, 2020 2:20 am

Re: [gitea] Webhooks and bots

Post by Naib »

So right now my butlerbot can

1. authenticate the command received based upon a key - took a bit to figure out what part was passed through sha256
2. add a comment to the issue that triggered the webhook ( limiting it to just Issue opened, closed, reopened, or edited.) since that is the aim
3. add labels ( I need to add a new label along the lines of incomplete information )
4. remove said labels
5. remove its own comments

The idea is a template will be made for issues (lifecycle dependant) and simple regex will check that something has been added. If it hasn't the bot will post a comment about add the info and add a label. every edit the bot will check if it has posted (to not spam...) and once the checks have passed then it will clean up and set a "status::new" type label.

The lifecycles i am thinking are
1) PROTO - no check on message body content, just set a label
2) INTEGRATION - check that fw-version, hw-mod, nvm-mod is provided
3) CONFIG - as Integration, but add in some customer/partner problem reference, unit S/N as well.

ill go for YAML to configure the regex and labels so if a repository has a subtle difference it can be tweaked (or just use the default).
So the only issue i have right now is ... how to mark a repositories with respect to its lifecycle? I could add it as a key in the YAML but then this would need to be updated. I could load the README.md and just ask people to add: Lifecyle:integration at the end ... unsure at the moment.
The best argument against democracy is a five-minute conversation with the average voter

Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
Post Reply