convoy docs
Search

GitRepository

A Git repository and the credentials to read it.

A GitRepository is a reusable source: a URL and credentials. It does not select a version. Each Release selects the branch, tag or commit in spec.source.gitRepository.ref, so many Releases can use one GitRepository.

API groupsource.convoy.kumodo.io/v1alpha1
ScopeNamespaced
Subresources/status
ConditionsReady

Example#

sources/gitrepository-auth-ssh.yaml
# GitRepository with SSH key auth. Requires two things:
#   - a Secret holding the private key (sshKeyRef)
#   - a ConfigMap holding known_hosts (knownHostsRef) — MANDATORY: convoy verifies
#     the server host key against it (no insecure "ignore host key" mode).
# known_hosts must use PLAINTEXT host entries (hashed |1|… entries are rejected).
# Get the entries with, e.g.: ssh-keyscan github.com
apiVersion: v1
kind: Secret
metadata:
  name: git-ssh
  namespace: default
type: Opaque
stringData:
  identity: |
    -----BEGIN OPENSSH PRIVATE KEY-----
    ...replace with your private key...
    -----END OPENSSH PRIVATE KEY-----
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: git-known-hosts
  namespace: default
data:
  known_hosts: |
    github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
---
apiVersion: source.convoy.kumodo.io/v1alpha1
kind: GitRepository
metadata:
  name: private-repo-ssh
  namespace: default
spec:
  url: ssh://[email protected]/example/private-repo.git
  auth:
    type: sshKey
    sshKey:
      sshKeyRef:
        name: git-ssh
        key: identity
      knownHostsRef:
        name: git-known-hosts
        key: known_hosts
  interval: 1m0s
  minSyncInterval: 30s

Verification#

The controller lists the remote refs of the repository (like git ls-remote) with the configured credentials. A Release fetches content only when it needs a ref.

The controller verifies again at each periodic informer resync. It does not use spec.interval.

Auth types#

spec.auth is required. For a public repository, set type: none.

auth.typeImplementedFields
noneYes
basicYesbasic.username (a string) and basic.passwordRef ({name, key} of a Secret)
tokenYestoken.tokenRef. convoy sends the token as the HTTP basic password with the username git.
sshKeyYessshKey.sshKeyRef (a Secret key) and sshKey.knownHostsRef (a ConfigMap key, required). Only plain known_hosts lines work. Hashed lines are rejected. @cert-authority lines are skipped.
githubApp, oidc, cloudIdentityNoReady=False, reason Unsupported.

A problem with the SSH key or the known_hosts data gives reason Unsupported, not VerifyFailed. See Credentials for all kinds.

TLS#

Only tls.insecureSkipVerify works. tls.caPublicCertRef is accepted, but not used.

Fields#

FieldTypeDescription
specGitRepositorySpecGitRepositorySpec defines the desired state of the GitRepository.
spec.auth requiredGitRepositoryAuthSpecAuth is the authentication method used to access the Git repository.
spec.auth.basicBasicAuthSpecBasic is the basic authentication used to access the Git repository.
spec.auth.basic.passwordRef requiredSecretKeySelectorPasswordRef is the name and the key of the Secret containing the password.
spec.auth.basic.username requiredstringUsername is the username used for authentication.
spec.auth.cloudIdentityCloudIdentitySpecCloudIdentity is the cloud identity configuration used to access the Git repository.
spec.auth.cloudIdentity.provider requiredstringProvider is the cloud provider.
  • aws is the cloud provider AWS.
  • azure is the cloud provider Azure.
  • gcp is the cloud provider GCP.
spec.auth.githubAppGithubAppAuthSpecGithubApp is the GitHub App configuration used to access the Git repository.
spec.auth.githubApp.appID requiredintegerAppID is the ID of the GitHub App.
spec.auth.githubApp.installationID requiredintegerInstallationID is the ID of the GitHub App installation.
spec.auth.githubApp.privateKeyRef requiredSecretKeySelectorPrivateKeyRef is the name and the key of the Secret containing the private key.
spec.auth.oidcOIDAuthSpecOIDC is the OIDC configuration used to access the Git repository.
spec.auth.oidc.audiencestringAudience is the OIDC audience.
spec.auth.oidc.clientAuth requiredOIDCClientAuthSpecClientAuth is the OIDC authentication method used for authentication.
spec.auth.oidc.clientAuth.clientSecretOIDCAuthClientSecretSpecClientSecret is the reference to the Secret and the key of the Secret containing the OIDC client secret.
spec.auth.oidc.clientAuth.clientSecret.clientSecretRef requiredSecretKeySelectorClientSecretRef is the name and the key of the Secret containing the OIDC client secret.
spec.auth.oidc.clientAuth.privateKeyJWTOIDCAuthPrivateKeyJWTSpecPrivateKeyJWT is the reference to the Secret and the key of the Secret containing the OIDC private key JWT.
spec.auth.oidc.clientAuth.privateKeyJWT.privateKeyRef requiredSecretKeySelectorPrivateKeyRef is the name and the key of the Secret containing the OIDC private key JWT.
spec.auth.oidc.clientAuth.tlsClientAuthOIDCAuthTLSClientAuthSpecTLSClientAuth is the reference to the Secrets and the keys of the Secret(s) containing the OIDC client certificate and key.
spec.auth.oidc.clientAuth.tlsClientAuth.certRef requiredSecretKeySelectorCertRef is the name and the key of the Secret containing the OIDC client certificate.
spec.auth.oidc.clientAuth.tlsClientAuth.keyRef requiredSecretKeySelectorKeyRef is the name and the key of the Secret containing the OIDC client certificate key.
spec.auth.oidc.clientAuth.type requiredstringType is the OIDC authentication method type used for authentication.
  • clientSecret is the OIDC authentication method using a client secret.
  • privateKeyJWT is the OIDC authentication method using a private key JWT.
  • tlsClientAuth is the OIDC authentication method using TLS client authentication.
spec.auth.oidc.clientID requiredstringClientID is the OIDC client ID.
spec.auth.oidc.issuerURL requiredstringIssuerURL is the URL of the OIDC issuer.
spec.auth.oidc.scopes[]stringlist type: atomicScopes are the OIDC scopes.
spec.auth.oidc.tlsTLSSpecTLS is the issuer TLS configuration.
spec.auth.oidc.tls.caPublicCertRef requiredConfigMapKeySelectorCAPublicCertRef is the name and the key of the ConfigMap containing the CA public certificate. The CA certificate is used to verify the IdP server's certificate.
spec.auth.oidc.tls.insecureSkipVerify requiredbooleanInsecureSkipVerify is a flag to skip the certificate verification.
spec.auth.sshKeySSHKeyAuthSpecSSHKey is the SSH key used to access the Git repository.
spec.auth.sshKey.knownHostsRef requiredConfigMapKeySelectorKnownHostsRef is the name and the key of the ConfigMap containing the known hosts.
spec.auth.sshKey.sshKeyRef requiredSecretKeySelectorSSHKeyRef is the name and the key of the Secret containing the SSH key.
spec.auth.tokenTokenAuthSpecToken is the token used to access the Git repository.
spec.auth.token.tokenRef requiredSecretKeySelectorTokenRef is the name and the key of the Secret containing the token.
spec.auth.type requiredstringType is the authentication method used to access the Git repository.
  • basic is the authentication method using basic authentication.
  • cloudIdentity is the authentication method using a cloud identity.
  • githubApp is the authentication method using a GitHub App.
  • none is the authentication method using no authentication.
  • oidc is the authentication method using OIDC.
  • sshKey is the authentication method using SSH key authentication.
  • token is the authentication method using a token.
spec.ignorePaths accepted, not used[]stringlist type: atomicIgnorePaths is a list of paths to ignore in the Git repository.
spec.includePaths accepted, not used[]stringlist type: atomicIncludePaths is a list of paths to include in the Git repository.
spec.interval required accepted, not usedDurationInterval is the poll interval for ref resolution and content fetching.
spec.minSyncInterval required accepted, not usedDurationMinSyncInterval is the minimum interval between syncs. Used to rate limit syncs.
spec.tlsTLSSpecTLS is the TLS configuration used to verify the Git repository.
spec.tls.caPublicCertRef required accepted, not usedConfigMapKeySelectorCAPublicCertRef is the name and the key of the ConfigMap containing the CA public certificate. The CA certificate is used to verify the IdP server's certificate.
spec.tls.insecureSkipVerify requiredbooleanInsecureSkipVerify is a flag to skip the certificate verification.
spec.url requiredstringURL is the URL of the Git repository.
FieldTypeDescription
statusGitRepositoryStatusGitRepositoryStatus reflects the observed state of the GitRepository.
status.conditions[]Conditionlist type: map, keys: typeConditions is the list of conditions related to the GitRepository.
status.lastSuccessfulProbeAtTimeLastSuccessfulProbeAt is the last time source was successfully probe.
status.observedGenerationintegerObservedGeneration is the last generation that was observed by the controller.
status.releaseCountintegerReleaseCount is the number of Release referencing the GitRepository.
status.webhooks[]WebhookStatuslist type: map, keys: nameWebhooks is the list of statuses of webhooks that are configured for the GitRepository.
status.webhooks[].filteredCountintegerFilteredCount is the number of times the webhook was filtered.
status.webhooks[].lastReceivedTimeLastReceived is the last time the webhook was received.
status.webhooks[].lastRejectionLastRejectionStatusLastRejection is the last time, reason and message the webhook was rejected.
status.webhooks[].lastRejection.messagestringMessage is the message of the webhook rejection.
status.webhooks[].lastRejection.reasonstringReason is the reason the webhook was rejected.
status.webhooks[].lastRejection.rejectedAtTimeRejectedAt is the time the webhook was rejected.
status.webhooks[].lastTriggeredTimeLastTriggered is the last time the webhook was triggered.
status.webhooks[].name requiredstringName is the name of the webhook.
status.webhooks[].receivedCountintegerReceivedCount is the number of times the webhook was received.
status.webhooks[].rejectedCountintegerRejectedCount is the number of times the webhook was rejected.
status.webhooks[].triggersCountintegerTriggersCount is the number of times the webhook was triggered.
status.webhooks[].url requiredstringURL is the URL of the webhook.

The top-level webhook field is for planned push triggers. convoy has no webhook receiver yet.

Conditions#

Ready · written by convoy-controller-manager

ReasonStatusMeaning
VerifiedTrueconvoy listed the remote refs of the repository with the configured credentials.
UnsupportedFalseThe auth type is not implemented, or the SSH key or known_hosts data cannot be used. convoy does not retry with backoff. The periodic resync checks the source again.
VerifyFailedFalseconvoy could not list the remote refs, for example because of the network or the credentials. convoy retries.

In the code

convoy v0.9.0