Documentation ¶
Index ¶
- Constants
- func BatchToJsonStruct(b model.DiggerBatch) (orchestrator_scheduler.SerializedBatch, error)
- func ConnectDatabase()
- func JobToJsonStruct(j model.DiggerJob) (orchestrator_scheduler.SerializedJob, error)
- func ToDiggerProject(p *model.Project) digger_config.Project
- func ToVariableSpec(v model.EnvVar) spec.VariableSpec
- type BatchEventType
- type Database
- func (db *Database) CreateDiggerBatch(orgid string, vcsType DiggerVCSType, githubInstallationId int64, ...) (*model.DiggerBatch, error)
- func (db *Database) CreateDiggerJob(batchId string, serializedJob []byte, workflowFile string) (*model.DiggerJob, error)
- func (db *Database) CreateDiggerJobParentLink(parentJobId string, jobId string) error
- func (db *Database) CreateDiggerJobToken(organisationId string) (*model.DiggerJobToken, error)
- func (db *Database) CreateDiggerLock(resource string, lockId int, orgId string) (*model.DiggerLock, error)
- func (db *Database) CreateDiggerRun(Triggertype string, PrNumber int, Status DiggerRunStatus, CommitId string, ...) (*model.DiggerRun, error)
- func (db *Database) CreateDiggerRunQueueItem(diggeRrunId string, projectId string) (*model.DiggerRunQueueItem, error)
- func (db *Database) CreateDiggerRunStage(batchId string) (*model.DiggerRunStage, error)
- func (db *Database) CreateGithubApp(name string, githubId int64, url string) (*model.GithubApp, error)
- func (db *Database) CreateGithubAppInstallation(installationId int64, githubAppId int64, login string, accountId int, ...) (*model.GithubAppInstallation, error)
- func (db *Database) CreateGithubInstallationLink(org *model.Organization, installationId int64) (*model.GithubAppInstallationLink, error)
- func (db *Database) CreateProject(name string, org *model.Organization, repo *model.Repo, isGenerated bool, ...) (*model.Project, error)
- func (db *Database) CreateRepo(name string, repoFullName string, repoOrganisation string, repoName string, ...) (*model.Repo, error)
- func (db *Database) DeleteDiggerLock(lock *model.DiggerLock) error
- func (db *Database) DequeueRunItem(queueItem *model.DiggerRunQueueItem) error
- func (db *Database) GetDefaultRepo(c *gin.Context, orgIdKey string) (*model.Repo, bool)
- func (db *Database) GetDiggerBatch(batchId string) (*model.DiggerBatch, error)
- func (db *Database) GetDiggerJob(jobId string) (*model.DiggerJob, error)
- func (db *Database) GetDiggerJobFromRunStage(stage model.DiggerRunStage) (*model.DiggerJob, error)
- func (db *Database) GetDiggerJobParentLinksByParentId(parentId *string) ([]model.DiggerJobParentLink, error)
- func (db *Database) GetDiggerJobParentLinksChildId(childId *string) ([]model.DiggerJobParentLink, error)
- func (db *Database) GetDiggerJobsForBatch(batchId string) ([]model.DiggerJob, error)
- func (db *Database) GetDiggerJobsForBatchWithStatus(batchId string, status []scheduler.DiggerJobStatus) ([]model.DiggerJob, error)
- func (db *Database) GetDiggerJobsWithStatus(status scheduler.DiggerJobStatus) ([]model.DiggerJob, error)
- func (db *Database) GetDiggerLock(resource string) (*model.DiggerLock, error)
- func (db *Database) GetDiggerRun(id string) (*model.DiggerRun, error)
- func (db *Database) GetDiggerRunQueueItem(id uint) (*model.DiggerRunQueueItem, error)
- func (db *Database) GetDiggerRunStage(id string) (*model.DiggerRunStage, error)
- func (db *Database) GetFirstRunQueueForEveryProject() ([]model.DiggerRunQueueItem, error)
- func (db *Database) GetGithubApp(gitHubAppId any) (*model.GithubApp, error)
- func (db *Database) GetGithubAppInstallationByIdAndRepo(installationId int64, repoFullName string) (*model.GithubAppInstallation, error)
- func (db *Database) GetGithubAppInstallationByOrgAndRepo(orgId any, repo string, status GithubAppInstallStatus) (*model.GithubAppInstallation, error)
- func (db *Database) GetGithubAppInstallationLink(installationId int64) (*model.GithubAppInstallationLink, error)
- func (db *Database) GetGithubAppInstallations(installationId int64) ([]model.GithubAppInstallation, error)
- func (db *Database) GetGithubInstallationLinkForInstallationId(installationId int64) (*model.GithubAppInstallationLink, error)
- func (db *Database) GetGithubInstallationLinkForOrg(orgId any) (*model.GithubAppInstallationLink, error)
- func (db *Database) GetJobToken(tenantId any) (*model.DiggerJobToken, error)
- func (db *Database) GetLastDiggerRunForProject(projectName string) (*model.DiggerRun, error)
- func (db *Database) GetOrganisation(tenantId any) (*model.Organization, error)
- func (db *Database) GetOrganisationById(orgId string) (*model.Organization, error)
- func (db *Database) GetPendingParentDiggerJobs(batchId string) ([]model.DiggerJob, error)
- func (db *Database) GetProject(projectId string) (*model.Project, error)
- func (db *Database) GetProjectByName(orgId any, repo *model.Repo, name string) (*model.Project, error)
- func (db *Database) GetProjectByProjectId(c *gin.Context, projectId uint, orgIdKey string) (*model.Project, bool)
- func (db *Database) GetProjectByRepo(orgId any, repo *model.Repo) ([]model.Project, error)
- func (db *Database) GetProjectVariables(projectId string) ([]model.EnvVar, error)
- func (db *Database) GetProjectsFromContext(c *gin.Context, orgIdKey string) ([]model.Project, bool)
- func (db *Database) GetRepo(orgIdKey any, repoName string) (*model.Repo, error)
- func (db *Database) GetRepoByFullName(orgIdKey any, repofullName string) (*model.Repo, error)
- func (db *Database) GetRepoById(repoId int64) (*model.Repo, error)
- func (db *Database) GetRepoByOrgAndId(orgIdKey any, repoId any) (*model.Repo, error)
- func (db *Database) GetReposFromContext(c *gin.Context, orgIdKey string) ([]model.Repo, bool)
- func (db *Database) GetUserOrganizationsFirstMatch(userId string) (*model.Organization, error)
- func (db *Database) GithubRepoAdded(installationId int64, appId int64, login string, accountId int64, ...) (*model.GithubAppInstallation, error)
- func (db *Database) GithubRepoRemoved(installationId int64, appId int64, repoFullName string, orgId string) (*model.GithubAppInstallation, error)
- func (db *Database) ListDiggerRunsForProject(projectName string, repoId uint) ([]model.DiggerRun, error)
- func (db *Database) MakeGithubAppInstallationLinkInactive(link *model.GithubAppInstallationLink) (*model.GithubAppInstallationLink, error)
- func (db *Database) RefreshDiggerJobTokenExpiry(job *model.DiggerJob) error
- func (db *Database) UpdateBatchStatus(batch *model.DiggerBatch) error
- func (db *Database) UpdateDiggerBatch(batch *model.DiggerBatch) error
- func (db *Database) UpdateDiggerJob(job *model.DiggerJob) error
- func (db *Database) UpdateDiggerJobSummary(diggerJobSummaryId string, resourcesCreated uint, resourcesUpdated uint, ...) (*model.DiggerJob, error)
- func (db *Database) UpdateDiggerRun(diggerRun *model.DiggerRun) error
- func (db *Database) UpdateProject(project *model.Project) error
- func (db *Database) UpdateRepoDiggerConfig(orgId string, config configuration.DiggerConfigYaml, repo *model.Repo, ...) error
- type DiggerJobLinkStatus
- type DiggerRunStatus
- type DiggerVCSType
- type GithubAppInstallStatus
- type GithubAppInstallationLinkStatus
- type ProjectStatus
- type RunType
Constants ¶
const ( AccessPolicyType = "access" AdminPolicyType = "admin" CliJobAccessType = "cli_access" )
const DiggerBatchDriftEvent = "drift_event"
const DiggerBatchManualTriggerEvent = "manual_trigger"
const DiggerBatchMergeEvent = "merge_event"
const DiggerBatchPullRequestEvent = "pull_request_event"
Variables ¶
This section is empty.
Functions ¶
func BatchToJsonStruct ¶
func BatchToJsonStruct(b model.DiggerBatch) (orchestrator_scheduler.SerializedBatch, error)
func ConnectDatabase ¶
func ConnectDatabase()
func JobToJsonStruct ¶
func JobToJsonStruct(j model.DiggerJob) (orchestrator_scheduler.SerializedJob, error)
func ToDiggerProject ¶
func ToDiggerProject(p *model.Project) digger_config.Project
func ToVariableSpec ¶
func ToVariableSpec(v model.EnvVar) spec.VariableSpec
Types ¶
type BatchEventType ¶
type BatchEventType string
type Database ¶
type Database struct { GormDB *gorm.DB Query *models_generated.Query }
var DB *Database
var DB *gorm.DB
func (*Database) CreateDiggerBatch ¶
func (db *Database) CreateDiggerBatch(orgid string, vcsType DiggerVCSType, githubInstallationId int64, repoOwner string, repoName string, repoFullname string, PRNumber int, diggerConfig string, branchName string, batchType scheduler.DiggerCommand, commentId *int64, gitlabProjectId int, batchEventType BatchEventType) (*model.DiggerBatch, error)
func (*Database) CreateDiggerJob ¶
func (*Database) CreateDiggerJobParentLink ¶
func (*Database) CreateDiggerJobToken ¶
func (db *Database) CreateDiggerJobToken(organisationId string) (*model.DiggerJobToken, error)
func (*Database) CreateDiggerLock ¶
func (*Database) CreateDiggerRun ¶
func (db *Database) CreateDiggerRun(Triggertype string, PrNumber int, Status DiggerRunStatus, CommitId string, DiggerConfig string, GithubInstallationId int64, RepoId int64, projectId string, ProjectName string, RunType RunType, planStageId string, applyStageId string, triggeredByUserId *string) (*model.DiggerRun, error)
func (*Database) CreateDiggerRunQueueItem ¶
func (*Database) CreateDiggerRunStage ¶
func (db *Database) CreateDiggerRunStage(batchId string) (*model.DiggerRunStage, error)
func (*Database) CreateGithubApp ¶
func (*Database) CreateGithubAppInstallation ¶
func (*Database) CreateGithubInstallationLink ¶
func (db *Database) CreateGithubInstallationLink(org *model.Organization, installationId int64) (*model.GithubAppInstallationLink, error)
func (*Database) CreateProject ¶
func (*Database) CreateRepo ¶
func (*Database) DeleteDiggerLock ¶
func (db *Database) DeleteDiggerLock(lock *model.DiggerLock) error
func (*Database) DequeueRunItem ¶
func (db *Database) DequeueRunItem(queueItem *model.DiggerRunQueueItem) error
func (*Database) GetDefaultRepo ¶
func (*Database) GetDiggerBatch ¶
func (db *Database) GetDiggerBatch(batchId string) (*model.DiggerBatch, error)
func (*Database) GetDiggerJob ¶
func (*Database) GetDiggerJobFromRunStage ¶
func (*Database) GetDiggerJobParentLinksByParentId ¶
func (db *Database) GetDiggerJobParentLinksByParentId(parentId *string) ([]model.DiggerJobParentLink, error)
func (*Database) GetDiggerJobParentLinksChildId ¶
func (db *Database) GetDiggerJobParentLinksChildId(childId *string) ([]model.DiggerJobParentLink, error)
func (*Database) GetDiggerJobsForBatch ¶
func (*Database) GetDiggerJobsForBatchWithStatus ¶
func (*Database) GetDiggerJobsWithStatus ¶
func (*Database) GetDiggerLock ¶
func (db *Database) GetDiggerLock(resource string) (*model.DiggerLock, error)
func (*Database) GetDiggerRun ¶
func (*Database) GetDiggerRunQueueItem ¶
func (db *Database) GetDiggerRunQueueItem(id uint) (*model.DiggerRunQueueItem, error)
func (*Database) GetDiggerRunStage ¶
func (db *Database) GetDiggerRunStage(id string) (*model.DiggerRunStage, error)
func (*Database) GetFirstRunQueueForEveryProject ¶
func (db *Database) GetFirstRunQueueForEveryProject() ([]model.DiggerRunQueueItem, error)
func (*Database) GetGithubApp ¶
GetGithubApp return GithubApp by Id
func (*Database) GetGithubAppInstallationByIdAndRepo ¶
func (db *Database) GetGithubAppInstallationByIdAndRepo(installationId int64, repoFullName string) (*model.GithubAppInstallation, error)
GetGithubAppInstallationByIdAndRepo repoFullName should be in the following format: org/repo_name, for example "diggerhq/github-job-scheduler"
func (*Database) GetGithubAppInstallationByOrgAndRepo ¶
func (db *Database) GetGithubAppInstallationByOrgAndRepo(orgId any, repo string, status GithubAppInstallStatus) (*model.GithubAppInstallation, error)
func (*Database) GetGithubAppInstallationLink ¶
func (db *Database) GetGithubAppInstallationLink(installationId int64) (*model.GithubAppInstallationLink, error)
GetGithubAppInstallationLink repoFullName should be in the following format: org/repo_name, for example "diggerhq/github-job-scheduler"
func (*Database) GetGithubAppInstallations ¶
func (db *Database) GetGithubAppInstallations(installationId int64) ([]model.GithubAppInstallation, error)
func (*Database) GetGithubInstallationLinkForInstallationId ¶
func (db *Database) GetGithubInstallationLinkForInstallationId(installationId int64) (*model.GithubAppInstallationLink, error)
func (*Database) GetGithubInstallationLinkForOrg ¶
func (db *Database) GetGithubInstallationLinkForOrg(orgId any) (*model.GithubAppInstallationLink, error)
func (*Database) GetJobToken ¶
func (db *Database) GetJobToken(tenantId any) (*model.DiggerJobToken, error)
func (*Database) GetLastDiggerRunForProject ¶
func (*Database) GetOrganisation ¶
func (db *Database) GetOrganisation(tenantId any) (*model.Organization, error)
func (*Database) GetOrganisationById ¶
func (db *Database) GetOrganisationById(orgId string) (*model.Organization, error)
func (*Database) GetPendingParentDiggerJobs ¶
func (*Database) GetProject ¶
func (*Database) GetProjectByName ¶
func (db *Database) GetProjectByName(orgId any, repo *model.Repo, name string) (*model.Project, error)
GetProjectByName return project for specified org and repo if record doesn't exist return nil
func (*Database) GetProjectByProjectId ¶
func (*Database) GetProjectByRepo ¶
GetProjectByRepo return projects for specified org and repo
func (*Database) GetProjectVariables ¶
func (*Database) GetProjectsFromContext ¶
func (*Database) GetRepo ¶
GetRepo returns digger repo by organisationId and repo name (diggerhq-digger) it will return an empty object if record doesn't exist in database
func (*Database) GetRepoByFullName ¶
func (*Database) GetRepoByOrgAndId ¶
GetRepoByOrgAndId returns digger repo by organisationId and repo name (diggerhq-digger)
func (*Database) GetReposFromContext ¶
func (*Database) GetUserOrganizationsFirstMatch ¶
func (db *Database) GetUserOrganizationsFirstMatch(userId string) (*model.Organization, error)
func (*Database) GithubRepoAdded ¶
func (db *Database) GithubRepoAdded(installationId int64, appId int64, login string, accountId int64, repoFullName string) (*model.GithubAppInstallation, error)
GithubRepoAdded handles github drift that github repo has been added to the app installation
func (*Database) GithubRepoRemoved ¶
func (*Database) ListDiggerRunsForProject ¶
func (*Database) MakeGithubAppInstallationLinkInactive ¶
func (db *Database) MakeGithubAppInstallationLinkInactive(link *model.GithubAppInstallationLink) (*model.GithubAppInstallationLink, error)
func (*Database) RefreshDiggerJobTokenExpiry ¶
func (*Database) UpdateBatchStatus ¶
func (db *Database) UpdateBatchStatus(batch *model.DiggerBatch) error
func (*Database) UpdateDiggerBatch ¶
func (db *Database) UpdateDiggerBatch(batch *model.DiggerBatch) error
func (*Database) UpdateDiggerJobSummary ¶
func (*Database) UpdateDiggerRun ¶
func (*Database) UpdateRepoDiggerConfig ¶
func (db *Database) UpdateRepoDiggerConfig(orgId string, config configuration.DiggerConfigYaml, repo *model.Repo, isMainBranch bool) error
type DiggerJobLinkStatus ¶
type DiggerJobLinkStatus int8
const ( DiggerJobLinkCreated DiggerJobLinkStatus = 1 DiggerJobLinkSucceeded DiggerJobLinkStatus = 2 )
type DiggerRunStatus ¶
type DiggerRunStatus string
const ( RunQueued DiggerRunStatus = "Queued" RunPendingPlan DiggerRunStatus = "Pending Plan" RunPlanning DiggerRunStatus = "Running Plan" RunPendingApproval DiggerRunStatus = "Pending Approval" RunApproved DiggerRunStatus = "Approved" RunPendingApply DiggerRunStatus = "Pending Apply" RunApplying DiggerRunStatus = "Running Apply" RunSucceeded DiggerRunStatus = "Succeeded" RunFailed DiggerRunStatus = "Failed" RunDiscarded DiggerRunStatus = "Discarded" )
type DiggerVCSType ¶
type DiggerVCSType string
const DiggerVCSGithub DiggerVCSType = "github"
const DiggerVCSGitlab DiggerVCSType = "gitlab"
type GithubAppInstallStatus ¶
type GithubAppInstallStatus int
const ( GithubAppInstallActive GithubAppInstallStatus = 1 GithubAppInstallDeleted GithubAppInstallStatus = 2 )
type GithubAppInstallationLinkStatus ¶
type GithubAppInstallationLinkStatus int8
const ( GithubAppInstallationLinkActive GithubAppInstallationLinkStatus = 1 GithubAppInstallationLinkInactive GithubAppInstallationLinkStatus = 2 )
type ProjectStatus ¶
type ProjectStatus int
const ( ProjectActive ProjectStatus = 1 ProjectInactive ProjectStatus = 2 )