feat: migrate obs-auto-submit to Python + better dry-run#607
Open
okurz wants to merge 3 commits into
Open
Conversation
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
Martchus
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Verified manually with
./os-autoinst-obs-auto-submit --dry-runDetailed 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