#2936 kojira: don't fail on deleted needed tag
Merged 10 months ago by tkopecek. Opened 10 months ago by tkopecek.
tkopecek/koji issue2935  into  master

file modified
+19 -12
@@ -783,6 +783,12 @@ 

          for entry in self.needed_tags.values():

              self.setTagScore(entry)

  

+     def _delete_needed_tag(self, tag_id):

+         try:

+             del self.needed_tags[tag_id]

+         except KeyError:

+             pass

+ 

      def updateRepos(self):

          self.logger.debug("Updating repos")

  
@@ -826,11 +832,7 @@ 

              if tstate == 'CLOSED':

                  self.logger.info("Finished: newRepo task %s for tag %s", task_id, tag_id)

                  del self.tasks[task_id]

-                 try:

-                     del self.needed_tags[tag_id]

-                 except KeyError:

-                     # it could be already removed by checkNeeded

-                     pass

+                 self._delete_needed_tag(tag_id)

              elif tstate in ('CANCELED', 'FAILED'):

                  self.logger.info(

                      "Problem: newRepo task %s for tag %s is %s", task_id, tag_id, tstate)
@@ -885,11 +887,7 @@ 

                      # no longer needed

                      self.logger.info("Tag %(name)s has a current or in "

                                       "progress repo", entry['taginfo'])

-                     try:

-                         del self.needed_tags[tag_id]

-                     except KeyError:

-                         # it could be already deleted by checkTasks

-                         pass

+                     self._delete_needed_tag(tag_id)

                  # if not covered, we already know

                  continue

              if covered:
@@ -928,7 +926,7 @@ 

              if tag_id not in build_tags:

                  self.logger.info("Tag %(name)s is no longer a build tag",

                                   entry['taginfo'])

-                 del self.needed_tags[tag_id]

+                 self._delete_needed_tag(tag_id)

          for tag_id, repolist in tag_repos.items():

              if tag_id not in build_tags and tag_id not in ignored_build_tags:

                  # repos for these tags are no longer required
@@ -999,7 +997,16 @@ 

              if maven:

                  if running_tasks_maven >= self.options.max_repo_tasks_maven:

                      continue

-             task_id = self.session.newRepo(tagname, **taskopts)

+             try:

+                 task_id = self.session.newRepo(tagname, **taskopts)

+             except koji.GenericError:

+                 # potentially deleted tag

+                 if not self.session.getTag(tagname):

+                     self._delete_needed_tag(tag['taginfo']['id'])

+                     logger.debug('Needed tag %s (%d) was deleted meanwhile', tagname, tag['taginfo']['id'])

+                     continue

+                 else:

+                     raise

              running_tasks += 1

              if maven:

                  running_tasks_maven += 1

pretty please pagure-ci rebuild

10 months ago

rebased onto 6864516eea35adf5694124f1c4e8879f22b65d78

10 months ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

10 months ago

tag['id'] should be tag['taginfo']['id']

rebased onto ebb6ce8075ee3d85b49b2e51648be450b7bdebc1

10 months ago

rebased onto b561c6f

10 months ago

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

10 months ago

Commit efe1aa0 fixes this pull-request

Pull-Request has been merged by tkopecek

10 months ago
Metadata