Skip to content

feat: migrate obs-auto-submit to Python + better dry-run#607

Open
okurz wants to merge 3 commits into
os-autoinst:masterfrom
okurz:feature/006_poo201843_migrate_auto_submit_python
Open

feat: migrate obs-auto-submit to Python + better dry-run#607
okurz wants to merge 3 commits into
os-autoinst:masterfrom
okurz:feature/006_poo201843_migrate_auto_submit_python

Conversation

@okurz

@okurz okurz commented Jun 16, 2026

Copy link
Copy Markdown
Member
  • feat: execute read-only commands in dry-run mode
  • feat: migrate obs-auto-submit to Python
  • feat: handle OBS transient errors natively

Verified manually with ./os-autoinst-obs-auto-submit --dry-run

Detailed output of dry-run…

INFO: handle_auto_submit openQA
INFO: update_package openQA
INFO: [dry-run] Would execute: osc addremove
WARNING: [dry-run] Command 'osc status' failed (Command '['osc', 'status']' returned non-zero exit status 1.), falling back to dummy success.
INFO: [dry-run] Would execute: osc ci -m Offline generation of
INFO: wait_for_package_build openSUSE:Factory
INFO: has_pending_submission(openQA, openSUSE:Factory)
INFO: Skipping submission, there is still a pending SR for package openQA in project openSUSE:Factory younger than 2 days.
1355233 State:new By:maintbot When:2026-05-26T19:03:25
Created by: okurz
maintenance_incident: devel:openQA:tested/openQA@920 -> openSUSE:Maintenance (release in openSUSE:Backports:SLE-15-SP7:Update)
Review by User is accepted: licensedigger(licensedigger)
Review by User is accepted: factory-auto(factory-auto)
Review by User is accepted: maintbot(maintbot)
Descr: Update to 5.1779808735.8c9bd805 5.1779808735.8c9bd805
5.1779808735.8c9bd805 5.1779808735.8c9bd805 5.1779808735.8c9bd805
Comment: All reviewers accepted request

1359837 State:review By:staging-bot When:2026-06-16T20:08:20
Created by: okurz
submit: devel:openQA:tested/openQA@836fa0f3bebc99c86fe7036d5773476e -> openSUSE:Factory
Review by User is accepted: licensedigger(licensedigger)
Review by User is accepted: factory-auto(factory-auto)
Review by Group is accepted: factory-staging(staging-bot)
Review by Group is new: opensuse-review-team(factory-auto)
Review by Project is new: openSUSE:Factory:Staging:adi:18(staging-bot)
Descr: Update to 5.1781621316.6d025b35 5.1781621316.6d025b35
5.1781621316.6d025b35 5.1781621316.6d025b35 5.1781621316.6d025b35
Comment: Being evaluated by staging project
"openSUSE:Factory:Staging:adi:18"

INFO: has_pending_submission(openQA, openSUSE:Backports:SLE-15-SP7:Update)
INFO: Skipping submission, there is still a pending SR for package openQA in project openSUSE:Backports:SLE-15-SP7:Update younger than 2 days.
1355233 State:new By:maintbot When:2026-05-26T19:03:25
Created by: okurz
maintenance_incident: devel:openQA:tested/openQA@920 -> openSUSE:Maintenance (release in openSUSE:Backports:SLE-15-SP7:Update)
Review by User is accepted: licensedigger(licensedigger)
Review by User is accepted: factory-auto(factory-auto)
Review by User is accepted: maintbot(maintbot)
Descr: Update to 5.1779808735.8c9bd805 5.1779808735.8c9bd805
5.1779808735.8c9bd805 5.1779808735.8c9bd805 5.1779808735.8c9bd805
Comment: All reviewers accepted request

1359837 State:review By:staging-bot When:2026-06-16T20:08:20
Created by: okurz
submit: devel:openQA:tested/openQA@836fa0f3bebc99c86fe7036d5773476e -> openSUSE:Factory
Review by User is accepted: licensedigger(licensedigger)
Review by User is accepted: factory-auto(factory-auto)
Review by Group is accepted: factory-staging(staging-bot)
Review by Group is new: opensuse-review-team(factory-auto)
Review by Project is new: openSUSE:Factory:Staging:adi:18(staging-bot)
Descr: Update to 5.1781621316.6d025b35 5.1781621316.6d025b35
5.1781621316.6d025b35 5.1781621316.6d025b35 5.1781621316.6d025b35
Comment: Being evaluated by staging project
"openSUSE:Factory:Staging:adi:18"

INFO: has_pending_submission(openQA, openSUSE:Leap:16.0)
INFO: Skipping submission, there is the still pending PR 'https://src.opensuse.org/pool/openQA/pulls/30' by os-autoinst-obs-workflow targeting leap-16.0 younger than 7 days.
INFO: [dry-run] Would execute: osc rdelete -m Cleaning up openQA from devel:openQA:testing for next submission devel:openQA:testing openQA
INFO: handle_auto_submit openQA-devel-container
INFO: Latest revision already in openSUSE:Factory
INFO: [dry-run] Would execute: osc rdelete -m Cleaning up openQA-devel-container from devel:openQA:testing for next submission devel:openQA:testing openQA-devel-container
INFO: handle_auto_submit os-autoinst
INFO: update_package os-autoinst
INFO: [dry-run] Would execute: osc addremove
WARNING: [dry-run] Command 'osc status' failed (Command '['osc', 'status']' returned non-zero exit status 1.), falling back to dummy success.
INFO: [dry-run] Would execute: osc ci -m Offline generation of
INFO: wait_for_package_build openSUSE:Factory
INFO: has_pending_submission(os-autoinst, openSUSE:Factory)
INFO: Skipping submission, there is still a pending SR for package os-autoinst in project openSUSE:Factory younger than 2 days.
1359840 State:review By:factory-auto When:2026-06-16T20:17:54
Created by: okurz
submit: devel:openQA:tested/os-autoinst@880be23466d45a29ac2e22a810fd9a1e -> openSUSE:Factory
Review by User is new: licensedigger
Review by User is accepted: factory-auto(factory-auto)
Review by Group is new: factory-staging
Review by Group is new: opensuse-review-team(factory-auto)
Descr: Update to 5.1781620242.0160257 5.1781620242.0160257
5.1781620242.0160257 5.1781620242.0160257
Comment: Please review sources

1359841 State:review By:okurz When:2026-06-16T20:11:53
Created by: okurz
maintenance_incident: devel:openQA:tested/os-autoinst@487 -> openSUSE:Maintenance (release in openSUSE:Backports:SLE-15-SP7:Update)
Review by User is new: licensedigger
Review by User is new: factory-auto
Review by User is new: maintbot
Descr: Update to 5.1781620242.0160257 5.1781620242.0160257
5.1781620242.0160257 5.1781620242.0160257

INFO: has_pending_submission(os-autoinst, openSUSE:Backports:SLE-15-SP7:Update)
INFO: Skipping submission, there is still a pending SR for package os-autoinst in project openSUSE:Backports:SLE-15-SP7:Update younger than 2 days.
1359840 State:review By:factory-auto When:2026-06-16T20:17:54
Created by: okurz
submit: devel:openQA:tested/os-autoinst@880be23466d45a29ac2e22a810fd9a1e -> openSUSE:Factory
Review by User is new: licensedigger
Review by User is accepted: factory-auto(factory-auto)
Review by Group is new: factory-staging
Review by Group is new: opensuse-review-team(factory-auto)
Descr: Update to 5.1781620242.0160257 5.1781620242.0160257
5.1781620242.0160257 5.1781620242.0160257
Comment: Please review sources

1359841 State:review By:okurz When:2026-06-16T20:11:53
Created by: okurz
maintenance_incident: devel:openQA:tested/os-autoinst@487 -> openSUSE:Maintenance (release in openSUSE:Backports:SLE-15-SP7:Update)
Review by User is new: licensedigger
Review by User is new: factory-auto
Review by User is new: maintbot
Descr: Update to 5.1781620242.0160257 5.1781620242.0160257
5.1781620242.0160257 5.1781620242.0160257

INFO: has_pending_submission(os-autoinst, openSUSE:Leap:16.0)
INFO: Skipping submission, there is the still pending PR 'https://src.opensuse.org/pool/os-autoinst/pulls/23' by os-autoinst-obs-workflow targeting leap-16.0 younger than 7 days.
INFO: [dry-run] Would execute: osc rdelete -m Cleaning up os-autoinst from devel:openQA:testing for next submission devel:openQA:testing os-autoinst
INFO: handle_auto_submit os-autoinst-distri-opensuse-deps
INFO: No dependency changes for os-autoinst-distri-opensuse-deps
INFO: [dry-run] Would execute: osc rdelete -m Cleaning up os-autoinst-distri-opensuse-deps from devel:openQA:testing for next submission devel:openQA:testing os-autoinst-distri-opensuse-deps
INFO: handle_auto_submit xterm-console
INFO: Latest revision already in openSUSE:Factory
INFO: [dry-run] Would execute: osc rdelete -m Cleaning up xterm-console from devel:openQA:testing for next submission devel:openQA:testing xterm-console
INFO: [dry-run] Would execute: cleanup-obs-project devel:openQA:testing I am sure

Related issue: https://progress.opensuse.org/issues/201843

okurz added 3 commits June 16, 2026 20:25
Motivation:
Handle temporary OBS unavailabilities gracefully without relying on external
CLI retry utilities.

Design Choices:
Introduce run_osc_cmd using python's tenacity library with exponential backoff,
a 1-hour timeout, and smart transient error detection for 5xx/gateway errors.

Benefits:
Provides robust, configurable retry behavior and prevents needless delays on
permanent failures while ensuring prompt alerts.

Related issue: https://progress.opensuse.org/issues/201267
Motivation:
The bash implementation of os-autoinst-obs-auto-submit has become too complex
to maintain, test, and safely extend.

Design Choices:
Rewrite the script in Python 3 using typer, httpx, and tenacity, replacing
external process calls like xmlstarlet with native XML parsing.

Benefits:
Enhances code maintainability, simplifies test coverage with pytest,
and guarantees the same seamless execution profile in CI.

Related issue: https://progress.opensuse.org/issues/201843
Motivation:
Enable dry-runs to perform read-only queries (like listing and fetching PRs)
to simulate decisions accurately while safely bypassing mutating operations.

Design Choices:
Only skip command execution in run_osc_cmd if the command is marked as mutating,
and gracefully fall back to dummy success if read-only commands fail.

Benefits:
Provides a realistic and safe dry-run flow that exercises decision trees without
risking unintentional modifications or crashing on developer machines.

Related issue: https://progress.opensuse.org/issues/201843
@os-autoinst os-autoinst deleted a comment from mergify Bot Jun 19, 2026
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.

2 participants