#2817 koji-gc: Implement hastag policy for koji-gc
Merged a year ago by tkopecek. Opened a year ago by ignatenkobrain.
ignatenkobrain/koji koji-gc-hastag  into  master

file modified
+1
@@ -168,6 +168,7 @@ 

        # stuff to protect

        # note that tags with master lock engaged are already protected

        tag *-updates :: keep

+       hastag no-gc :: skip

        age < 1 day :: skip

        sig fedora-gold :: skip

        sig fedora-test && age < 12 weeks :: keep

file modified
+13
@@ -776,6 +776,18 @@ 

          return self.func(time.time() - data['ts'], self.span)

  

  

+ class HasTagPruneTest(koji.policy.BaseSimpleTest):

+     name = 'hastag'

+ 

+     def run(self, data):

+         patterns = self.str.split()[1:]

+         for tag in data['tags']:

+             for pattern in patterns:

+                 if fnmatch.fnmatch(tag['name'], pattern):

+                     return True

+         return False

+ 

+ 

  def read_policies(fn=None):

      """Read tag gc policies from file

  
@@ -907,6 +919,7 @@ 

                  data['keys'] = LazyValue(get_build_sigs, (entry['build_id'],), {'cache': True})

                  data['volname'] = LazyValue(lambda x: session.getBuild(x).get('volume_name'),

                                              (entry['build_id'],), cache=True)

+                 data['tags'] = LazyValue(session.listTags, (entry['build_id'],), cache=True)

                  build_ids[nvr] = entry['build_id']

                  action = policies.apply(data)

                  if action is None:

rebased onto 3e85b33

a year ago

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

a year ago

FYI in my basic testing this works fine. I mean it covers use-case described in the linked issue.

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

a year ago

Commit 28eb8a8 fixes this pull-request

Pull-Request has been merged by tkopecek

a year ago