From 08c111a0aa6c49270d7c38a78cc07e451e7db26c Mon Sep 17 00:00:00 2001 From: Janhavi Alekar <97527096+JanhaviAlekar@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:06:30 +0530 Subject: [PATCH] Adding gitops support for all git repositories (#4743) * adding gitops support for all git repo Signed-off-by: JanhaviAlekar * Changing Github-repository to Remote-repository in UI Signed-off-by: JanhaviAlekar * Adding comments Signed-off-by: JanhaviAlekar --------- Signed-off-by: JanhaviAlekar Co-authored-by: Amit Kumar Das Co-authored-by: Namkyu Park <53862866+namkyu1999@users.noreply.github.com> Co-authored-by: Saranya Jena --- chaoscenter/graphql/server/pkg/gitops/gitops.go | 8 ++++++++ chaoscenter/web/src/strings/strings.en.yaml | 2 +- chaoscenter/web/src/strings/types.ts | 2 +- chaoscenter/web/src/views/Gitops/Gitops.tsx | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/chaoscenter/graphql/server/pkg/gitops/gitops.go b/chaoscenter/graphql/server/pkg/gitops/gitops.go index b629e600d79..c7b2afda308 100644 --- a/chaoscenter/graphql/server/pkg/gitops/gitops.go +++ b/chaoscenter/graphql/server/pkg/gitops/gitops.go @@ -14,6 +14,7 @@ import ( "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" + "github.com/go-git/go-git/v5/plumbing/protocol/packp/capability" "github.com/go-git/go-git/v5/plumbing/transport" "github.com/go-git/go-git/v5/plumbing/transport/http" "github.com/go-git/go-git/v5/plumbing/transport/ssh" @@ -172,6 +173,13 @@ func (c GitConfig) GitClone() (*git.Repository, error) { // getAuthMethod returns the AuthMethod instance required for the current repo access [read/writes] func (c GitConfig) getAuthMethod() (transport.AuthMethod, error) { + // Azure DevOps requires the 'multi_ack' and 'multi_ack_detailed' capabilities, + // which are not fully implemented in the go-git package. By default, these + // capabilities are included in 'transport.UnsupportedCapabilities'. + transport.UnsupportedCapabilities = []capability.Capability{ + capability.ThinPack, + } + switch c.AuthType { case model.AuthTypeToken: diff --git a/chaoscenter/web/src/strings/strings.en.yaml b/chaoscenter/web/src/strings/strings.en.yaml index e9061665844..5683707f288 100644 --- a/chaoscenter/web/src/strings/strings.en.yaml +++ b/chaoscenter/web/src/strings/strings.en.yaml @@ -426,7 +426,6 @@ genericResourceNotFoundError: >- has been deleted. gitConnection: Repository Connection gitOps: GitOps -githubRepo: Github Repository gitops: Gitops goBack: Go back to previous page goChaosHome: Go to Home @@ -889,6 +888,7 @@ referencedBy: Referenced By registry: Registry registryName: Registry Name registryType: Registry Type +remoteRepo: Remote Repository remove: Remove removeMember: Remove Member removeMemberConfirmation: Are you sure you want to remove {{username}}? diff --git a/chaoscenter/web/src/strings/types.ts b/chaoscenter/web/src/strings/types.ts index ce63116c0f6..f5f8a3db27f 100644 --- a/chaoscenter/web/src/strings/types.ts +++ b/chaoscenter/web/src/strings/types.ts @@ -362,7 +362,6 @@ export interface StringsMap { 'genericResourceNotFoundError': PrimitiveObject<'resource' | 'resourceID' | 'projectID'> 'gitConnection': unknown 'gitOps': unknown - 'githubRepo': unknown 'gitops': unknown 'goBack': unknown 'goChaosHome': unknown @@ -737,6 +736,7 @@ export interface StringsMap { 'registry': unknown 'registryName': unknown 'registryType': unknown + 'remoteRepo': unknown 'remove': unknown 'removeMember': unknown 'removeMemberConfirmation': PrimitiveObject<'username'> diff --git a/chaoscenter/web/src/views/Gitops/Gitops.tsx b/chaoscenter/web/src/views/Gitops/Gitops.tsx index dcaa2e64ca7..5e6aac98c8c 100644 --- a/chaoscenter/web/src/views/Gitops/Gitops.tsx +++ b/chaoscenter/web/src/views/Gitops/Gitops.tsx @@ -199,7 +199,7 @@ export default function GitopsView({ font={{ variation: FontVariation.BODY2_SEMI, weight: 'semi-bold' }} color={Color.BLACK} > - {getString('githubRepo')} + {getString('remoteRepo')} {gitopsType === GitopsValues.GITHUB && (