gitrepo

package
v0.0.0-...-d125d34 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitOpsBranch        = "gitops"
	PipelineValueParent = "pipeline"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseParams

type BaseParams struct {
	ClusterID           uint
	Cluster             string
	PipelineJSONBlob    map[string]interface{}
	ApplicationJSONBlob map[string]interface{}
	TemplateRelease     *trmodels.TemplateRelease
	Application         *models.Application
	Environment         string
	RegionEntity        *regionmodels.RegionEntity
	Namespace           string

	Version string
}

type BaseValue

type BaseValue struct {
	Application string             `yaml:"application"`
	ClusterID   uint               `yaml:"clusterID"`
	Cluster     string             `yaml:"cluster"`
	Template    *BaseValueTemplate `yaml:"template"`
	Priority    string             `yaml:"priority"`
}

type BaseValueTemplate

type BaseValueTemplate struct {
	Name    string `yaml:"name"`
	Release string `yaml:"release"`
}

type Chart

type Chart struct {
	APIVersion   string       `yaml:"apiVersion"`
	Name         string       `yaml:"name"`
	Version      string       `yaml:"version"`
	Dependencies []Dependency `yaml:"dependencies"`
}

type ClusterCommit

type ClusterCommit struct {
	Master string
	Gitops string
}

type ClusterFiles

type ClusterFiles struct {
	PipelineJSONBlob    map[string]interface{}
	ApplicationJSONBlob map[string]interface{}
	Manifest            map[string]interface{}
}

type ClusterGitRepo

type ClusterGitRepo interface {
	GetCluster(ctx context.Context, application, cluster, templateName string) (*ClusterFiles, error)
	GetClusterValueFiles(ctx context.Context,
		application, cluster string) ([]ClusterValueFile, error)
	// GetClusterTemplate parses cluster's template name and release from GitopsFileChart
	GetClusterTemplate(ctx context.Context, application, cluster string) (*ClusterTemplate, error)
	CreateCluster(ctx context.Context, params *CreateClusterParams) error
	UpdateCluster(ctx context.Context, params *UpdateClusterParams) error
	DeleteCluster(ctx context.Context, application, cluster string, clusterID uint) error
	HardDeleteCluster(ctx context.Context, application, cluster string) error
	// CompareConfig compare config of `from` commit with `to` commit.
	// if `from` or `to` is nil, compare the master branch with gitops branch
	CompareConfig(ctx context.Context, application, cluster string, from, to *string) (string, error)
	// MergeBranch merge branch and return target branch's newest commit
	MergeBranch(ctx context.Context, application, cluster, sourceBranch,
		targetBranch string, pipelineRunID *uint) (_ string, err error)
	GetPipelineOutput(ctx context.Context, application, cluster string, template string) (interface{}, error)
	UpdatePipelineOutput(ctx context.Context, application, cluster, template string,
		pipelineOutput interface{}) (string, error)
	// UpdateRestartTime update restartTime in git repo for restart
	// TODO(gjq): some template cannot restart, for example serverless, how to do it ?
	GetRestartTime(ctx context.Context, application, cluster string,
		template string) (string, error)
	UpdateRestartTime(ctx context.Context, application, cluster, template string) (string, error)
	GetConfigCommit(ctx context.Context, application, cluster string) (*ClusterCommit, error)
	GetRepoInfo(ctx context.Context, application, cluster string) *RepoInfo
	GetEnvValue(ctx context.Context, application, cluster, templateName string) (*EnvValue, error)
	// Rollback rolls gitOps branch back to a specific commit if there are diffs
	Rollback(ctx context.Context, application, cluster, commit string) (string, error)
	UpdateTags(ctx context.Context, application, cluster, templateName string,
		tags []*tagmodels.Tag) error
	DefaultBranch() string
	// Deprecated: for internal usage, v1 to v2
	UpgradeCluster(ctx context.Context, param *UpgradeValuesParam) (string, error)
	// GetManifest returns manifest with specific revision, defaults to gitops branch
	GetManifest(ctx context.Context, application,
		cluster string, commit *string) (*pkgcommon.Manifest, error)
	// CheckAndSyncGitOpsBranch checks and sync if gitops branch is not up-to-date with master branch
	// for internal usage
	CheckAndSyncGitOpsBranch(ctx context.Context, application, cluster, commit string) error
	// SyncGitOpsBranch syncs gitops branch to up-to-date with master branch
	SyncGitOpsBranch(ctx context.Context, application, cluster string) error
}

nolint

func NewClusterGitlabRepo

func NewClusterGitlabRepo(ctx context.Context, rootGroup *gitlab.Group,
	templateRepo templaterepo.TemplateRepo,
	gitlabLib gitlablib.Interface, defaultBranch string, defaultVisibility string) (ClusterGitRepo, error)

type ClusterTemplate

type ClusterTemplate struct {
	Name    string
	Release string
}

type ClusterValueFile

type ClusterValueFile struct {
	FileName string
	Content  map[interface{}]interface{}
}

type CreateClusterParams

type CreateClusterParams struct {
	*BaseParams
	Tags  []*tagmodels.Tag
	Image string
}

type Dependency

type Dependency struct {
	Name       string `yaml:"name"`
	Version    string `yaml:"version"`
	Repository string `yaml:"repository"`
}

type EnvValue

type EnvValue struct {
	Environment   string `yaml:"environment"`
	Region        string `yaml:"region"`
	Namespace     string `yaml:"namespace"`
	BaseRegistry  string `yaml:"baseRegistry"`
	IngressDomain string `yaml:"ingressDomain"`
}

type Git

type Git struct {
	URL      *string `yaml:"url,omitempty" json:"url,omitempty"`
	CommitID *string `yaml:"commitID,omitempty" json:"commitID,omitempty"`
	Branch   *string `yaml:"branch,omitempty" json:"branch,omitempty"`
	Tag      *string `yaml:"tag,omitempty" json:"tag,omitempty"`
}

type PipelineOutput

type PipelineOutput struct {
	Image *string `yaml:"image,omitempty" json:"image,omitempty"`
	Git   *Git    `yaml:"git,omitempty" json:"git,omitempty"`
}

type ReadFileParam

type ReadFileParam struct {
	Bytes    []byte
	Err      error
	FileName string
}

type RepoInfo

type RepoInfo struct {
	GitRepoURL string
	ValueFiles []string
}

type UpdateClusterParams

type UpdateClusterParams struct {
	*BaseParams
}

type UpgradeValuesParam deprecated

type UpgradeValuesParam struct {
	Application   string
	Cluster       string
	Template      *ClusterTemplate
	TargetRelease *trmodels.TemplateRelease
	BuildConfig   *template.BuildConfig
}

Deprecated: for internal usage

Jump to

Keyboard shortcuts

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