Skip to content

Commit

Permalink
Apply correct tags upon signing rawhide updates
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <[email protected]>
  • Loading branch information
mattiaverga committed Feb 15, 2025
1 parent 105b115 commit ebf9994
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bodhi-server/bodhi/server/consumers/signed.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ def __call__(self, message: fedora_messaging.api.Message):
log.info("Every build in update is signed, set status to testing")

build.update.status = UpdateStatus.testing
from_tag = update.release.pending_testing_tag
to_tag = update.release.testing_tag
update.move_tags(from_tag, to_tag)
build.update.date_testing = func.current_timestamp()
build.update.request = None
build.update.pushed = True
Expand Down
19 changes: 19 additions & 0 deletions bodhi-server/bodhi/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3375,6 +3375,25 @@ def add_tag(self, tag):
koji.tagBuild(tag, build.nvr, force=True)
return koji.multiCall()

def move_tags(self, from_tag, to_tag):
"""
Move all :class:`Builds <Build>` in this update netween koji tags.
Args:
from_tag (str): The tag to be removed to the builds.
to_tag (str): The tag to be added to the builds.
"""
log.debug(f'Moving tags from {from_tag} to {to_tag} for {self.title}')
if any(not from_tag, not to_tag):
log.warning(f"Not moving builds of {self.title} from/to empty tag")
return [] # An empty iterator in place of koji multicall

koji = buildsys.get_session()
koji.multicall = True
for build in self.builds:
koji.moveBuild(from_tag, to_tag, build.nvr, force=True)
return koji.multiCall()

def remove_tag(self, tag, koji=None):
"""
Remove the given koji tag from all builds in this update.
Expand Down

0 comments on commit ebf9994

Please sign in to comment.