#403 Ignore container repos without auto_release_tags
Merged 4 years ago by jkaluza. Opened 4 years ago by lucarval.
lucarval/freshmaker ingore-repos-with-missing-tags  into  master

file modified
+4 -2
@@ -645,8 +645,10 @@ 

  

          repos = []

          for repo_data in response['processed']:

-             if "auto_rebuild_tags" not in repo_data:

-                 repo_data["auto_rebuild_tags"] = ["latest"]

+             if not repo_data.get('auto_rebuild_tags'):

+                 log.info('"auto_rebuild_tags" not set for %s repository, ignoring repository',

+                          repo_data["repository"])

+                 continue

              repo = ContainerRepository()

              repo.update(repo_data)

              repos.append(repo)

file modified
+19 -2
@@ -826,14 +826,28 @@ 

                      'metrics': {

                          'pulls_in_last_30_days': 0,

                          'last_update_date': '20170223T08:28:40.913-0500'

-                     }

+                     },

+                     'repository': 'spam',

+                     'auto_rebuild_tags': ['latest'],

                  },

                  {

                      'creationDate': '20161020T04:52:43.365-0400',

                      'metrics': {

                          'last_update_date': '20170501T03:00:19.892-0400',

                          'pulls_in_last_30_days': 20

-                     }

+                     },

+                     'repository': 'bacon',

+                     'auto_rebuild_tags': ['latest'],

+                 },

+                 {

+                     'creationDate': '20161020T04:52:43.365-0400',

+                     'metrics': {

+                         'last_update_date': '20170501T03:00:19.892-0400',

+                         'pulls_in_last_30_days': 20

+                     },

+                     # This repository is ignored by Freshmaker because it does not

+                     # have auto_rebuild_tags set.

+                     'repository': 'ignored-due-to-missing-tags',

                  }

              ],

              'entityVersion': '0.0.11',
@@ -871,6 +885,9 @@ 

          self.assertEqual('20170223T08:28:40.913-0500', repo['metrics']['last_update_date'])

          self.assertEqual(["latest"], repo["auto_rebuild_tags"])

  

+         self.assertEqual(repos[0]['repository'], 'spam')

+         self.assertEqual(repos[1]['repository'], 'bacon')

+ 

      @patch('freshmaker.lightblue.requests.post')

      def test_raise_error_if_request_data_is_incorrect(self, post):

          post.return_value.status_code = http_client.BAD_REQUEST