koji: support draft builds

Draft builds have some specialities we need to take care of:

  1. the release and nvr contains ,draft_<build-id> suffix
  2. the src.rpm does not contain the suffix
  3. we need to support the promoted nvr (without the draft suffix) in some use cases - see TFT-3976

To fix this:

  1. introduce draft property to the builds, indicating this is a draft build

  2. introduce nvr_promoted which exposes the NVR that would be promoted for the draft build. This will be used in the UMB reporting to report the correct NVR in the messages (TFT-3976)

  3. correct the code so it reports correct src.rpm name, release, nvr, rpm_urls and srpm_urls by falling back to using subtasks similarly to scratch builds

  4. add test coverage for the added changes

You can test with a draft build this way:

$ poetry install -E development
$ citool brew --task-id 69369167 debug --execute
ipdb> self.shared('primary_task')
BrewTask(69369167)
ipdb> self.shared('primary_task').nvr
'libtiff-4.0.9-17.el8_2.2,draft_3882886'
ipdb> self.shared('primary_task').nvr_promoted
'libtiff-4.0.9-17.el8_2.2'
ipdb> self.shared('primary_task').release
'17.el8_2.2,draft_3882886'
ipdb> self.shared('primary_task').srpm_urls
['http://download.devel.redhat.com/brewroot/work/tasks/9180/69369180/libtiff-4.0.9-17.el8_2.2.src.rpm']

Relates to TFT-3976

Signed-off-by: Miroslav Vadkerti mvadkert@redhat.com

Merge request reports

Loading