Skip to content

Conversation

perlpunk
Copy link
Contributor

@perlpunk perlpunk commented Sep 23, 2025

Issue: https://progress.opensuse.org/issues/185491

Still a lot missing:

  • Lots of hardcoded variables
  • To be able to report back the results when the openQA jobs finish we need to set the webhook_id field of the scheduled product. Alternatively it could be done by a hook script
  • Implementing reporting back results
  • The created openQA jobs are currently not functional

Requirements:

  • python3-pika

To run the script:

python3 amqp-listen-gitea.py --verbose 3

This will print all received events. verbose 2 will only print opensuse.src. events, and verbose 1 only the ones we want to process.
To simulate an event for testing without having to request a review you can use this:

python3 amqp-listen-gitea.py --simulate-review-requested-event tests/data/gitea-amqp/minimal-payload-gitea-review-requested.json

It will schedule a product and add a pending check to the corresponding pull request (I used https://src.opensuse.org/tinita/myplayground/pulls/2 for testing), linking to one of the scheduled jobs

Copy link
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally good.



def listen(args):
connection = pika.BlockingConnection(pika.URLParameters(args.url))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one question and note to look at. I guess this part is taken from https://amqp.opensuse.org/files/amqp_get_opensuse.py, which comes with pika.BlockingConnection. I wonder if this is going to stay or there is a plan to use async connection here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tried out https://rabbit.opensuse.org/files/amqp_listen_opensuse.py which is using await, but it uses aio_pika, and I couldn't find that as a package in opensuse. So I thought it's either blocking and pika or async and aio_pika.
But apparently there is also an example for pika: https://pika.readthedocs.io/en/stable/examples/asynchronous_consumer_example.html
I don't know at this point which approach would be better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the BlockingConnection is simpler. Documentation comes with some warnings tho.
for async there is https://pika.readthedocs.io/en/stable/intro.html which is a good start I guess.

@@ -0,0 +1,437 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging it would make sense to trim down these JSON files to what's actually needed. (I know it is annoying, had to do the same when extending qem-bot.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a proof of concept and and example. It is not meant to be merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That file can be used to simulate a review request without actually having to request a review on gitea (I didn't want to spam people with endless emails)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants