Documentation ¶
Index ¶
- Constants
- Variables
- func CreateOrUpdateSshPrivateKeyOnDisk(gitProviderId int, sshPrivateKeyContent string) error
- func CreateTlsPathFilesWithData(gitProviderId int, content string, fileName string) (string, error)
- func DeleteAFileIfExists(path string) error
- func GetBranchReference(branch string) (string, string)
- func GetCheckoutPath(url string, cloneLocation string) string
- func GetOrCreateSshPrivateKeyOnDisk(gitProviderId int, sshPrivateKeyContent string) (privateKeyPath string, err error)
- func GetProjectName(url string) string
- func GetUserNamePassword(gitProvider *sql.GitProvider) (userName, password string, err error)
- func IsRepoShallowCloned(checkoutPath string) bool
- func RunWithTimeout[T any](ctx context.Context, f func() ([]*T, error)) ([]*T, error)
- type Author
- type CiPipelineMaterialBean
- type Commit
- type CommitCliIterator
- type CommitGoGitIterator
- type CommitIterator
- type CommitMetadataRequest
- type Committer
- type CronLoggerImpl
- type FetchScmChangesRequest
- type FileStat
- type FileStats
- type FileStatsResult
- type GitChanges
- type GitCliManagerImpl
- func (impl *GitCliManagerImpl) GetCommitForHash(gitCtx GitContext, checkoutPath, commitHash string) (GitCommit, error)
- func (impl *GitCliManagerImpl) GetCommitIterator(gitCtx GitContext, repository *GitRepository, iteratorRequest IteratorRequest) (CommitIterator, error)
- func (impl *GitCliManagerImpl) GetCommitStats(gitCtx GitContext, commit GitCommit, checkoutPath string) (FileStats, error)
- func (impl *GitCliManagerImpl) GetCommits(gitCtx GitContext, branchRef string, branch string, rootDir string, ...) ([]GitCommit, error)
- func (impl *GitCliManagerImpl) GetCommitsForTag(gitCtx GitContext, checkoutPath, tag string) (GitCommit, error)
- func (impl *GitCliManagerImpl) GitCreateRemote(gitCtx GitContext, rootDir string, url string) error
- func (impl *GitCliManagerImpl) GitInit(gitCtx GitContext, rootDir string) error
- func (impl *GitCliManagerImpl) GitShow(gitCtx GitContext, rootDir string, hash string) (GitCommit, error)
- func (impl *GitCliManagerImpl) Init(gitCtx GitContext, rootDir string, remoteUrl string, isBare bool) error
- func (impl *GitCliManagerImpl) OpenRepoPlain(checkoutPath string) (*GitRepository, error)
- type GitCommit
- type GitCommitBase
- func (gitCommit *GitCommitBase) FixInvalidUTF8Message()
- func (gitCommit *GitCommitBase) GetCommit() *GitCommitBase
- func (gitCommit *GitCommitBase) IsMessageValidUTF8() bool
- func (gitCommit *GitCommitBase) SetFileStats(stats *FileStats)
- func (gitCommit *GitCommitBase) TruncateMessageIfExceedsMaxLength()
- type GitCommitCli
- type GitCommitFormat
- type GitCommitGoGit
- type GitContext
- func (gitCtx GitContext) WithCloningMode(CloningMode string) GitContext
- func (gitCtx GitContext) WithCredentials(Username string, Password string) GitContext
- func (gitCtx GitContext) WithTLSData(caData string, tlsKey string, tlsCertificate string, ...) GitContext
- func (gitCtx GitContext) WithTimeout(timeoutSeconds int) (GitContext, context.CancelFunc)
- type GitManager
- type GitManagerBase
- type GitManagerBaseImpl
- func (impl *GitManagerBaseImpl) Checkout(gitCtx GitContext, rootDir, branch string) (response, errMsg string, err error)
- func (impl *GitManagerBaseImpl) ConfigureSshCommand(gitCtx GitContext, rootDir string, sshPrivateKeyPath string) (response, errMsg string, err error)
- func (impl *GitManagerBaseImpl) ExecuteCustomCommand(gitContext GitContext, name string, arg ...string) (response, errMsg string, err error)
- func (impl *GitManagerBaseImpl) Fetch(gitCtx GitContext, rootDir string) (response, errMsg string, err error)
- func (impl *GitManagerBaseImpl) FetchDiffStatBetweenCommitsNameOnly(gitCtx GitContext, oldHash string, newHash string, rootDir string) (FileStats, error)
- func (impl *GitManagerBaseImpl) FetchDiffStatBetweenCommitsWithNumstat(gitCtx GitContext, oldHash string, newHash string, rootDir string) (FileStats, error)
- func (impl *GitManagerBaseImpl) LogMergeBase(gitCtx GitContext, rootDir, from string, to string) ([]*Commit, error)
- func (impl *GitManagerBaseImpl) PathMatcher(fileStats *FileStats, gitMaterial *sql.GitMaterial) bool
- type GitManagerImpl
- type GitPerson
- type GitRepository
- type GitWatcher
- type GitWatcherImpl
- func (impl GitWatcherImpl) FetchAndUpdateMaterial(gitCtx GitContext, material *sql.GitMaterial, location string) (bool, *GitRepository, error)
- func (impl GitWatcherImpl) NotifyForMaterialUpdate(materials []*CiPipelineMaterialBean, gitMaterial *sql.GitMaterial) error
- func (impl GitWatcherImpl) PollAndUpdateGitMaterial(material *sql.GitMaterial) (*sql.GitMaterial, error)
- func (impl *GitWatcherImpl) RunOnWorker(materials []*sql.GitMaterial)
- func (impl GitWatcherImpl) StopCron()
- func (impl GitWatcherImpl) SubscribeWebhookEvent() error
- func (impl GitWatcherImpl) Watch()
- type GoGitSDKManagerImpl
- func (impl *GoGitSDKManagerImpl) GetCommitForHash(gitCtx GitContext, checkoutPath, commitHash string) (GitCommit, error)
- func (impl *GoGitSDKManagerImpl) GetCommitIterator(gitCtx GitContext, repository *GitRepository, iteratorRequest IteratorRequest) (CommitIterator, error)
- func (impl *GoGitSDKManagerImpl) GetCommitStats(gitCtx GitContext, commit GitCommit, checkoutPath string) (FileStats, error)
- func (impl *GoGitSDKManagerImpl) GetCommitsForTag(gitCtx GitContext, checkoutPath, tag string) (GitCommit, error)
- func (impl *GoGitSDKManagerImpl) Init(gitCtx GitContext, rootDir string, remoteUrl string, isBare bool) error
- func (impl *GoGitSDKManagerImpl) OpenRepoPlain(checkoutPath string) (*GitRepository, error)
- type Hash
- type HeadRequest
- type IteratorRequest
- type MaterialChangeResp
- type PollConfig
- type RefreshGitMaterialRequest
- type RefreshGitMaterialResponse
- type RepositoryManager
- type RepositoryManagerAnalytics
- type RepositoryManagerAnalyticsImpl
- type RepositoryManagerImpl
- func (impl *RepositoryManagerImpl) Add(gitCtx GitContext, gitProviderId int, location, url string, ...) error
- func (impl *RepositoryManagerImpl) ChangesSinceByRepository(gitCtx GitContext, repository *GitRepository, branch string, from string, ...) ([]*GitCommitBase, error)
- func (impl *RepositoryManagerImpl) Clean(dir string) error
- func (impl *RepositoryManagerImpl) CleanupAndInitRepo(gitCtx GitContext, location string, url string) error
- func (impl *RepositoryManagerImpl) CreateSshFileIfNotExistsAndConfigureSshCommand(gitCtx GitContext, location string, gitProviderId int, ...) (string, error)
- func (impl *RepositoryManagerImpl) Fetch(gitCtx GitContext, url string, location string) (updated bool, repo *GitRepository, err error)
- func (impl *RepositoryManagerImpl) FetchRepo(gitCtx GitContext, location string) error
- func (impl *RepositoryManagerImpl) GetCheckoutLocation(gitCtx GitContext, material *sql.GitMaterial, url, checkoutPath string) string
- func (impl *RepositoryManagerImpl) GetCheckoutLocationFromGitUrl(material *sql.GitMaterial, cloningMode string) (location string, httpMatched bool, shMatched bool, err error)
- func (impl *RepositoryManagerImpl) GetCommitForTag(gitCtx GitContext, checkoutPath, tag string) (*GitCommitBase, error)
- func (impl *RepositoryManagerImpl) GetCommitMetadata(gitCtx GitContext, checkoutPath, commitHash string) (*GitCommitBase, error)
- func (impl *RepositoryManagerImpl) InitRepoAndGetSshPrivateKeyPath(gitCtx GitContext, gitProviderId int, location, url string, ...) (string, error)
- func (impl *RepositoryManagerImpl) IsSpaceAvailableOnDisk() bool
- func (impl *RepositoryManagerImpl) TrimLastGitCommit(gitCommits []*GitCommitBase, count int) []*GitCommitBase
- type Tag
- type Tree
- type WebhookAndCiData
- type WebhookData
- type WebhookDataRequest
- type WebhookEvent
- type WebhookEventBeanConverter
- type WebhookEventBeanConverterImpl
- type WebhookEventConfig
- type WebhookEventConfigRequest
- type WebhookEventParser
- type WebhookEventParserImpl
- type WebhookEventResponse
- type WebhookEventSelectors
- type WebhookEventService
- type WebhookEventServiceImpl
- func (impl WebhookEventServiceImpl) BuildNotifyCiObject(ciPipelineMaterial *sql.CiPipelineMaterial, ...) *CiPipelineMaterialBean
- func (impl WebhookEventServiceImpl) GetAllGitHostWebhookEventByGitHostId(gitHostId int, gitHostName string) ([]*sql.GitHostWebhookEvent, error)
- func (impl WebhookEventServiceImpl) GetAllGitHostWebhookEventByGitHostName(gitHostName string) ([]*sql.GitHostWebhookEvent, error)
- func (impl WebhookEventServiceImpl) GetRegexGroupData(regex string, val string) map[string]string
- func (impl WebhookEventServiceImpl) GetWebhookParsedEventDataByEventIdAndUniqueId(eventId int, uniqueId string) (*sql.WebhookEventParsedData, error)
- func (impl WebhookEventServiceImpl) HandleMaterialWebhookMappingFilterResultIntoDb(filterResults []*sql.CiPipelineMaterialWebhookDataMappingFilterResult, ...) error
- func (impl WebhookEventServiceImpl) HandleMaterialWebhookMappingIntoDb(ciPipelineMaterialId int, webhookParsedDataId int, conditionMatched bool, ...) error
- func (impl WebhookEventServiceImpl) MatchCiTriggerConditionAndNotify(event *sql.GitHostWebhookEvent, ...) error
- func (impl WebhookEventServiceImpl) MatchFilter(event *sql.GitHostWebhookEvent, fullDataMap map[string]string, ...) ([]*sql.CiPipelineMaterialWebhookDataMappingFilterResult, bool, error)
- func (impl WebhookEventServiceImpl) NotifyForAutoCi(material *CiPipelineMaterialBean) error
- func (impl WebhookEventServiceImpl) SaveWebhookParsedEventData(webhookEventParsedData *sql.WebhookEventParsedData) error
- func (impl WebhookEventServiceImpl) UpdateWebhookParsedEventData(webhookEventParsedData *sql.WebhookEventParsedData) error
- type WebhookHandler
- type WebhookHandlerImpl
- type WebhookPayloadDataPayloadsResponse
- type WebhookPayloadDataRequest
- type WebhookPayloadDataResponse
- type WebhookPayloadFilterDataRequest
- type WebhookPayloadFilterDataResponse
- type WebhookPayloadFilterDataSelectorResponse
- type WebhookSourceTypeValue
Constants ¶
View Source
const ( GIT_ASK_PASS = "/git-ask-pass.sh" AUTHENTICATION_FAILED_ERROR = "Authentication failed" LOCK_REF_MESSAGE = "cannot lock ref" )
View Source
const ( GIT_BASE_DIR = "/git-base/" SSH_PRIVATE_KEY_DIR = GIT_BASE_DIR + "ssh-keys/" TLS_FILES_DIR = GIT_BASE_DIR + "tls-files/" SSH_PRIVATE_KEY_FILE_NAME = "ssh_pvt_key" TLS_KEY_FILE_NAME = "tls_key.key" TLS_CERT_FILE_NAME = "tls_cert.pem" CA_CERT_FILE_NAME = "ca_cert.pem" CLONE_TIMEOUT_SEC = 600 FETCH_TIMEOUT_SEC = 30 GITHUB_PROVIDER = "github.com" GITLAB_PROVIDER = "gitlab.com" CloningModeShallow = "SHALLOW" CloningModeFull = "FULL" NO_COMMIT_GIT_ERROR_MESSAGE = "unknown revision or path not in the working tree." NO_COMMIT_CUSTOM_ERROR_MESSAGE = "No Commit Found" )
View Source
const ( WEBHOOK_SELECTOR_UNIQUE_ID_NAME string = "unique id" WEBHOOK_SELECTOR_REPOSITORY_URL_NAME string = "repository url" WEBHOOK_SELECTOR_REPOSITORY_SSH_URL_NAME string = "repository ssh url" WEBHOOK_SELECTOR_TITLE_NAME string = "title" WEBHOOK_SELECTOR_GIT_URL_NAME string = "git url" WEBHOOK_SELECTOR_AUTHOR_NAME string = "author" WEBHOOK_SELECTOR_DATE_NAME string = "date" WEBHOOK_SELECTOR_TARGET_CHECKOUT_NAME string = "target checkout" WEBHOOK_SELECTOR_SOURCE_CHECKOUT_NAME string = "source checkout" WEBHOOK_SELECTOR_TARGET_BRANCH_NAME_NAME string = "target branch name" WEBHOOK_SELECTOR_SOURCE_BRANCH_NAME_NAME string = "source branch name" )
View Source
const PANIC = "panic"
Variables ¶
View Source
var GITFORMAT = "--pretty=format:{" +
_dl_ + "commit" + _dl_ + ":" + _dl_ + "%H" + _dl_ + "," +
_dl_ + "parent" + _dl_ + ":" + _dl_ + "%P" + _dl_ + "," +
_dl_ + "refs" + _dl_ + ":" + _dl_ + "%D" + _dl_ + "," +
_dl_ + "subject" + _dl_ + ":" + _dl_ + "%<(1024,trunc)%s" + _dl_ + "," +
_dl_ + "body" + _dl_ + ":" + _dl_ + "%<(1024,trunc)%b" + _dl_ + "," +
_dl_ + "author" + _dl_ +
":{" +
_dl_ + "name" + _dl_ + ":" + _dl_ + "%aN" + _dl_ + "," +
_dl_ + "email" + _dl_ + ":" + _dl_ + "%aE" + _dl_ + "," +
_dl_ + "date" + _dl_ + ":" + _dl_ + "%ad" + _dl_ +
"}," +
_dl_ + "commiter" + _dl_ +
":{" +
_dl_ + "name" + _dl_ + ":" + _dl_ + "%cN" + _dl_ + "," +
_dl_ + "email" + _dl_ + ":" + _dl_ + "%cE" + _dl_ + "," +
_dl_ + "date" + _dl_ + ":" + _dl_ + "%cd" + _dl_ +
"}},"
GITFORMAT Refer git official doc for supported placeholders to add new fields Need to make sure the output does not break the json structure which is ensured by having the _dl_ delimiter which is later replaced by quotes
Functions ¶
func DeleteAFileIfExists ¶
func GetBranchReference ¶
func GetCheckoutPath ¶
func GetProjectName ¶
func GetUserNamePassword ¶
func GetUserNamePassword(gitProvider *sql.GitProvider) (userName, password string, err error)
func IsRepoShallowCloned ¶
Types ¶
type CiPipelineMaterialBean ¶
type CiPipelineMaterialBean struct { Id int GitMaterialId int Type sql.SourceType Value string Active bool GitCommit *GitCommitBase ExtraEnvironmentVariables map[string]string // extra env variables which will be used for CI }
type Commit ¶
type Commit struct { Hash *Hash Tree *Tree Author *Author Committer *Committer Tag *Tag Subject string Body string }
Commit data
type CommitCliIterator ¶
type CommitCliIterator struct {
// contains filtered or unexported fields
}
func (*CommitCliIterator) Next ¶
func (itr *CommitCliIterator) Next() (GitCommit, error)
type CommitGoGitIterator ¶
type CommitGoGitIterator struct {
object.CommitIter
}
func (*CommitGoGitIterator) Next ¶
func (itr *CommitGoGitIterator) Next() (GitCommit, error)
type CommitIterator ¶
type CommitMetadataRequest ¶
type CronLoggerImpl ¶
type CronLoggerImpl struct {
// contains filtered or unexported fields
}
func (*CronLoggerImpl) Error ¶
func (impl *CronLoggerImpl) Error(err error, msg string, keysAndValues ...interface{})
func (*CronLoggerImpl) Info ¶
func (impl *CronLoggerImpl) Info(msg string, keysAndValues ...interface{})
type FetchScmChangesRequest ¶
type FileStatsResult ¶
type GitChanges ¶
type GitCliManagerImpl ¶
type GitCliManagerImpl struct { GitManagerBase // contains filtered or unexported fields }
func NewGitCliManagerImpl ¶
func NewGitCliManagerImpl(baseManager GitManagerBase, logger *zap.SugaredLogger) *GitCliManagerImpl
func (*GitCliManagerImpl) GetCommitForHash ¶
func (impl *GitCliManagerImpl) GetCommitForHash(gitCtx GitContext, checkoutPath, commitHash string) (GitCommit, error)
func (*GitCliManagerImpl) GetCommitIterator ¶
func (impl *GitCliManagerImpl) GetCommitIterator(gitCtx GitContext, repository *GitRepository, iteratorRequest IteratorRequest) (CommitIterator, error)
func (*GitCliManagerImpl) GetCommitStats ¶
func (impl *GitCliManagerImpl) GetCommitStats(gitCtx GitContext, commit GitCommit, checkoutPath string) (FileStats, error)
func (*GitCliManagerImpl) GetCommits ¶
func (impl *GitCliManagerImpl) GetCommits(gitCtx GitContext, branchRef string, branch string, rootDir string, numCommits int, from string, to string) ([]GitCommit, error)
func (*GitCliManagerImpl) GetCommitsForTag ¶
func (impl *GitCliManagerImpl) GetCommitsForTag(gitCtx GitContext, checkoutPath, tag string) (GitCommit, error)
func (*GitCliManagerImpl) GitCreateRemote ¶
func (impl *GitCliManagerImpl) GitCreateRemote(gitCtx GitContext, rootDir string, url string) error
func (*GitCliManagerImpl) GitInit ¶
func (impl *GitCliManagerImpl) GitInit(gitCtx GitContext, rootDir string) error
func (*GitCliManagerImpl) GitShow ¶
func (impl *GitCliManagerImpl) GitShow(gitCtx GitContext, rootDir string, hash string) (GitCommit, error)
func (*GitCliManagerImpl) Init ¶
func (impl *GitCliManagerImpl) Init(gitCtx GitContext, rootDir string, remoteUrl string, isBare bool) error
func (*GitCliManagerImpl) OpenRepoPlain ¶
func (impl *GitCliManagerImpl) OpenRepoPlain(checkoutPath string) (*GitRepository, error)
type GitCommit ¶
type GitCommit interface {
GetCommit() *GitCommitBase
}
type GitCommitBase ¶
type GitCommitBase struct { Commit string Author string Date time.Time Message string Changes []string `json:",omitempty"` FileStats *FileStats `json:",omitempty"` WebhookData *WebhookData `json:"webhookData"` Excluded bool `json:",omitempty"` }
func AppendOldCommitsFromHistory ¶
func AppendOldCommitsFromHistory(newCommits []*GitCommitBase, commitHistory string, fetchedCount int) ([]*GitCommitBase, error)
func (*GitCommitBase) FixInvalidUTF8Message ¶
func (gitCommit *GitCommitBase) FixInvalidUTF8Message()
FixInvalidUTF8Message replaces invalid UTF-8 sequences with the replacement character (U+FFFD).
func (*GitCommitBase) GetCommit ¶
func (gitCommit *GitCommitBase) GetCommit() *GitCommitBase
func (*GitCommitBase) IsMessageValidUTF8 ¶
func (gitCommit *GitCommitBase) IsMessageValidUTF8() bool
IsMessageValidUTF8 checks if a string is valid UTF-8.
func (*GitCommitBase) SetFileStats ¶
func (gitCommit *GitCommitBase) SetFileStats(stats *FileStats)
func (*GitCommitBase) TruncateMessageIfExceedsMaxLength ¶
func (gitCommit *GitCommitBase) TruncateMessageIfExceedsMaxLength()
type GitCommitCli ¶
type GitCommitCli struct {
GitCommitBase
}
type GitCommitFormat ¶
type GitCommitGoGit ¶
type GitCommitGoGit struct { GitCommitBase Cm *object.Commit }
type GitContext ¶
type GitContext struct { context.Context // Embedding original Go context Username string Password string CloningMode string CACert string TLSKey string TLSCertificate string TLSVerificationEnabled bool }
func BuildGitContext ¶
func BuildGitContext(ctx context.Context) GitContext
func (GitContext) WithCloningMode ¶
func (gitCtx GitContext) WithCloningMode(CloningMode string) GitContext
func (GitContext) WithCredentials ¶
func (gitCtx GitContext) WithCredentials(Username string, Password string) GitContext
func (GitContext) WithTLSData ¶
func (gitCtx GitContext) WithTLSData(caData string, tlsKey string, tlsCertificate string, tlsVerificationEnabled bool) GitContext
func (GitContext) WithTimeout ¶
func (gitCtx GitContext) WithTimeout(timeoutSeconds int) (GitContext, context.CancelFunc)
type GitManager ¶
type GitManager interface { GitManagerBase // GetCommitStats retrieves the stats for the given commit vs its parent GetCommitStats(gitCtx GitContext, commit GitCommit, checkoutPath string) (FileStats, error) // GetCommitIterator returns an iterator for the provided git repo and iterator request describing the commits to fetch GetCommitIterator(gitCtx GitContext, repository *GitRepository, iteratorRequest IteratorRequest) (CommitIterator, error) // GetCommitForHash retrieves the commit reference for given tag GetCommitForHash(gitCtx GitContext, checkoutPath, commitHash string) (GitCommit, error) // GetCommitsForTag retrieves the commit reference for given tag GetCommitsForTag(gitCtx GitContext, checkoutPath, tag string) (GitCommit, error) // OpenRepoPlain opens a new git repo at the given path OpenRepoPlain(checkoutPath string) (*GitRepository, error) // Init initializes a git repo Init(gitCtx GitContext, rootDir string, remoteUrl string, isBare bool) error }
type GitManagerBase ¶
type GitManagerBase interface { // PathMatcher matches paths of files changes with defined regex expression PathMatcher(fileStats *FileStats, gitMaterial *sql.GitMaterial) bool // Fetch executes git fetch Fetch(gitCtx GitContext, rootDir string) (response, errMsg string, err error) // Checkout executes git checkout Checkout(gitCtx GitContext, rootDir, branch string) (response, errMsg string, err error) // ConfigureSshCommand configures ssh in git repo ConfigureSshCommand(gitCtx GitContext, rootDir string, sshPrivateKeyPath string) (response, errMsg string, err error) // FetchDiffStatBetweenCommitsNameOnly returns the list of files changed in reponse on executing git action FetchDiffStatBetweenCommitsNameOnly(gitCtx GitContext, oldHash string, newHash string, rootDir string) (FileStats, error) // FetchDiffStatBetweenCommitsWithNumstat returns the file stats reponse on executing git action FetchDiffStatBetweenCommitsWithNumstat(gitCtx GitContext, oldHash string, newHash string, rootDir string) (FileStats, error) // LogMergeBase get the commit diff between using a merge base strategy LogMergeBase(gitCtx GitContext, rootDir, from string, to string) ([]*Commit, error) ExecuteCustomCommand(gitContext GitContext, name string, arg ...string) (response, errMsg string, err error) }
GitManagerBase Base methods which will be available to all implementation of the parent interface
type GitManagerBaseImpl ¶
type GitManagerBaseImpl struct {
// contains filtered or unexported fields
}
func NewGitManagerBaseImpl ¶
func NewGitManagerBaseImpl(logger *zap.SugaredLogger, config *internals.Configuration) *GitManagerBaseImpl
func (*GitManagerBaseImpl) Checkout ¶
func (impl *GitManagerBaseImpl) Checkout(gitCtx GitContext, rootDir, branch string) (response, errMsg string, err error)
func (*GitManagerBaseImpl) ConfigureSshCommand ¶
func (impl *GitManagerBaseImpl) ConfigureSshCommand(gitCtx GitContext, rootDir string, sshPrivateKeyPath string) (response, errMsg string, err error)
func (*GitManagerBaseImpl) ExecuteCustomCommand ¶
func (impl *GitManagerBaseImpl) ExecuteCustomCommand(gitContext GitContext, name string, arg ...string) (response, errMsg string, err error)
func (*GitManagerBaseImpl) Fetch ¶
func (impl *GitManagerBaseImpl) Fetch(gitCtx GitContext, rootDir string) (response, errMsg string, err error)
func (*GitManagerBaseImpl) FetchDiffStatBetweenCommitsNameOnly ¶
func (impl *GitManagerBaseImpl) FetchDiffStatBetweenCommitsNameOnly(gitCtx GitContext, oldHash string, newHash string, rootDir string) (FileStats, error)
func (*GitManagerBaseImpl) FetchDiffStatBetweenCommitsWithNumstat ¶
func (impl *GitManagerBaseImpl) FetchDiffStatBetweenCommitsWithNumstat(gitCtx GitContext, oldHash string, newHash string, rootDir string) (FileStats, error)
func (*GitManagerBaseImpl) LogMergeBase ¶
func (impl *GitManagerBaseImpl) LogMergeBase(gitCtx GitContext, rootDir, from string, to string) ([]*Commit, error)
func (*GitManagerBaseImpl) PathMatcher ¶
func (impl *GitManagerBaseImpl) PathMatcher(fileStats *FileStats, gitMaterial *sql.GitMaterial) bool
type GitManagerImpl ¶
type GitManagerImpl struct {
GitManager
}
func NewGitManagerImpl ¶
func NewGitManagerImpl(logger *zap.SugaredLogger, configuration *internals.Configuration) *GitManagerImpl
type GitRepository ¶
type GitRepository struct { *git.Repository // contains filtered or unexported fields }
type GitWatcher ¶
type GitWatcher interface {
PollAndUpdateGitMaterial(material *sql.GitMaterial) (*sql.GitMaterial, error)
}
type GitWatcherImpl ¶
type GitWatcherImpl struct {
// contains filtered or unexported fields
}
func NewGitWatcherImpl ¶
func NewGitWatcherImpl(repositoryManager RepositoryManager, materialRepo sql.MaterialRepository, logger *zap.SugaredLogger, ciPipelineMaterialRepository sql.CiPipelineMaterialRepository, locker *internals.RepositoryLocker, pubSubClient *pubsub.PubSubClientServiceImpl, webhookHandler WebhookHandler, configuration *internals.Configuration, gitmanager GitManager, ) (*GitWatcherImpl, error)
func (GitWatcherImpl) FetchAndUpdateMaterial ¶
func (impl GitWatcherImpl) FetchAndUpdateMaterial(gitCtx GitContext, material *sql.GitMaterial, location string) (bool, *GitRepository, error)
func (GitWatcherImpl) NotifyForMaterialUpdate ¶
func (impl GitWatcherImpl) NotifyForMaterialUpdate(materials []*CiPipelineMaterialBean, gitMaterial *sql.GitMaterial) error
func (GitWatcherImpl) PollAndUpdateGitMaterial ¶
func (impl GitWatcherImpl) PollAndUpdateGitMaterial(material *sql.GitMaterial) (*sql.GitMaterial, error)
func (*GitWatcherImpl) RunOnWorker ¶
func (impl *GitWatcherImpl) RunOnWorker(materials []*sql.GitMaterial)
func (GitWatcherImpl) StopCron ¶
func (impl GitWatcherImpl) StopCron()
func (GitWatcherImpl) SubscribeWebhookEvent ¶
func (impl GitWatcherImpl) SubscribeWebhookEvent() error
func (GitWatcherImpl) Watch ¶
func (impl GitWatcherImpl) Watch()
type GoGitSDKManagerImpl ¶
type GoGitSDKManagerImpl struct { GitManagerBase // contains filtered or unexported fields }
func NewGoGitSDKManagerImpl ¶
func NewGoGitSDKManagerImpl(baseManager GitManagerBase, logger *zap.SugaredLogger) *GoGitSDKManagerImpl
func (*GoGitSDKManagerImpl) GetCommitForHash ¶
func (impl *GoGitSDKManagerImpl) GetCommitForHash(gitCtx GitContext, checkoutPath, commitHash string) (GitCommit, error)
func (*GoGitSDKManagerImpl) GetCommitIterator ¶
func (impl *GoGitSDKManagerImpl) GetCommitIterator(gitCtx GitContext, repository *GitRepository, iteratorRequest IteratorRequest) (CommitIterator, error)
func (*GoGitSDKManagerImpl) GetCommitStats ¶
func (impl *GoGitSDKManagerImpl) GetCommitStats(gitCtx GitContext, commit GitCommit, checkoutPath string) (FileStats, error)
func (*GoGitSDKManagerImpl) GetCommitsForTag ¶
func (impl *GoGitSDKManagerImpl) GetCommitsForTag(gitCtx GitContext, checkoutPath, tag string) (GitCommit, error)
func (*GoGitSDKManagerImpl) Init ¶
func (impl *GoGitSDKManagerImpl) Init(gitCtx GitContext, rootDir string, remoteUrl string, isBare bool) error
func (*GoGitSDKManagerImpl) OpenRepoPlain ¶
func (impl *GoGitSDKManagerImpl) OpenRepoPlain(checkoutPath string) (*GitRepository, error)
type HeadRequest ¶
type HeadRequest struct {
MaterialIds []int `json:"materialIds"`
}
type IteratorRequest ¶
type MaterialChangeResp ¶
type PollConfig ¶
type RefreshGitMaterialRequest ¶
type RefreshGitMaterialRequest struct {
GitMaterialId int `json:"gitMaterialId"`
}
type RepositoryManager ¶
type RepositoryManager interface { // Fetch Fetches latest commit for repo. Creates a new repo if it doesn't already exist // and returns the reference to the repo Fetch(gitCtx GitContext, url string, location string) (updated bool, repo *GitRepository, err error) // Add adds and initializes a new git repo , cleans the directory if not empty and fetches latest commits Add(gitCtx GitContext, gitProviderId int, location, url string, authMode sql.AuthMode, sshPrivateKeyContent string) error InitRepoAndGetSshPrivateKeyPath(gitCtx GitContext, gitProviderId int, location, url string, authMode sql.AuthMode, sshPrivateKeyContent string) (string, error) FetchRepo(gitCtx GitContext, location string) error GetCheckoutLocationFromGitUrl(material *sql.GitMaterial, cloningMode string) (location string, httpMatched bool, shMatched bool, err error) GetCheckoutLocation(gitCtx GitContext, material *sql.GitMaterial, url, checkoutPath string) string TrimLastGitCommit(gitCommits []*GitCommitBase, count int) []*GitCommitBase // Clean cleans a directory Clean(cloneDir string) error // ChangesSinceByRepository returns the latest commits list for the given range and count for an existing repo ChangesSinceByRepository(gitCtx GitContext, repository *GitRepository, branch string, from string, to string, count int, checkoutPath string, openNewGitRepo bool) ([]*GitCommitBase, error) // GetCommitMetadata retrieves the commit metadata for given hash GetCommitMetadata(gitCtx GitContext, checkoutPath, commitHash string) (*GitCommitBase, error) // GetCommitForTag retrieves the commit metadata for given tag GetCommitForTag(gitCtx GitContext, checkoutPath, tag string) (*GitCommitBase, error) // CreateSshFileIfNotExistsAndConfigureSshCommand creates ssh file with creds and configures it at the location CreateSshFileIfNotExistsAndConfigureSshCommand(gitCtx GitContext, location string, gitProviderId int, sshPrivateKeyContent string) (string, error) }
type RepositoryManagerAnalytics ¶
type RepositoryManagerAnalytics interface {
ChangesSinceByRepositoryForAnalytics(gitCtx GitContext, checkoutPath string, Old string, New string) (*GitChanges, error)
}
type RepositoryManagerAnalyticsImpl ¶
type RepositoryManagerAnalyticsImpl struct {
// contains filtered or unexported fields
}
func NewRepositoryManagerAnalyticsImpl ¶
func NewRepositoryManagerAnalyticsImpl(repoManager RepositoryManager, gitManager GitManager, configuration *internals.Configuration, logger *zap.SugaredLogger) *RepositoryManagerAnalyticsImpl
func (RepositoryManagerAnalyticsImpl) ChangesSinceByRepositoryForAnalytics ¶
func (impl RepositoryManagerAnalyticsImpl) ChangesSinceByRepositoryForAnalytics(gitCtx GitContext, checkoutPath string, Old string, New string) (*GitChanges, error)
from -> old commit to -> new commit
type RepositoryManagerImpl ¶
type RepositoryManagerImpl struct {
// contains filtered or unexported fields
}
func NewRepositoryManagerImpl ¶
func NewRepositoryManagerImpl( logger *zap.SugaredLogger, configuration *internals.Configuration, gitManager GitManager, ) *RepositoryManagerImpl
func (*RepositoryManagerImpl) Add ¶
func (impl *RepositoryManagerImpl) Add(gitCtx GitContext, gitProviderId int, location, url string, authMode sql.AuthMode, sshPrivateKeyContent string) error
func (*RepositoryManagerImpl) ChangesSinceByRepository ¶
func (impl *RepositoryManagerImpl) ChangesSinceByRepository(gitCtx GitContext, repository *GitRepository, branch string, from string, to string, count int, checkoutPath string, openNewGitRepo bool) ([]*GitCommitBase, error)
from -> old commit to -> new commit
func (*RepositoryManagerImpl) Clean ¶
func (impl *RepositoryManagerImpl) Clean(dir string) error
func (*RepositoryManagerImpl) CleanupAndInitRepo ¶
func (impl *RepositoryManagerImpl) CleanupAndInitRepo(gitCtx GitContext, location string, url string) error
func (*RepositoryManagerImpl) CreateSshFileIfNotExistsAndConfigureSshCommand ¶
func (impl *RepositoryManagerImpl) CreateSshFileIfNotExistsAndConfigureSshCommand(gitCtx GitContext, location string, gitProviderId int, sshPrivateKeyContent string) (string, error)
func (*RepositoryManagerImpl) Fetch ¶
func (impl *RepositoryManagerImpl) Fetch(gitCtx GitContext, url string, location string) (updated bool, repo *GitRepository, err error)
func (*RepositoryManagerImpl) FetchRepo ¶
func (impl *RepositoryManagerImpl) FetchRepo(gitCtx GitContext, location string) error
func (*RepositoryManagerImpl) GetCheckoutLocation ¶
func (impl *RepositoryManagerImpl) GetCheckoutLocation(gitCtx GitContext, material *sql.GitMaterial, url, checkoutPath string) string
func (*RepositoryManagerImpl) GetCheckoutLocationFromGitUrl ¶
func (impl *RepositoryManagerImpl) GetCheckoutLocationFromGitUrl(material *sql.GitMaterial, cloningMode string) (location string, httpMatched bool, shMatched bool, err error)
func (*RepositoryManagerImpl) GetCommitForTag ¶
func (impl *RepositoryManagerImpl) GetCommitForTag(gitCtx GitContext, checkoutPath, tag string) (*GitCommitBase, error)
func (*RepositoryManagerImpl) GetCommitMetadata ¶
func (impl *RepositoryManagerImpl) GetCommitMetadata(gitCtx GitContext, checkoutPath, commitHash string) (*GitCommitBase, error)
func (*RepositoryManagerImpl) InitRepoAndGetSshPrivateKeyPath ¶
func (impl *RepositoryManagerImpl) InitRepoAndGetSshPrivateKeyPath(gitCtx GitContext, gitProviderId int, location, url string, authMode sql.AuthMode, sshPrivateKeyContent string) (string, error)
func (*RepositoryManagerImpl) IsSpaceAvailableOnDisk ¶
func (impl *RepositoryManagerImpl) IsSpaceAvailableOnDisk() bool
func (*RepositoryManagerImpl) TrimLastGitCommit ¶
func (impl *RepositoryManagerImpl) TrimLastGitCommit(gitCommits []*GitCommitBase, count int) []*GitCommitBase
type WebhookAndCiData ¶
type WebhookAndCiData struct { ExtraEnvironmentVariables map[string]string `json:"extraEnvironmentVariables"` // extra env variables which will be used for CI WebhookData *WebhookData `json:"webhookData"` }
type WebhookData ¶
type WebhookDataRequest ¶
type WebhookEvent ¶
type WebhookEventBeanConverter ¶
type WebhookEventBeanConverter interface { ConvertFromWebhookParsedDataSqlBean(sqlBean *sql.WebhookEventParsedData) *WebhookData ConvertFromWebhookEventSqlBean(sqlBean *sql.GitHostWebhookEvent) *WebhookEventConfig }
type WebhookEventBeanConverterImpl ¶
type WebhookEventBeanConverterImpl struct { }
func NewWebhookEventBeanConverterImpl ¶
func NewWebhookEventBeanConverterImpl() *WebhookEventBeanConverterImpl
func (WebhookEventBeanConverterImpl) ConvertFromWebhookEventSqlBean ¶
func (impl WebhookEventBeanConverterImpl) ConvertFromWebhookEventSqlBean(webhookEventFromDb *sql.GitHostWebhookEvent) *WebhookEventConfig
func (WebhookEventBeanConverterImpl) ConvertFromWebhookParsedDataSqlBean ¶
func (impl WebhookEventBeanConverterImpl) ConvertFromWebhookParsedDataSqlBean(sqlBean *sql.WebhookEventParsedData) *WebhookData
type WebhookEventConfig ¶
type WebhookEventConfig struct { Id int `json:"id"` GitHostId int `json:"gitHostId"` Name string `json:"name"` EventTypesCsv string `json:"eventTypesCsv"` ActionType string `json:"actionType"` IsActive bool `json:"isActive"` CreatedOn time.Time `json:"createdOn"` UpdatedOn time.Time `json:"updatedOn"` Selectors []*WebhookEventSelectors `json:"selectors"` }
type WebhookEventParser ¶
type WebhookEventParser interface {
ParseEvent(selectors []*sql.GitHostWebhookEventSelectors, requestPayloadJson string) (*sql.WebhookEventParsedData, map[string]string, error)
}
type WebhookEventParserImpl ¶
type WebhookEventParserImpl struct {
// contains filtered or unexported fields
}
func NewWebhookEventParserImpl ¶
func NewWebhookEventParserImpl(logger *zap.SugaredLogger) *WebhookEventParserImpl
func (WebhookEventParserImpl) ParseEvent ¶
func (impl WebhookEventParserImpl) ParseEvent(selectors []*sql.GitHostWebhookEventSelectors, requestPayloadJson string) (*sql.WebhookEventParsedData, map[string]string, error)
type WebhookEventResponse ¶
type WebhookEventResponse struct {
// contains filtered or unexported fields
}
type WebhookEventSelectors ¶
type WebhookEventSelectors struct { Id int `json:"id"` EventId int `json:"eventId"` Name string `json:"name"` Selector string `json:"selector"` ToShow bool `json:"toShow"` ToShowInCiFilter bool `json:"toShowInCiFilter"` FixValue string `json:"fixValue"` PossibleValues string `json:"possibleValues"` IsActive bool `json:"isActive"` CreatedOn time.Time `json:"createdOn"` UpdatedOn time.Time `json:"updatedOn"` }
type WebhookEventService ¶
type WebhookEventService interface { GetAllGitHostWebhookEventByGitHostId(gitHostId int, gitHostName string) ([]*sql.GitHostWebhookEvent, error) GetAllGitHostWebhookEventByGitHostName(gitHostName string) ([]*sql.GitHostWebhookEvent, error) GetWebhookParsedEventDataByEventIdAndUniqueId(eventId int, uniqueId string) (*sql.WebhookEventParsedData, error) SaveWebhookParsedEventData(webhookEventParsedData *sql.WebhookEventParsedData) error UpdateWebhookParsedEventData(webhookEventParsedData *sql.WebhookEventParsedData) error MatchCiTriggerConditionAndNotify(event *sql.GitHostWebhookEvent, webhookEventParsedData *sql.WebhookEventParsedData, fullDataMap map[string]string) error }
type WebhookEventServiceImpl ¶
type WebhookEventServiceImpl struct {
// contains filtered or unexported fields
}
func NewWebhookEventServiceImpl ¶
func NewWebhookEventServiceImpl( logger *zap.SugaredLogger, webhookEventRepository sql.WebhookEventRepository, webhookEventParsedDataRepository sql.WebhookEventParsedDataRepository, webhookEventDataMappingRepository sql.WebhookEventDataMappingRepository, webhookEventDataMappingFilterResultRepository sql.WebhookEventDataMappingFilterResultRepository, materialRepository sql.MaterialRepository, pubSubClient *pubsub.PubSubClientServiceImpl, webhookEventBeanConverter WebhookEventBeanConverter, ) *WebhookEventServiceImpl
func (WebhookEventServiceImpl) BuildNotifyCiObject ¶
func (impl WebhookEventServiceImpl) BuildNotifyCiObject(ciPipelineMaterial *sql.CiPipelineMaterial, webhookEventParsedData *sql.WebhookEventParsedData, filterResults []*sql.CiPipelineMaterialWebhookDataMappingFilterResult) *CiPipelineMaterialBean
func (WebhookEventServiceImpl) GetAllGitHostWebhookEventByGitHostId ¶
func (impl WebhookEventServiceImpl) GetAllGitHostWebhookEventByGitHostId(gitHostId int, gitHostName string) ([]*sql.GitHostWebhookEvent, error)
func (WebhookEventServiceImpl) GetAllGitHostWebhookEventByGitHostName ¶
func (impl WebhookEventServiceImpl) GetAllGitHostWebhookEventByGitHostName(gitHostName string) ([]*sql.GitHostWebhookEvent, error)
func (WebhookEventServiceImpl) GetRegexGroupData ¶
func (impl WebhookEventServiceImpl) GetRegexGroupData(regex string, val string) map[string]string
func (WebhookEventServiceImpl) GetWebhookParsedEventDataByEventIdAndUniqueId ¶
func (impl WebhookEventServiceImpl) GetWebhookParsedEventDataByEventIdAndUniqueId(eventId int, uniqueId string) (*sql.WebhookEventParsedData, error)
func (WebhookEventServiceImpl) HandleMaterialWebhookMappingFilterResultIntoDb ¶
func (impl WebhookEventServiceImpl) HandleMaterialWebhookMappingFilterResultIntoDb(filterResults []*sql.CiPipelineMaterialWebhookDataMappingFilterResult, webhookDataMappingId int, isNewMapping bool) error
func (WebhookEventServiceImpl) HandleMaterialWebhookMappingIntoDb ¶
func (impl WebhookEventServiceImpl) HandleMaterialWebhookMappingIntoDb(ciPipelineMaterialId int, webhookParsedDataId int, conditionMatched bool, filterResults []*sql.CiPipelineMaterialWebhookDataMappingFilterResult) error
func (WebhookEventServiceImpl) MatchCiTriggerConditionAndNotify ¶
func (impl WebhookEventServiceImpl) MatchCiTriggerConditionAndNotify(event *sql.GitHostWebhookEvent, webhookEventParsedData *sql.WebhookEventParsedData, fullDataMap map[string]string) error
func (WebhookEventServiceImpl) MatchFilter ¶
func (impl WebhookEventServiceImpl) MatchFilter(event *sql.GitHostWebhookEvent, fullDataMap map[string]string, ciPipelineMaterialJsonValue string) ([]*sql.CiPipelineMaterialWebhookDataMappingFilterResult, bool, error)
func (WebhookEventServiceImpl) NotifyForAutoCi ¶
func (impl WebhookEventServiceImpl) NotifyForAutoCi(material *CiPipelineMaterialBean) error
func (WebhookEventServiceImpl) SaveWebhookParsedEventData ¶
func (impl WebhookEventServiceImpl) SaveWebhookParsedEventData(webhookEventParsedData *sql.WebhookEventParsedData) error
func (WebhookEventServiceImpl) UpdateWebhookParsedEventData ¶
func (impl WebhookEventServiceImpl) UpdateWebhookParsedEventData(webhookEventParsedData *sql.WebhookEventParsedData) error
type WebhookHandler ¶
type WebhookHandler interface {
HandleWebhookEvent(webhookEvent *WebhookEvent) error
}
type WebhookHandlerImpl ¶
type WebhookHandlerImpl struct {
// contains filtered or unexported fields
}
func NewWebhookHandlerImpl ¶
func NewWebhookHandlerImpl(logger *zap.SugaredLogger, webhookEventService WebhookEventService, webhookEventParser WebhookEventParser) *WebhookHandlerImpl
func (WebhookHandlerImpl) HandleWebhookEvent ¶
func (impl WebhookHandlerImpl) HandleWebhookEvent(webhookEvent *WebhookEvent) error
type WebhookPayloadDataResponse ¶
type WebhookPayloadDataResponse struct { Filters map[string]string `json:"filters"` RepositoryUrl string `json:"repositoryUrl"` Payloads []*WebhookPayloadDataPayloadsResponse `json:"payloads"` }
type WebhookPayloadFilterDataResponse ¶
type WebhookPayloadFilterDataResponse struct { PayloadId int `json:"payloadId"` SelectorsData []*WebhookPayloadFilterDataSelectorResponse `json:"selectorsData"` }
type WebhookSourceTypeValue ¶
type WebhookSourceTypeValue struct { EventId int `json:"eventId,omitempty"` Condition map[int]string `json:"condition,omitempty"` }
key in condition is selectorId
Source Files ¶
Click to show internal directories.
Click to hide internal directories.