Skip to content

PoC: triggering of maintenance tests for openSUSE#473

Closed
foursixnine wants to merge 30 commits into
os-autoinst:masterfrom
foursixnine:opensuse-manual-maintenance
Closed

PoC: triggering of maintenance tests for openSUSE#473
foursixnine wants to merge 30 commits into
os-autoinst:masterfrom
foursixnine:opensuse-manual-maintenance

Conversation

@foursixnine
Copy link
Copy Markdown
Member

@foursixnine foursixnine commented Oct 9, 2025

Ticket: https://progress.opensuse.org/issues/190158

This script is only a proof of concept based of what I understood of what openqabot does.

I basically started off from #468 for some boilerplate and ended up with this script. So aside from requiring GITEA_TOKEN as environment variable, it also requires osc credentials for the given build service api (--bs, defaults to api.opensuse.org)

To call it:

python3 manual-maintenance-tests-trigger.py --project products/PackageHub --branch leap-16.0 --pr-id 158

Which results in the following openqa-cli call:

openqa-cli schedule --host http://localhost:9526 PRIO=100 \
 CI_TARGET_URL=http://localhost:9526 \
 GITEA_REPO=products/PackageHub \
 GITEA_SHA=f95b1c7c0e005e5a9db095f430fdfbde147d9198797284e066a05e8aaf9f4af2 \
 GITEA_STATUSES_URL=https://src.opensuse.org/api/v1/repos/products/PackageHub/statuses/f95b1c7c0e005e5a9db095f430fdfbde147d9198797284e066a05e8aaf9f4af2 \
 GITEA_PR_URL=https://src.opensuse.org/products/PackageHub/pulls/158 \
 webhook_id=gitea:pr:158 \
 VERSION=16.0 \
 DISTRI=opensuse \
 FLAVOR=staged-updates \
 ARCH=x86_64 \
 BUILD=:158:chromium \
 INCIDENT_REPO=http://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-16.0:/PullRequest:/158 \
 INCIDENT_PATCH=158 \
 IMPORT_GPG_KEYS=gpg-pubkey-b3fd7e48-5549fd0f \
 ZYPPER_ADD_REPO_PREFIX=staged-updates \
 INSTALL_PACKAGES=chromedriver chromedriver-debuginfo chromium chromium-debuginfo \
 VERIFY_PACKAGE_VERSIONS=chromedriver 141.0.7390.65-bp160.1.1 chromedriver-debuginfo 141.0.7390.65-bp160.1.1 chromium 141.0.7390.65-bp160.1.1 chromium-debuginfo 141.0.7390.65-bp160.1.1

This is mostly the flow for incident updates (or staged updates), I don't quite get yet how the aggregated updates are handled.

There's also a hardcoded architecture, but that shouldn't be a blocker at this stage, I tried this on my local openQA instance with the following job-group:

defaults:
  x86_64:
    machine: uefi-3G
    priority: 50
products:
  opensuse-staged-updates-x86_64:
    distri: opensuse
    flavor: staged-updates
    version: '16.0'
scenarios:
  x86_64:
    opensuse-staged-updates-x86_64:
      - gnome-agama

Machine and test settings were taken from openqa.opensuse.org

PR data can be passed with --pr-data tests/data/opensuse-maintenance/by-autogits_workflow_pr_bot-151-20251007-154142.json, there's a switch to store the pr data too.

@foursixnine foursixnine changed the title PoC: "Manual" triggering of maintenance tests PoC: triggering of maintenance tests for openSUSE Oct 15, 2025
Avoid multiple nested ifs, to the code more readable
This is mainly to avoid collisions later on
Build parameter was missing, so query would return all jobs for given parameters
Comment thread git-openqa-maintenance.py
from collections import namedtuple
import osc.core

USER_AGENT = "manual-trigger.py (https://github.com/os-autoinst/scripts)"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

git-openqa-maintenance.py?

Copy link
Copy Markdown
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.

There are probably still many improvements to be made but it looks like this would generally work.

This is indeed very similar to what I have already created in qem-bot except that no external dashboard is involved. So this is now kind of a mix between qem-bot gitea-sync and qem-bot increment-approve. (It would be nice if we wouldn't have to duplicate our effort here but I also don't see an easy way of streamlining this. In theory qem-bot could be used for openSUSE as well, though.)

It would be nice to document the usage with some examples in the README.

Comment thread git-openqa-maintenance.py
Comment on lines +16 to +17
dry_run = True
openqa_dry_run = False
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is a bit confusing that dry_run is sometimes shadowed by local variables. Both variables should probably be CLI arguments. Considering you're doing proper CLI argument parsing anyway this shouldn't be a big deal.

Comment thread git-openqa-maintenance.py
"scope": "relevant",
"latest": "1",
}
jobs = openqa.openqa_request("GET", "jobs", values)["jobs"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess this is good enough for now. I'd just like to note that there's a route which gets you all jobs of the latest scheduled product matching the parameters you're using here as well: https://github.com/os-autoinst/openQA/blob/345b0552e13c159d5b31d8403813125b29332929/lib/OpenQA/WebAPI/Controller/API/V1/Iso.pm#L61

With this route you could for instance drop the logic to skip clones and it would only check jobs scheduled via the relevant scheduled products.

I created this route for doing the same what you're doing here in qem-bot so you can find Python code using it in https://github.com/openSUSE/qem-bot/blob/master/openqabot/incrementapprover.py. (This code also has unit tests.)

Comment thread git-openqa-maintenance.py
else:
packages.append(package)

# In theory every staged update, has a single package
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If that's also true in practice then this is different from what I have been dealing with for SLFO/SLE16 on the internal Gitea/IBS.

Copy link
Copy Markdown
Member Author

@foursixnine foursixnine Oct 28, 2025

Choose a reason for hiding this comment

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

Comment thread git-openqa-maintenance.py

def get_open_prs_for_project_branch(project, branch):
pull_requests_url = (
GITEA_HOST + f"/api/v1/repos/{project}/pulls?state=open&base_branch={branch}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When I remember correctly, this will only consider the first 50 PRs or so. You could steal the while loop from https://github.com/openSUSE/qem-bot/blob/44a89a2bb5fe46167169759804a59de3bfc8eb89/openqabot/loader/gitea.py#L138 for paging. (If there are tons of open PRs this won't be very fast, though.)

(Maybe I can make use of the base_branch search parameter in qem-bot as well.)

@okurz
Copy link
Copy Markdown
Member

okurz commented Oct 28, 2025

This is indeed very similar to what I have already created in qem-bot except that no external dashboard is involved. So this is now kind of a mix between qem-bot gitea-sync and qem-bot increment-approve. (It would be nice if we wouldn't have to duplicate our effort here but I also don't see an easy way of streamlining this. In theory qem-bot could be used for openSUSE as well, though.)

That's why we have https://progress.opensuse.org/issues/189912 planned. Meanwhile I would recommend to incorporate the necessary functionality within qem-bot to replace this implementation here

@foursixnine
Copy link
Copy Markdown
Member Author

There are probably still many improvements to be made but it looks like this would generally work.

This is indeed very similar to what I have already created in qem-bot except that no external dashboard is involved.

Yeah

So this is now kind of a mix between qem-bot gitea-sync and qem-bot increment-approve. (It would be nice if we wouldn't have to duplicate our effort here but I also don't see an easy way of streamlining this. In theory qem-bot could be used for openSUSE as well, though.)

That is something I would like too, having three different bots doesn't sound very sustainable

In the meantime I extracted this, and created openSUSE/openSUSE-release-tools#3271 which handles the full workflow (an example is the PR I already linked above https://src.opensuse.org/products/PackageHub/pulls/192)

It would be nice to document the usage with some examples in the README.

@Martchus
Copy link
Copy Markdown
Contributor

Martchus commented Oct 28, 2025

Ok, good to know that there's a more up-to-date version of this. Then I'll try it out and update my findings on https://progress.opensuse.org/projects/openqatests/wiki/Wiki#Scheduling-maintenance-tests-for-openSUSE-Leap-16.

To avoid confusion I would close this draft in favor of openSUSE/openSUSE-release-tools#3271, or do you still want anything to be merged here?

@foursixnine
Copy link
Copy Markdown
Member Author

To avoid confusion I would close this draft in favor of openSUSE/openSUSE-release-tools#3271, or do you still want anything to be merged here?

No objections, this was never meant to be merged here :)

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.

4 participants