gitinfo

package
v1.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package gitinfo provides a client to interact with the git information service to retrieve metadata about git repositories.

Index

Constants

View Source
const (
	PrivateKeySecretKey = "privatekey"
	UsernameSecretKey   = "username"
	PasswordSecretKey   = "password"
)

Variables

This section is empty.

Functions

func AuthSecretName

func AuthSecretName(app *apps.Application) string

AuthSecretName returns the name of the secret which contains the git credentials for the given applications git source

func NewAuthSecret

func NewAuthSecret(app *apps.Application) *corev1.Secret

NewAuthSecret returns a new secret for the given application. It can be used as a key for Get/Delete operations or as a base for populating credentials.

func RetryLogFunc

func RetryLogFunc(showErrors bool) func(err error)

RetryLogFunc returns a retry log function depending on the given showErrors parameter. If it is set to true, exact errors are shown when retrying to connect to the git information service. Otherwise they are not shown.

Types

type Auth

type Auth struct {
	Username      *string
	Password      *string
	SSHPrivateKey *string
}

Auth contains the credentials for a git repository.

func (Auth) ApplyToSecret

func (a Auth) ApplyToSecret(secret *corev1.Secret)

ApplyToSecret writes the Auth credentials into the given secret's Data field. Only writes fields which are non-nil.

func (Auth) Enabled

func (a Auth) Enabled() bool

Enabled returns true if any kind of credentials are set in the GitAuth

func (Auth) HasBasicAuth

func (a Auth) HasBasicAuth() bool

func (Auth) HasPrivateKey

func (a Auth) HasPrivateKey() bool

func (*Auth) UpdateFromSecret

func (a *Auth) UpdateFromSecret(secret *corev1.Secret)

UpdateFromSecret updates the Auth object with the data from the given secret.

func (Auth) Valid

func (a Auth) Valid() error

Valid validates the credentials in the GitAuth

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client for the git information service.

func New

func New(address string, token string) (*Client, error)

New returns a client which can be used to retrieve metadata information about a given git repository

func (*Client) RepositoryInformation

func (g *Client) RepositoryInformation(ctx context.Context, git apps.GitTarget, auth Auth) (*apps.GitExploreResponse, error)

RepositoryInformation returns information about a given git repository and optionally checks if a given revision can be found in the repo. It retries on client connection issues.

func (*Client) SetLogRetryFunc

func (g *Client) SetLogRetryFunc(f func(err error))

SetLogRetryFunc allows to set the function which logs retries when doing requests to the git information service

func (*Client) SetRetryBackoffs

func (g *Client) SetRetryBackoffs(backoff wait.Backoff)

SetRetryBackoffs sets the backoff properties for retries

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL