def handle(self, *args, **options): access_token = self.get_client_access_token() if not access_token: return projects = self.get_all_projects(access_token) if not projects: return project_id_list = [info['project_id'] for info in projects if info['kind'] == 1 and info['is_offlined'] == 0] # 注册db记录 try: for project_id in project_id_list: repo_provider.add_platform_public_repos(project_id) except Exception as err: self.stdout.write(f"{_('创建项目公共chart失败,详细信息')}: {err}")
def get_or_add_public_repos(self, project_id): if not settings.HELM_HAS_ABILITY_SUPPLY_CHART_REPO_SERVICE: return [] # 1. add/get plain public repo for project public_repos = add_platform_public_repos(target_project_id=project_id) return public_repos
def backend_create_helm_info(cls, project_id): try: repo_list = repo_provider.add_platform_public_repos(project_id) sync_helm_repo.delay(repo_list[0].id, force=True) except Exception as err: logger.error("添加项目Helm仓库失败,详细信息: %s", err)