allow ignored Harbor projects to be configurable
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Max Erenberg 2022-01-02 22:43:22 -05:00
parent 7ec17b2b4d
commit 02598fa3bc
5 changed files with 8 additions and 5 deletions

View File

@ -27,6 +27,8 @@ class Config:
return True
if val.lower() in ['false', 'no']:
return False
if section.startswith('auxiliary ') or section == 'positions':
# We should do something about this...
if section.startswith('auxiliary ') or section == 'positions' or \
(section == 'registry' and key == 'projects_to_ignore'):
return [item.strip() for item in val.split(',')]
return val

View File

@ -19,6 +19,7 @@ class ContainerRegistryService:
api_username = cfg.get('registry_username')
api_password = cfg.get('registry_password')
self.basic_auth = HTTPBasicAuth(api_username, api_password)
self.projects_to_ignore = cfg.get('registry_projects_to_ignore')
def _http_request(self, method: str, path: str, **kwargs):
return requests.request(
@ -45,12 +46,9 @@ class ContainerRegistryService:
# we're actually just going to get a list of projects
resp = self._http_get('/projects')
resp.raise_for_status()
# This project is only owned by the admin account, so we don't
# want to include it
project_exceptions = ['library']
return [
project['name'] for project in resp.json()
if project['name'] not in project_exceptions
if project['name'] not in self.projects_to_ignore
]
def create_project_for_user(self, username: str):

View File

@ -105,3 +105,4 @@ server_url = https://172.19.134.149:6443
base_url = https://registry.cloud.csclub.uwaterloo.ca/api/v2.0
username = REPLACE_ME
password = REPLACE_ME
projects_to_ignore = library, openwhisk

View File

@ -99,3 +99,4 @@ server_url = https://172.19.134.149:6443
base_url = http://localhost:8002/api/v2.0
username = REPLACE_ME
password = REPLACE_ME
projects_to_ignore = library,openwhisk

View File

@ -98,3 +98,4 @@ server_url = https://172.19.134.149:6443
base_url = http://localhost:8002/api/v2.0
username = REPLACE_ME
password = REPLACE_ME
projects_to_ignore = library, openwhisk