#4494 allow recycling in get_next_build
Merged by mikem. Opened by mikem.
mikem/koji get_next_build_recycle  into  master

Download 4494.patch

Fixes https://pagure.io/koji/issue/4490

Prior to #4413, get_next_build allowed recycling. That PR added the strict flag to new_build() to protect against races. Unfortunately this leads to #4490.

Here we drop the strict arg (hence allowing recycling), but add locking to to recycle_build to prevent two calls from recycling the same build in a race.

1 new commit added

  • a bit more logging

Now that I've written this up, I think another aspect of the use of strict before was avoiding all the possible error cases of recycling. ~~It might be better to just never recycle here (but consider all builds for the increment base)~~

2 new commits added

  • add more tries in get_next_build
  • fix ref for consistency

Ok, I convinced myself that recycling here is the way to go:

  • it's consistent with past behavior
  • I've added locking in recycle_build
  • there's no perfect solution to auto-incrementing
  • unrecyclable builds in failed/canceled state should be rare
  • I've added more retries just in case

@julian8628

:thumbsup:

Metadata Update from @mikem:
- Pull-request tagged with: testing-custom

It needs to fix, because we have a problem here: https://coprbe.devel.redhat.com/results/brew-qe-team/koji-nightly/epel-8-x86_64/00128995-koji/builder-live.log.gz

Ah, good catch!

This wasn't showing up for me because this is now valid syntax since python3.12
https://peps.python.org/pep-0701/

But of course we want to support older 3.x versions here. Will fix momentarily.

For posterity, the error was:

Bytecompiling .py files below /builddir/build/BUILDROOT/koji-1.35.9-1.el8.x86_64/usr/lib/python3.6 using /usr/libexec/platform-python
*** Error compiling '/builddir/build/BUILDROOT/koji-1.35.9-1.el8.x86_64/usr/lib/python3.6/site-packages/kojihub/kojihub.py'...
  File "/usr/lib/python3.6/kojihub.py", line 4887
    logger.info(f'Incrementing next build release to {build_info['release']}: {e}')
                                                                        ^
SyntaxError: invalid syntax

1 new commit added

  • backwards compatible fstring quoting

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

rebased onto b66ff6c69ef4ae50872343db082b1ac579d122d9

Commit 249d84bb fixes this pull-request

Pull-Request has been merged by mikem

Metadata