models

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationAppOrgNameForArgoCDApplication    = "dreamkast.cloudnativedays.jp/app-organization"
	AnnotationAppRepoNameForArgoCDApplication   = "dreamkast.cloudnativedays.jp/app-repository"
	AnnotationAppCommitHashForArgoCDApplication = "dreamkast.cloudnativedays.jp/app-commit-hash"
)
View Source
const (
	LabelReviewAppNameForJob = "dreamkast.cloudnativedays.jp/parent-reviewapp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppOrInfraRepoTarget

type AppOrInfraRepoTarget interface {
	GitSecretSelector() (*corev1.SecretKeySelector, error)
}

type AppRepoTarget

func (AppRepoTarget) GitSecretSelector

func (m AppRepoTarget) GitSecretSelector() (*corev1.SecretKeySelector, error)

type Application

type Application string

func (Application) Annotation

func (m Application) Annotation(annotationKey string) (string, error)

func (Application) NamespacedName

func (m Application) NamespacedName() (types.NamespacedName, error)

func (Application) SetSomeAnnotations

func (m Application) SetSomeAnnotations(ra ReviewApp) (Application, error)

type ApplicationTemplate

type ApplicationTemplate dreamkastv1alpha1.ApplicationTemplate

func (ApplicationTemplate) CandidateStr

func (m ApplicationTemplate) CandidateStr() string

func (ApplicationTemplate) GenerateApplication

func (m ApplicationTemplate) GenerateApplication(pr PullRequest, v Templator) (Application, error)

func (ApplicationTemplate) StableStr

func (m ApplicationTemplate) StableStr() string

type File

type File struct {
	BaseDir  string
	Filepath string
	Content  []byte
}

func NewFileFromApplication

func NewFileFromApplication(ra ReviewApp, application Application, pr PullRequest, l InfraRepoLocalDir) File

func NewFileFromName

func NewFileFromName(l InfraRepoLocalDir, filename string) File

func NewFilesFromManifests

func NewFilesFromManifests(ra ReviewApp, manifests Manifests, pr PullRequest, l InfraRepoLocalDir) []File

type GitCredential

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

func NewGitCredential

func NewGitCredential(username, token string) GitCredential

func (GitCredential) Token

func (m GitCredential) Token() string

func (GitCredential) Username

func (m GitCredential) Username() string

type InfraRepoLocalDir

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

func NewInfraRepoLocal

func NewInfraRepoLocal(baseDir string) InfraRepoLocalDir

func (InfraRepoLocalDir) BaseDir

func (m InfraRepoLocalDir) BaseDir() string

func (InfraRepoLocalDir) CommitMsgDeletion

func (m InfraRepoLocalDir) CommitMsgDeletion(ra ReviewApp) string

func (InfraRepoLocalDir) CommitMsgUpdate

func (m InfraRepoLocalDir) CommitMsgUpdate(ra ReviewApp) string

func (InfraRepoLocalDir) LatestCommitHash

func (m InfraRepoLocalDir) LatestCommitHash() string

func (InfraRepoLocalDir) SetLatestCommitHash

func (m InfraRepoLocalDir) SetLatestCommitHash(latestCommitHash string) InfraRepoLocalDir

type InfraRepoTarget

func (InfraRepoTarget) GitSecretSelector

func (m InfraRepoTarget) GitSecretSelector() (*corev1.SecretKeySelector, error)

type JobTemplate

type JobTemplate dreamkastv1alpha1.JobTemplate

func (JobTemplate) GenerateJob

func (m JobTemplate) GenerateJob(ra ReviewApp, pr PullRequest, v Templator) (*batchv1.Job, error)

type Manifests

type Manifests map[string]string

type ManifestsTemplate

type ManifestsTemplate dreamkastv1alpha1.ManifestsTemplate

func (ManifestsTemplate) AppendOrUpdate

func (ManifestsTemplate) CandidateMap

func (m ManifestsTemplate) CandidateMap() map[string]string

func (ManifestsTemplate) GenerateManifests

func (m ManifestsTemplate) GenerateManifests(pr PullRequest, v Templator) (Manifests, error)

func (ManifestsTemplate) StableMap

func (m ManifestsTemplate) StableMap() map[string]string

type PullRequest

type PullRequest struct {
	Organization     string
	Repository       string
	Branch           string
	Number           int
	LatestCommitHash string
	Title            string
	Labels           []string
}

func NewPullRequest

func NewPullRequest(organization, repository, branch string, number int, headCommitHash string, title string, labels []string) PullRequest

func (PullRequest) IsCandidate

func (m PullRequest) IsCandidate() bool

type PullRequests

type PullRequests []PullRequest

func (PullRequests) ExcludeSpecificPR

func (m PullRequests) ExcludeSpecificPR(ra ReviewAppOrReviewAppManager) PullRequests

type ReviewApp

type ReviewApp dreamkastv1alpha1.ReviewApp

func NewReviewApp

func NewReviewApp(ra *dreamkastv1alpha1.ReviewApp) ReviewApp

func (ReviewApp) AppRepoConfig

func (ReviewApp) AppRepoTarget

func (m ReviewApp) AppRepoTarget() AppRepoTarget

func (ReviewApp) AtFilepath

func (m ReviewApp) AtFilepath() string

func (ReviewApp) GetStatus

func (m ReviewApp) GetStatus() ReviewAppStatus

func (ReviewApp) HasMessageAlreadyBeenSent

func (m ReviewApp) HasMessageAlreadyBeenSent() bool

func (ReviewApp) HavingPreStopJob

func (m ReviewApp) HavingPreStopJob() bool

func (ReviewApp) InfraRepoConfig

func (ReviewApp) InfraRepoTarget

func (m ReviewApp) InfraRepoTarget() InfraRepoTarget

func (ReviewApp) MtDirpath

func (m ReviewApp) MtDirpath() string

func (ReviewApp) NamespaceName

func (m ReviewApp) NamespaceName() types.NamespacedName

func (ReviewApp) PrNum

func (m ReviewApp) PrNum() int

func (ReviewApp) ToReviewAppCR

func (m ReviewApp) ToReviewAppCR() *dreamkastv1alpha1.ReviewApp

func (ReviewApp) Variables

func (m ReviewApp) Variables() []string

type ReviewAppManager

type ReviewAppManager dreamkastv1alpha1.ReviewAppManager

func (ReviewAppManager) AppRepoConfig

func (ReviewAppManager) AppRepoTarget

func (m ReviewAppManager) AppRepoTarget() AppRepoTarget

func (ReviewAppManager) GenerateReviewApp

func (m ReviewAppManager) GenerateReviewApp(pr PullRequest, v Templator, f *utils.DatetimeFactory) (ReviewApp, error)

func (ReviewAppManager) InfraRepoConfig

func (ReviewAppManager) InfraRepoTarget

func (m ReviewAppManager) InfraRepoTarget() InfraRepoTarget

func (ReviewAppManager) IsPullRequestAlreadySynced

func (m ReviewAppManager) IsPullRequestAlreadySynced(pr PullRequest) bool

func (ReviewAppManager) ListOutOfSyncReviewAppName

func (m ReviewAppManager) ListOutOfSyncReviewAppName(prs []PullRequest) []string

func (ReviewAppManager) NamespaceName

func (m ReviewAppManager) NamespaceName() types.NamespacedName

func (ReviewAppManager) ReviewAppName

func (m ReviewAppManager) ReviewAppName(pr PullRequest) string

func (ReviewAppManager) ToReviewAppCR

func (ReviewAppManager) Variables

func (m ReviewAppManager) Variables() []string

type ReviewAppOrReviewAppManager

type ReviewAppOrReviewAppManager interface {
	NamespaceName() types.NamespacedName
	AppRepoTarget() AppRepoTarget
	AppRepoConfig() dreamkastv1alpha1.ReviewAppManagerSpecAppConfig
	InfraRepoTarget() InfraRepoTarget
	InfraRepoConfig() dreamkastv1alpha1.ReviewAppManagerSpecInfraConfig
	Variables() []string
}

type ReviewAppStatus

type ReviewAppStatus dreamkastv1alpha1.ReviewAppStatus

func (ReviewAppStatus) HasApplicationBeenUpdated

func (m ReviewAppStatus) HasApplicationBeenUpdated(hash string) bool

func (ReviewAppStatus) UpdateStatusOfAppRepo

func (m ReviewAppStatus) UpdateStatusOfAppRepo(pr PullRequest) (ReviewAppStatus, bool)

func (ReviewAppStatus) UpdateStatusOfApplication

func (m ReviewAppStatus) UpdateStatusOfApplication(application Application) (ReviewAppStatus, bool, error)

func (ReviewAppStatus) WasManifestsUpdated

func (m ReviewAppStatus) WasManifestsUpdated(manifests Manifests) bool

type Templator

type Templator struct {
	AppRepo   templateValueAppRepoInfo
	InfraRepo templateValueInfraRepoInfo
	Variables map[string]string
}

func (Templator) Templating

func (v Templator) Templating(text string) (string, error)

func (Templator) WithAppRepoLatestCommitHash

func (v Templator) WithAppRepoLatestCommitHash(sha string) *Templator

Jump to

Keyboard shortcuts

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