common

package
v0.0.0-...-318a3d5 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const StageDirectoryName = ".keptn-stages"

Variables

This section is empty.

Functions

func GetConfigDir

func GetConfigDir() string

func GetKeptnNamespace

func GetKeptnNamespace() string

func GetProjectConfigPath

func GetProjectConfigPath(project string) string

func GetProjectMetadataFilePath

func GetProjectMetadataFilePath(project string) string

func GetServiceConfigPath

func GetServiceConfigPath(project, service string) string

func GetTemporaryUpstreamCredentialsSecretName

func GetTemporaryUpstreamCredentialsSecretName(projectName string) string

func GetTmpProjectConfigPath

func GetTmpProjectConfigPath(project string) string

func GetUpstreamCredentialsSecretName

func GetUpstreamCredentialsSecretName(projectName string) string

func IsEmpty

func IsEmpty(name string) (bool, error)

func IsHelmChartPath

func IsHelmChartPath(resourcePath string) bool

func Lock

func Lock()

Lock locks the mutex

func LockProject

func LockProject(project string)

LockProject locks the given project

func Unlock

func Unlock()

Unlock unlocks the mutex

func UnlockProject

func UnlockProject(project string)

Types

type CredentialReader

type CredentialReader interface {
	GetCredentials(project string) (*common_models.GitCredentials, error)
}

type FileSystem

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

func NewFileSystem

func NewFileSystem(tmpDirLocation string) *FileSystem

func (FileSystem) DeleteFile

func (FileSystem) DeleteFile(path string) error

func (FileSystem) FileExists

func (FileSystem) FileExists(path string) bool

func (FileSystem) MakeDir

func (fw FileSystem) MakeDir(path string) error

func (FileSystem) ReadFile

func (fw FileSystem) ReadFile(filename string) ([]byte, error)

func (FileSystem) WalkPath

func (fw FileSystem) WalkPath(path string, walkFunc filepath.WalkFunc) error

func (FileSystem) WriteBase64EncodedFile

func (fw FileSystem) WriteBase64EncodedFile(path string, content string) error

func (FileSystem) WriteFile

func (fw FileSystem) WriteFile(path string, content []byte) error

func (FileSystem) WriteHelmChart

func (fw FileSystem) WriteHelmChart(path string) error

type Git

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

func NewGit

func NewGit(git Gogit) *Git

func (*Git) CheckUpstreamConnection

func (g *Git) CheckUpstreamConnection(gitContext common_models.GitContext) error

func (*Git) CheckoutBranch

func (g *Git) CheckoutBranch(gitContext common_models.GitContext, branch string) error

func (Git) CloneRepo

func (g Git) CloneRepo(gitContext common_models.GitContext) (bool, error)

func (*Git) CreateBranch

func (g *Git) CreateBranch(gitContext common_models.GitContext, branch string, sourceBranch string) error

func (*Git) GetCurrentRevision

func (g *Git) GetCurrentRevision(gitContext common_models.GitContext) (string, error)

func (*Git) GetDefaultBranch

func (g *Git) GetDefaultBranch(gitContext common_models.GitContext) (string, error)

func (*Git) GetFileRevision

func (g *Git) GetFileRevision(gitContext common_models.GitContext, revision string, file string) ([]byte, error)

func (*Git) MigrateProject

func (g *Git) MigrateProject(gitContext common_models.GitContext, newMetadataContent []byte) error

func (*Git) MoveToNewUpstream

func (g *Git) MoveToNewUpstream(currentContext common_models.GitContext, newContext common_models.GitContext) error

func (*Git) ProjectExists

func (g *Git) ProjectExists(gitContext common_models.GitContext) bool

func (*Git) ProjectRepoExists

func (g *Git) ProjectRepoExists(project string) bool

func (*Git) Pull

func (g *Git) Pull(gitContext common_models.GitContext) error

func (Git) Push

func (g Git) Push(gitContext common_models.GitContext) error

func (Git) ResetHard

func (g Git) ResetHard(gitContext common_models.GitContext, rev string) error

func (Git) StageAndCommitAll

func (g Git) StageAndCommitAll(gitContext common_models.GitContext, message string) (string, error)

type Git2Go

type Git2Go struct{}

func (Git2Go) PlainClone

func (g Git2Go) PlainClone(gitContext common_models.GitContext, path string, isBare bool, o *git.CloneOptions) (*git.Repository, error)

type Gogit

type Gogit interface {
	PlainOpen(path string) (*git.Repository, error)
	PlainClone(gitContext common_models.GitContext, path string, isBare bool, o *git.CloneOptions) (*git.Repository, error)
	PlainInit(path string, isBare bool) (*git.Repository, error)
}

type GogitReal

type GogitReal struct{}

func (GogitReal) PlainClone

func (t GogitReal) PlainClone(gitContext common_models.GitContext, path string, isBare bool, o *git.CloneOptions) (*git.Repository, error)

func (GogitReal) PlainInit

func (t GogitReal) PlainInit(path string, isBare bool) (*git.Repository, error)

func (GogitReal) PlainOpen

func (t GogitReal) PlainOpen(path string) (*git.Repository, error)

type IFileSystem

type IFileSystem interface {
	WriteBase64EncodedFile(path string, content string) error
	WriteHelmChart(path string) error
	WriteFile(path string, content []byte) error
	ReadFile(filename string) ([]byte, error)
	DeleteFile(path string) error
	FileExists(path string) bool
	MakeDir(path string) error
	WalkPath(path string, walkFunc filepath.WalkFunc) error
}

IFileSystem is an interface for writing files

type IGit

type IGit interface {
	ProjectExists(gitContext common_models.GitContext) bool
	ProjectRepoExists(projectName string) bool
	CloneRepo(gitContext common_models.GitContext) (bool, error)
	StageAndCommitAll(gitContext common_models.GitContext, message string) (string, error)
	Push(gitContext common_models.GitContext) error
	Pull(gitContext common_models.GitContext) error
	CreateBranch(gitContext common_models.GitContext, branch string, sourceBranch string) error
	CheckoutBranch(gitContext common_models.GitContext, branch string) error
	GetFileRevision(gitContext common_models.GitContext, revision string, file string) ([]byte, error)
	GetCurrentRevision(gitContext common_models.GitContext) (string, error)
	GetDefaultBranch(gitContext common_models.GitContext) (string, error)
	MigrateProject(gitContext common_models.GitContext, newMetadatacontent []byte) error
	ResetHard(gitContext common_models.GitContext, revision string) error
	MoveToNewUpstream(currentContext common_models.GitContext, newContext common_models.GitContext) error
	CheckUpstreamConnection(gitContext common_models.GitContext) error
}

IGit provides functions to interact with the git repository of a project

type K8sCredentialReader

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

func NewK8sCredentialReader

func NewK8sCredentialReader(k8sClient kubernetes.Interface) *K8sCredentialReader

func (K8sCredentialReader) GetCredentials

func (kr K8sCredentialReader) GetCredentials(secretName string) (*common_models.GitCredentials, error)

type ProjectMetadata

type ProjectMetadata struct {
	ProjectName               string `yaml:"projectName"`
	CreationTimestamp         string `yaml:"creationTimestamp"`
	IsUsingDirectoryStructure bool   `yaml:"isUsingDirectoryStructure"`
}

type RollbackFunc

type RollbackFunc func() error

type ServiceMetadata

type ServiceMetadata struct {
	ServiceName       string
	CreationTimestamp string
}

type StageMetadata

type StageMetadata struct {
	StageName         string
	CreationTimestamp string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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