#43 Disabling pushing to c9s branch in the fork
Merged 4 months ago by carlwgeorge. Opened 4 months ago by mohanboddu.
centos/ mohanboddu/centpkg fork-changes  into  develop

file modified
+26

@@ -63,6 +63,32 @@ 

      except Exception:

          pass

  

+     if rv.ok:

+         fork_id = rv.json()['id']

+         try:

+             # Unprotect c9s in fork

+             rv = requests.delete('{0}/projects/{1}/protected_branches/{2}'.format(api_url, fork_id, 'c9s'), headers=header)

+         except ConnectionError as error:

+             error_msg = ('The connection to API failed while trying to unprotect c9s branch'

+                          'in the fork. The error was: {0}'.format(str(error)))

+             raise rpkgError(error_msg)

+ 

+ 

+         try:

+             # Reprotect c9s to disable pushes

+             # Only maintainers in gitlab are allowed to push with the following config

+             # In CS, every pkg maintainer is considered as a developer in gitlab

+             data = {'id': fork_id,

+                     'name': 'c9s',

+                     'allowed_to_push': [{'access_level': 40}],

+                     'allowed_to_merge': [{'access_level': 40}],

+                     }

+             rv = requests.post('{0}/projects/{1}/protected_branches'.format(api_url, fork_id), json=data, headers=header)

+         except ConnectionError as error:

+             error_msg = ('The connection to API failed while trying to reprotect c9s branch'

+                          'in the fork fork. The error was: {0}'.format(str(error)))

+             raise rpkgError(error_msg)

+ 

      base_error_msg = ('The following error occurred while creating a new fork: {0}')

      if not rv.ok:

          # fork was already created

Pull-Request has been merged by carlwgeorge

4 months ago

This has been released in version 0.6.5.

Metadata