Skip to main content

Repository Service

Repository Service API performs CRUD actions against repository resources.

Service Definition

Package: repository Service: RepositoryService The RepositoryService manages Git, Helm, and OCI repository configurations that Argo CD uses to fetch application manifests.

RPC Methods

ListRepositories

Gets a list of all configured repositories. Request: RepoQuery
repo
string
Repo URL for query
forceRefresh
bool
Whether to force a cache refresh on repo’s connection state
appProject
string
App project for query
Response: RepositoryList REST Endpoint: GET /api/v1/repositories

ListWriteRepositories

Gets a list of all configured write repositories. Request: RepoQuery Response: RepositoryList REST Endpoint: GET /api/v1/write-repositories

Get

Returns a repository or its credentials. Request: RepoQuery
repo
string
required
The repository URL
forceRefresh
bool
Whether to force a cache refresh on repo’s connection state
appProject
string
App project for query
Response: Repository REST Endpoint: GET /api/v1/repositories/{repo}

GetWrite

Returns a repository or its write credentials. Request: RepoQuery
repo
string
required
The repository URL
Response: Repository REST Endpoint: GET /api/v1/write-repositories/{repo}

CreateRepository

Creates a new repository configuration. Request: RepoCreateRequest
repo
Repository
required
Repository definition
upsert
bool
Whether to create in upsert mode
credsOnly
bool
Whether to operate on credential set instead of repository
Response: Repository REST Endpoint: POST /api/v1/repositories

CreateWriteRepository

Creates a new write repository configuration. Request: RepoCreateRequest Response: Repository REST Endpoint: POST /api/v1/write-repositories

UpdateRepository

Updates a repository configuration. Request: RepoUpdateRequest
repo
Repository
required
Repository definition to update
Response: Repository REST Endpoint: PUT /api/v1/repositories/{repo.repo}

UpdateWriteRepository

Updates a write repository configuration. Request: RepoUpdateRequest Response: Repository REST Endpoint: PUT /api/v1/write-repositories/{repo.repo}

DeleteRepository

Deletes a repository from the configuration. Request: RepoQuery
repo
string
required
The repository URL to delete
Response: RepoResponse REST Endpoint: DELETE /api/v1/repositories/{repo}

DeleteWriteRepository

Deletes a write repository from the configuration. Request: RepoQuery Response: RepoResponse REST Endpoint: DELETE /api/v1/write-repositories/{repo}

ValidateAccess

Validates access to a repository with given parameters. Request: RepoAccessQuery
repo
string
required
The URL to the repo
username
string
Username for accessing repo
password
string
Password for accessing repo
sshPrivateKey
string
Private key data for accessing SSH repository
insecure
bool
Whether to skip certificate or host key validation
tlsClientCertData
string
TLS client cert data for accessing HTTPS repository
tlsClientCertKey
string
TLS client cert key for accessing HTTPS repository
type
string
The type of the repo
name
string
The name of the repo
enableOci
bool
Whether helm-oci support should be enabled for this repo
githubAppPrivateKey
string
Github App Private Key PEM data
githubAppID
int64
Github App ID of the app used to access the repo
githubAppInstallationID
int64
Github App Installation ID of the installed GitHub App
githubAppEnterpriseBaseUrl
string
Github App Enterprise base url if empty will default to https://api.github.com
proxy
string
HTTP/HTTPS proxy to access the repository
project
string
Reference between project and repository
gcpServiceAccountKey
string
Google Cloud Platform service account key
forceHttpBasicAuth
bool
Whether to force HTTP basic auth
Response: RepoResponse REST Endpoint: POST /api/v1/repositories/{repo}/validate

ValidateWriteAccess

Validates write access to a repository with given parameters. Request: RepoAccessQuery Response: RepoResponse REST Endpoint: POST /api/v1/write-repositories/{repo}/validate

ListRefs

Lists branches and tags in a Git repository. Request: RepoQuery
repo
string
required
The repository URL
Response: Refs
branches
string[]
List of branch names
tags
string[]
List of tag names
REST Endpoint: GET /api/v1/repositories/{repo}/refs

ListOCITags

Lists tags in an OCI repository. Request: RepoQuery
repo
string
required
The repository URL
Response: Refs
tags
string[]
List of OCI tags
REST Endpoint: GET /api/v1/repositories/{repo}/oci-tags

ListApps

Returns list of apps in the repo. Request: RepoAppsQuery
repo
string
required
The repository URL
revision
string
The revision to scan
appName
string
The application name
appProject
string
The application project
Response: RepoAppsResponse
items
AppInfo[]
List of applications found in the repository
AppInfo Fields:
  • type (string): Application type (e.g., “Kustomize”, “Helm”, “Directory”)
  • path (string): Path to the application in the repository
REST Endpoint: GET /api/v1/repositories/{repo}/apps

GetAppDetails

Returns application details by given path. Request: RepoAppDetailsQuery
source
ApplicationSource
required
The application source
appName
string
The application name
appProject
string
The application project
sourceIndex
int32
Source index (for multi source apps)
versionId
int32
Version ID from historical data (for multi source apps)
Response: RepoAppDetailsResponse
type
string
Application type
helm
HelmAppSpec
Helm application details (if type is Helm)
kustomize
KustomizeAppSpec
Kustomize application details (if type is Kustomize)
directory
DirectoryAppSpec
Directory application details (if type is Directory)
plugin
PluginAppSpec
Plugin application details (if type is Plugin)
REST Endpoint: POST /api/v1/repositories/{source.repoURL}/appdetails

GetHelmCharts

Returns list of helm charts in the specified repository. Request: RepoQuery
repo
string
required
The repository URL
Response: HelmChartsResponse
items
HelmChart[]
List of Helm charts
HelmChart Fields:
  • name (string): Chart name
  • versions (string[]): Available chart versions
REST Endpoint: GET /api/v1/repositories/{repo}/helmcharts

gRPC Example

import (
    "context"
    "google.golang.org/grpc"
    repositorypkg "github.com/argoproj/argo-cd/v3/pkg/apiclient/repository"
    "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)

// Create a gRPC connection
conn, err := grpc.Dial("argocd-server:443", grpc.WithInsecure())
if err != nil {
    log.Fatal(err)
}
defer conn.Close()

// Create repository service client
client := repositorypkg.NewRepositoryServiceClient(conn)

// List repositories
repos, err := client.ListRepositories(context.Background(), &repositorypkg.RepoQuery{})
if err != nil {
    log.Fatal(err)
}

// Get a specific repository
repo, err := client.Get(context.Background(), &repositorypkg.RepoQuery{
    Repo: "https://github.com/argoproj/argocd-example-apps",
})
if err != nil {
    log.Fatal(err)
}

// Create a new repository
newRepo := &v1alpha1.Repository{
    Repo: "https://github.com/my-org/my-repo",
    Type: "git",
    Username: "git",
    Password: "my-token",
}

createdRepo, err := client.CreateRepository(context.Background(), &repositorypkg.RepoCreateRequest{
    Repo:   newRepo,
    Upsert: false,
})
if err != nil {
    log.Fatal(err)
}

// List branches and tags
refs, err := client.ListRefs(context.Background(), &repositorypkg.RepoQuery{
    Repo: "https://github.com/argoproj/argocd-example-apps",
})
if err != nil {
    log.Fatal(err)
}

fmt.Printf("Branches: %v\n", refs.Branches)
fmt.Printf("Tags: %v\n", refs.Tags)

// List apps in repository
apps, err := client.ListApps(context.Background(), &repositorypkg.RepoAppsQuery{
    Repo:     "https://github.com/argoproj/argocd-example-apps",
    Revision: "HEAD",
})
if err != nil {
    log.Fatal(err)
}

for _, app := range apps.Items {
    fmt.Printf("Found app: %s at path %s\n", app.Type, app.Path)
}

// Validate repository access
validateResp, err := client.ValidateAccess(context.Background(), &repositorypkg.RepoAccessQuery{
    Repo:     "https://github.com/my-org/my-repo",
    Username: "git",
    Password: "my-token",
})
if err != nil {
    log.Fatal(err)
}

Build docs developers (and LLMs) love