Documentation
¶
Index ¶
- Constants
- Variables
- func ConnectDatabase()
- func GetStatusCheckForJob(job *DiggerJob) (string, error)
- type BillingPlan
- type Database
- func (db *Database) CreateCiJobFromSpec(spec spec.Spec, runName string, projectName string, batchId string) (*DiggerJob, error)
- func (db *Database) CreateDiggerBatch(vcsType DiggerVCSType, githubInstallationId int64, repoOwner string, ...) (*DiggerBatch, error)
- func (db *Database) CreateDiggerJob(batchId uuid.UUID, serializedJob []byte, workflowFile string) (*DiggerJob, error)
- func (db *Database) CreateDiggerJobLink(diggerJobId string, repoFullName string) (*GithubDiggerJobLink, error)
- func (db *Database) CreateDiggerJobParentLink(parentJobId string, jobId string) error
- func (db *Database) CreateDiggerJobToken(organisationId uint) (*JobToken, error)
- func (db *Database) CreateDiggerLock(resource string, lockId int, orgId uint) (*DiggerLock, error)
- func (db *Database) CreateDiggerRun(Triggertype string, PrNumber int, Status DiggerRunStatus, CommitId string, ...) (*DiggerRun, error)
- func (db *Database) CreateDiggerRunQueueItem(diggerRunId uint, projectId uint) (*DiggerRunQueueItem, error)
- func (db *Database) CreateDiggerRunStage(batchId string) (*DiggerRunStage, error)
- func (db *Database) CreateGithubAppInstallation(installationId int64, githubAppId int64, login string, accountId int, ...) (*GithubAppInstallation, error)
- func (db *Database) CreateGithubInstallationLink(org *Organisation, installationId int64) (*GithubAppInstallationLink, error)
- func (db *Database) CreateOrganisation(name string, externalSource string, tenantId string, adminEmail *string) (*Organisation, error)
- func (db *Database) CreateProject(name string, directory string, org *Organisation, repoFullName string, ...) (*Project, error)
- func (db *Database) CreateRepo(name string, repoFullName string, repoOrganisation string, repoName string, ...) (*Repo, error)
- func (db *Database) CreateUser(email string, externalSource string, externalId string, orgId uint, ...) (*User, error)
- func (db *Database) CreateVCSConnection(name string, vcsType DiggerVCSType, githubId int64, ClientID string, ...) (*VCSConnection, error)
- func (db *Database) DeleteAllLocksAcquiredByPR(prNumber int, repoFullName string, orgId uint) error
- func (db *Database) DeleteJobTokenArtefacts(jobTokenId uint) error
- func (db *Database) DequeueRunItem(queueItem *DiggerRunQueueItem) error
- func (db *Database) GetDefaultRepo(c *gin.Context, orgIdKey string) (*Repo, bool)
- func (db *Database) GetDiggerBatch(batchId *uuid.UUID) (*DiggerBatch, error)
- func (db *Database) GetDiggerBatchesForPR(repoFullName string, prNumber int) ([]DiggerBatch, error)
- func (db *Database) GetDiggerCiJob(diggerJobId string) (*DiggerJob, error)
- func (db *Database) GetDiggerJob(jobId string) (*DiggerJob, error)
- func (db *Database) GetDiggerJobFromRunStage(stage DiggerRunStage) (*DiggerJob, error)
- func (db *Database) GetDiggerJobLink(diggerJobId string) (*GithubDiggerJobLink, error)
- func (db *Database) GetDiggerJobParentLinksByParentId(parentId *string) ([]DiggerJobParentLink, error)
- func (db *Database) GetDiggerJobParentLinksChildId(childId *string) ([]DiggerJobParentLink, error)
- func (db *Database) GetDiggerJobsForBatch(batchId uuid.UUID) ([]DiggerJob, error)
- func (db *Database) GetDiggerJobsForBatchWithStatus(batchId uuid.UUID, status []scheduler.DiggerJobStatus) ([]DiggerJob, error)
- func (db *Database) GetDiggerJobsWithStatus(status scheduler.DiggerJobStatus) ([]DiggerJob, error)
- func (db *Database) GetDiggerLock(resource string) (*DiggerLock, error)
- func (db *Database) GetDiggerRun(id uint) (*DiggerRun, error)
- func (db *Database) GetDiggerRunQueueItem(id uint) (*DiggerRunQueueItem, error)
- func (db *Database) GetFirstRunQueueForEveryProject() ([]DiggerRunQueueItem, error)
- func (db *Database) GetGithubAppInstallationByIdAndRepo(installationId int64, repoFullName string) (*GithubAppInstallation, error)
- func (db *Database) GetGithubAppInstallationByOrgAndRepo(orgId any, repo string, status GithubAppInstallStatus) (*GithubAppInstallation, error)
- func (db *Database) GetGithubAppInstallationLink(installationId int64) (*GithubAppInstallationLink, error)
- func (db *Database) GetGithubAppInstallations(installationId int64) ([]GithubAppInstallation, error)
- func (db *Database) GetGithubInstallationLinkForInstallationId(installationId any) (*GithubAppInstallationLink, error)
- func (db *Database) GetGithubInstallationLinkForOrg(orgId any) (*GithubAppInstallationLink, error)
- func (db *Database) GetJobArtefact(jobTokenId uint) (*JobArtefact, error)
- func (db *Database) GetJobToken(tenantId any) (*JobToken, error)
- func (db *Database) GetJobsByRepoName(orgId uint, repoFullName string) ([]queries.JobQueryResult, error)
- func (db *Database) GetJobsCountThisMonth(orgID uint) (int64, error)
- func (db *Database) GetLastDiggerRunForProject(projectName string) (*DiggerRun, error)
- func (db *Database) GetLocksForOrg(orgId uint) ([]DiggerLock, error)
- func (db *Database) GetOrganisation(tenantId any) (*Organisation, error)
- func (db *Database) GetOrganisationById(orgId any) (*Organisation, error)
- func (db *Database) GetPendingParentDiggerJobs(batchId *uuid.UUID) ([]DiggerJob, error)
- func (db *Database) GetPoliciesFromContext(c *gin.Context, orgIdKey string) ([]Policy, bool)
- func (db *Database) GetPolicyByPolicyId(c *gin.Context, policyId uint, orgIdKey string) (*Policy, bool)
- func (db *Database) GetProject(projectId uint) (*Project, error)
- func (db *Database) GetProjectByName(orgId any, repoFullName string, name string) (*Project, error)
- func (db *Database) GetProjectByProjectId(c *gin.Context, projectId uint, orgIdKey string) (*Project, bool)
- func (db *Database) GetProjectByRepo(orgId any, repo *Repo) ([]Project, error)
- func (db *Database) GetProjectByRunId(c *gin.Context, runId uint, orgIdKey string) (*ProjectRun, bool)
- func (db *Database) GetProjectRunsForOrg(orgId int) ([]ProjectRun, error)
- func (db *Database) GetProjectRunsFromContext(c *gin.Context, orgIdKey string) ([]ProjectRun, bool)
- func (db *Database) GetProjectsFromContext(c *gin.Context, orgIdKey string) ([]Project, bool)
- func (db *Database) GetProjectsRemainingInFreePLan(orgId uint) (uint, uint, uint, error)
- func (db *Database) GetRepo(orgIdKey any, repoName string) (*Repo, error)
- func (db *Database) GetRepoByFullName(orgIdKey any, repoFullName string) (*Repo, error)
- func (db *Database) GetRepoById(orgIdKey any, repoId any) (*Repo, error)
- func (db *Database) GetRepoByInstallationIdAndRepoFullName(installationId int64, repoFullName string) (*Repo, error)
- func (db *Database) GetRepoCache(orgId uint, repoFullName string) (*RepoCache, error)
- func (db *Database) GetRepoCount(orgID uint) (int64, error)
- func (db *Database) GetReposFromContext(c *gin.Context, orgIdKey string) ([]Repo, bool)
- func (db *Database) GetSuccessfulJobsCountThisMonth(orgID uint) (int64, error)
- func (db *Database) GetToken(tenantId any) (*Token, error)
- func (d *Database) GetUserByEmail(email string) (*User, error)
- func (db *Database) GetVCSConnection(gitHubAppId any) (*VCSConnection, error)
- func (db *Database) GetVCSConnectionById(id string) (*VCSConnection, error)
- func (db *Database) GithubRepoAdded(installationId int64, appId int64, login string, accountId int64, ...) (*GithubAppInstallation, error)
- func (db *Database) GithubRepoRemoved(installationId int64, appId int64, repoFullName string) (*GithubAppInstallation, error)
- func (db *Database) ListDiggerRunsForProject(projectName string, repoId uint) ([]DiggerRun, error)
- func (db *Database) LoadProjectsForOrg(orgId uint) ([]*Project, error)
- func (db *Database) MakeGithubAppInstallationLinkInactive(link *GithubAppInstallationLink) (*GithubAppInstallationLink, error)
- func (db *Database) RefreshProjectsFromRepo(orgId string, config configuration.DiggerConfigYaml, repoFullName string) error
- func (db *Database) UpdateBatchStatus(batch *DiggerBatch) error
- func (db *Database) UpdateDiggerBatch(batch *DiggerBatch) error
- func (db *Database) UpdateDiggerJob(job *DiggerJob) error
- func (db *Database) UpdateDiggerJobLink(diggerJobId string, repoFullName string, githubJobId int64) (*GithubDiggerJobLink, error)
- func (db *Database) UpdateDiggerJobSummary(diggerJobId string, resourcesCreated uint, resourcesUpdated uint, ...) (*DiggerJob, error)
- func (db *Database) UpdateDiggerRun(diggerRun *DiggerRun) error
- func (db *Database) UpdateProject(project *Project) error
- func (db *Database) UpsertRepoCache(orgId uint, repoFullName string, diggerYmlStr string, ...) (*RepoCache, error)
- type DiggerBatch
- type DiggerJob
- type DiggerJobLinkStatus
- type DiggerJobParentLink
- type DiggerJobSummary
- type DiggerLock
- type DiggerRun
- type DiggerRunQueueItem
- type DiggerRunStage
- type DiggerRunStatus
- type DiggerVCSType
- type DriftStatus
- type GithubAppInstallStatus
- type GithubAppInstallation
- type GithubAppInstallationLink
- type GithubAppInstallationLinkStatus
- type GithubDiggerJobLink
- type JobArtefact
- type JobToken
- type Organisation
- type Policy
- type Project
- type ProjectRun
- type ProjectStatus
- type Repo
- type RepoCache
- type RunType
- type SerializedRunStage
- type Token
- type User
- type VCSConnection
Constants ¶
const ( AccessPolicyType = "access" AdminPolicyType = "admin" CliJobAccessType = "cli_access" )
const ( POLICY_TYPE_ACCESS = "access" POLICY_TYPE_PLAN = "plan" POLICY_TYPE_DRIFT = "drift" )
const MaxFreePlanProjectsPerOrg uint = 3
Variables ¶
var DEFAULT_ORG_NAME = "digger"
Functions ¶
func ConnectDatabase ¶
func ConnectDatabase()
func GetStatusCheckForJob ¶
Types ¶
type BillingPlan ¶
type BillingPlan string
const ( BillingPlanFree BillingPlan = "free" BillingPlanPro BillingPlan = "pro" BillingPlanPremium BillingPlan = "unlimited" // custom plan with unlimited resources )
type Database ¶
var DB *Database
var DB *gorm.DB
func (*Database) CreateCiJobFromSpec ¶
func (*Database) CreateDiggerBatch ¶
func (db *Database) CreateDiggerBatch(vcsType DiggerVCSType, githubInstallationId int64, repoOwner string, repoName string, repoFullname string, PRNumber int, diggerConfig string, branchName string, batchType scheduler.DiggerCommand, commentId *int64, gitlabProjectId int, aiSummaryCommentId string, reportTerraformOutputs bool, coverAllImpactedProjects bool, VCSConnectionId *uint) (*DiggerBatch, error)
func (*Database) CreateDiggerJob ¶
func (*Database) CreateDiggerJobLink ¶
func (db *Database) CreateDiggerJobLink(diggerJobId string, repoFullName string) (*GithubDiggerJobLink, error)
func (*Database) CreateDiggerJobParentLink ¶
func (*Database) CreateDiggerJobToken ¶
func (*Database) CreateDiggerLock ¶
func (*Database) CreateDiggerRun ¶
func (*Database) CreateDiggerRunQueueItem ¶
func (db *Database) CreateDiggerRunQueueItem(diggerRunId uint, projectId uint) (*DiggerRunQueueItem, error)
func (*Database) CreateDiggerRunStage ¶
func (db *Database) CreateDiggerRunStage(batchId string) (*DiggerRunStage, error)
func (*Database) CreateGithubAppInstallation ¶
func (*Database) CreateGithubInstallationLink ¶
func (db *Database) CreateGithubInstallationLink(org *Organisation, installationId int64) (*GithubAppInstallationLink, error)
func (*Database) CreateOrganisation ¶
func (*Database) CreateProject ¶
func (*Database) CreateRepo ¶
func (*Database) CreateUser ¶
func (*Database) CreateVCSConnection ¶
func (db *Database) CreateVCSConnection(name string, vcsType DiggerVCSType, githubId int64, ClientID string, ClientSecretEncrypted string, WebhookSecretEncrypted string, PrivateKeyEncrypted string, PrivateKeyBase64Encrypted string, Org string, url string, bitbucketAccessTokenEnc string, bitbucketWebhookSecretEnc string, gitlabWebhookSecret string, gitlabAccessToken string, orgId uint) (*VCSConnection, error)
func (*Database) DeleteAllLocksAcquiredByPR ¶
func (*Database) DeleteJobTokenArtefacts ¶
func (*Database) DequeueRunItem ¶
func (db *Database) DequeueRunItem(queueItem *DiggerRunQueueItem) error
func (*Database) GetDefaultRepo ¶
func (*Database) GetDiggerBatch ¶
func (db *Database) GetDiggerBatch(batchId *uuid.UUID) (*DiggerBatch, error)
func (*Database) GetDiggerBatchesForPR ¶
func (db *Database) GetDiggerBatchesForPR(repoFullName string, prNumber int) ([]DiggerBatch, error)
func (*Database) GetDiggerCiJob ¶
func (*Database) GetDiggerJobFromRunStage ¶
func (db *Database) GetDiggerJobFromRunStage(stage DiggerRunStage) (*DiggerJob, error)
func (*Database) GetDiggerJobLink ¶
func (db *Database) GetDiggerJobLink(diggerJobId string) (*GithubDiggerJobLink, error)
func (*Database) GetDiggerJobParentLinksByParentId ¶
func (db *Database) GetDiggerJobParentLinksByParentId(parentId *string) ([]DiggerJobParentLink, error)
func (*Database) GetDiggerJobParentLinksChildId ¶
func (db *Database) GetDiggerJobParentLinksChildId(childId *string) ([]DiggerJobParentLink, error)
func (*Database) GetDiggerJobsForBatch ¶
func (*Database) GetDiggerJobsForBatchWithStatus ¶
func (*Database) GetDiggerJobsWithStatus ¶
func (db *Database) GetDiggerJobsWithStatus(status scheduler.DiggerJobStatus) ([]DiggerJob, error)
func (*Database) GetDiggerLock ¶
func (db *Database) GetDiggerLock(resource string) (*DiggerLock, error)
func (*Database) GetDiggerRunQueueItem ¶
func (db *Database) GetDiggerRunQueueItem(id uint) (*DiggerRunQueueItem, error)
func (*Database) GetFirstRunQueueForEveryProject ¶
func (db *Database) GetFirstRunQueueForEveryProject() ([]DiggerRunQueueItem, error)
func (*Database) GetGithubAppInstallationByIdAndRepo ¶
func (db *Database) GetGithubAppInstallationByIdAndRepo(installationId int64, repoFullName string) (*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) (*GithubAppInstallation, error)
func (*Database) GetGithubAppInstallationLink ¶
func (db *Database) GetGithubAppInstallationLink(installationId int64) (*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) ([]GithubAppInstallation, error)
func (*Database) GetGithubInstallationLinkForInstallationId ¶
func (db *Database) GetGithubInstallationLinkForInstallationId(installationId any) (*GithubAppInstallationLink, error)
func (*Database) GetGithubInstallationLinkForOrg ¶
func (db *Database) GetGithubInstallationLinkForOrg(orgId any) (*GithubAppInstallationLink, error)
func (*Database) GetJobArtefact ¶
func (db *Database) GetJobArtefact(jobTokenId uint) (*JobArtefact, error)
func (*Database) GetJobsByRepoName ¶
func (*Database) GetJobsCountThisMonth ¶
func (*Database) GetLastDiggerRunForProject ¶
func (*Database) GetLocksForOrg ¶
func (db *Database) GetLocksForOrg(orgId uint) ([]DiggerLock, error)
func (*Database) GetOrganisation ¶
func (db *Database) GetOrganisation(tenantId any) (*Organisation, error)
func (*Database) GetOrganisationById ¶
func (db *Database) GetOrganisationById(orgId any) (*Organisation, error)
func (*Database) GetPendingParentDiggerJobs ¶
func (*Database) GetPoliciesFromContext ¶
func (*Database) GetPolicyByPolicyId ¶
func (*Database) GetProjectByName ¶
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) GetProjectByRunId ¶
func (*Database) GetProjectRunsForOrg ¶
func (db *Database) GetProjectRunsForOrg(orgId int) ([]ProjectRun, error)
func (*Database) GetProjectRunsFromContext ¶
func (*Database) GetProjectsFromContext ¶
func (*Database) GetProjectsRemainingInFreePLan ¶
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) GetRepoById ¶
GetRepoById returns digger repo by organisationId and repo name (diggerhq-digger)
func (*Database) GetRepoByInstallationIdAndRepoFullName ¶
func (db *Database) GetRepoByInstallationIdAndRepoFullName(installationId int64, repoFullName string) (*Repo, error)
GetGithubAppInstallationByIdAndRepo repoFullName should be in the following format: org/repo_name, for example "diggerhq/github-job-scheduler"
func (*Database) GetRepoCache ¶
func (*Database) GetReposFromContext ¶
func (*Database) GetSuccessfulJobsCountThisMonth ¶
func (*Database) GetVCSConnection ¶
func (db *Database) GetVCSConnection(gitHubAppId any) (*VCSConnection, error)
GetGithubApp return GithubApp by Id
func (*Database) GetVCSConnectionById ¶
func (db *Database) GetVCSConnectionById(id string) (*VCSConnection, error)
func (*Database) GithubRepoAdded ¶
func (db *Database) GithubRepoAdded(installationId int64, appId int64, login string, accountId int64, repoFullName string) (*GithubAppInstallation, error)
GithubRepoAdded handles github drift that github repo has been added to the app installation
func (*Database) GithubRepoRemoved ¶
func (*Database) ListDiggerRunsForProject ¶
func (*Database) LoadProjectsForOrg ¶
func (*Database) MakeGithubAppInstallationLinkInactive ¶
func (db *Database) MakeGithubAppInstallationLinkInactive(link *GithubAppInstallationLink) (*GithubAppInstallationLink, error)
func (*Database) RefreshProjectsFromRepo ¶
func (db *Database) RefreshProjectsFromRepo(orgId string, config configuration.DiggerConfigYaml, repoFullName string) error
func (*Database) UpdateBatchStatus ¶
func (db *Database) UpdateBatchStatus(batch *DiggerBatch) error
func (*Database) UpdateDiggerBatch ¶
func (db *Database) UpdateDiggerBatch(batch *DiggerBatch) error
func (*Database) UpdateDiggerJob ¶
func (*Database) UpdateDiggerJobLink ¶
func (*Database) UpdateDiggerJobSummary ¶
func (*Database) UpdateDiggerRun ¶
func (*Database) UpdateProject ¶
func (*Database) UpsertRepoCache ¶
func (db *Database) UpsertRepoCache(orgId uint, repoFullName string, diggerYmlStr string, diggerConfig configuration.DiggerConfig, newAtlantisConfig *tac.AtlantisConfig) (*RepoCache, error)
type DiggerBatch ¶
type DiggerBatch struct {
gorm.Model
ID uuid.UUID `gorm:"primary_key"`
Layer uint
VCS DiggerVCSType
PrNumber int
CommentId *int64
AiSummaryCommentId string
Status orchestrator_scheduler.DiggerBatchStatus
BranchName string
DiggerConfig string
GithubInstallationId int64
GitlabProjectId int
RepoFullName string
RepoOwner string
RepoName string
BatchType orchestrator_scheduler.DiggerCommand
ReportTerraformOutputs bool
CoverAllImpactedProjects bool
// used for module source grouping comments
SourceDetails []byte
VCSConnectionId *uint ``
VCSConnection VCSConnection
}
func (*DiggerBatch) MapToJsonStruct ¶
func (b *DiggerBatch) MapToJsonStruct() (orchestrator_scheduler.SerializedBatch, error)
type DiggerJob ¶
type DiggerJob struct {
gorm.Model
DiggerJobID string `gorm:"size:50,index:idx_digger_job_id"`
Status orchestrator_scheduler.DiggerJobStatus `gorm:"index:idx_digger_jobs_status"`
RunName string
ProjectName string
Batch *DiggerBatch
BatchID *string `gorm:"index:idx_digger_job_id"`
PRCommentUrl string
PRCommentId *int64
DiggerJobSummary DiggerJobSummary
DiggerJobSummaryID uint
SerializedJobSpec []byte
SerializedReporterSpec []byte
SerializedCommentUpdaterSpec []byte
SerializedLockSpec []byte
SerializedBackendSpec []byte
SerializedVcsSpec []byte
SerializedPolicySpec []byte
SerializedVariablesSpec []byte
TerraformOutput string
// represents a footprint of terraform plan json for similarity checks
PlanFootprint []byte
WorkflowFile string
WorkflowRunUrl *string
StatusUpdatedAt time.Time
}
func (*DiggerJob) MapToJsonStruct ¶
func (j *DiggerJob) MapToJsonStruct() (orchestrator_scheduler.SerializedJob, error)
type DiggerJobLinkStatus ¶
type DiggerJobLinkStatus int8
const ( DiggerJobLinkCreated DiggerJobLinkStatus = 1 DiggerJobLinkSucceeded DiggerJobLinkStatus = 2 )
type DiggerJobParentLink ¶
type DiggerJobSummary ¶
type DiggerLock ¶
type DiggerRun ¶
type DiggerRun struct {
gorm.Model
Triggertype string // pr_merge, manual_invocation, push_to_trunk
PrNumber *int
Status DiggerRunStatus
CommitId string
DiggerConfig string
GithubInstallationId int64
RepoId uint
Repo *Repo
ProjectName string
RunType RunType
PlanStage DiggerRunStage
PlanStageId *uint
ApplyStage DiggerRunStage
ApplyStageId *uint
IsApproved bool
ApprovalAuthor string
ApprovalDate time.Time
}
func (*DiggerRun) MapToJsonStruct ¶
type DiggerRunQueueItem ¶
type DiggerRunStage ¶
type DiggerRunStage struct {
gorm.Model
Batch *DiggerBatch
BatchID *string `gorm:"index:idx_digger_run_batch_id"`
}
func (DiggerRunStage) MapToJsonStruct ¶
func (r DiggerRunStage) MapToJsonStruct() (*SerializedRunStage, error)
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" )
type DiggerVCSType ¶
type DiggerVCSType string
const DiggerVCSBitbucket DiggerVCSType = "bitbucket"
const DiggerVCSGithub DiggerVCSType = "github"
const DiggerVCSGitlab DiggerVCSType = "gitlab"
type DriftStatus ¶
type DriftStatus string
const DriftStatusAcknowledgeDrift DriftStatus = "acknowledged drift"
const DriftStatusNewDrift DriftStatus = "new drift"
const DriftStatusNoDrift DriftStatus = "no drift"
type GithubAppInstallStatus ¶
type GithubAppInstallStatus int
const ( GithubAppInstallActive GithubAppInstallStatus = 1 GithubAppInstallDeleted GithubAppInstallStatus = 2 )
type GithubAppInstallation ¶
type GithubAppInstallationLink ¶
type GithubAppInstallationLink struct {
gorm.Model
GithubInstallationId int64 `gorm:"index:idx_github_installation_org"`
OrganisationId uint `gorm:"index:idx_github_installation_org"`
Organisation *Organisation
Status GithubAppInstallationLinkStatus
}
GithubAppInstallationLink links GitHub App installation Id to Digger's organisation Id
type GithubAppInstallationLinkStatus ¶
type GithubAppInstallationLinkStatus int8
const ( GithubAppInstallationLinkActive GithubAppInstallationLinkStatus = 1 GithubAppInstallationLinkInactive GithubAppInstallationLinkStatus = 2 )
type GithubDiggerJobLink ¶
type GithubDiggerJobLink struct {
gorm.Model
DiggerJobId string `gorm:"size:50,index:idx_digger_job_id"`
RepoFullName string
GithubJobId int64 `gorm:"index:idx_github_job_id"`
GithubWorkflowRunId int64
Status DiggerJobLinkStatus
}
GithubDiggerJobLink links GitHub Workflow Job id to Digger's Job Id
type JobArtefact ¶
type JobToken ¶
type JobToken struct {
gorm.Model
Value string `gorm:"uniqueJobTokenIndex:idx_token"`
Expiry time.Time
OrganisationID uint
Organisation Organisation
Type string // AccessTokenType starts with j:
}
These tokens will be pre
type Organisation ¶
type Organisation struct {
gorm.Model
Name string `gorm:"Index:idx_organisation"`
ExternalSource string `gorm:"uniqueIndex:idx_external_source"`
ExternalId string `gorm:"uniqueIndex:idx_external_source"`
DriftEnabled bool `gorm:"default:false"`
DriftWebhookUrl string
DriftCronTab string `gorm:"default:'0 0 * * *'"`
BillingPlan BillingPlan `gorm:"default:'free'"`
BillingStripeSubscriptionId string
SlackConnectChannelName *string
AdminEmail *string
}
type Project ¶
type Project struct {
gorm.Model
Name string `gorm:"uniqueIndex:idx_project_org"`
Directory string
OrganisationID uint `gorm:"uniqueIndex:idx_project_org"`
Organisation *Organisation
RepoFullName string `gorm:"uniqueIndex:idx_project_org"`
DriftEnabled bool `gorm:"default:false"`
DriftStatus DriftStatus `gorm:"default:'no drift'"`
LatestDriftCheck time.Time
DriftTerraformPlan string
DriftToCreate uint
DriftToUpdate uint
DriftToDelete uint
Status ProjectStatus
IsGenerated bool
IsInMainBranch bool
}
func (*Project) MapToJsonStruct ¶
func (p *Project) MapToJsonStruct() interface{}
type ProjectRun ¶
type ProjectRun struct {
gorm.Model
ProjectID uint
Project *Project
StartedAt int64
EndedAt int64
Status string
Command string
Output string
ActorUsername string
}
func (*ProjectRun) MapToJsonStruct ¶
func (p *ProjectRun) MapToJsonStruct() interface{}
type ProjectStatus ¶
type ProjectStatus int
const ( ProjectActive ProjectStatus = 1 ProjectInactive ProjectStatus = 2 )
type Repo ¶
type Repo struct {
gorm.Model
Name string `gorm:"uniqueIndex:idx_org_repo"`
RepoFullName string
RepoOrganisation string
RepoName string
RepoUrl string
VCS DiggerVCSType `gorm:"default:'github'"`
OrganisationID uint `gorm:"uniqueIndex:idx_org_repo"`
Organisation *Organisation
DiggerConfig string
GithubAppInstallationId int64
GithubAppId int64
DefaultBranch string
CloneUrl string
}
func (*Repo) MapToJsonStruct ¶
func (r *Repo) MapToJsonStruct() interface{}
type RepoCache ¶
type RepoCache struct {
gorm.Model
OrgId uint
RepoFullName string
DiggerYmlStr string
DiggerConfig []byte `gorm:"type:bytea"`
TerragruntAtlantisConfig []byte `gorm:"type:bytea"`
}
storing repo cache such as digger.yml configuration
type SerializedRunStage ¶
type SerializedRunStage struct {
//DiggerRunId uint `json:"digger_run_id"`
DiggerJobId string `json:"digger_job_id"`
Status orchestrator_scheduler.DiggerJobStatus `json:"status"`
ProjectName string `json:"project_name"`
WorkflowRunUrl *string `json:"workflow_run_url"`
ResourcesCreated uint `json:"resources_created"`
ResourcesDeleted uint `json:"resources_deleted"`
ResourcesUpdated uint `json:"resources_updated"`
LastActivityTimeStamp string `json:"last_activity_timestamp"`
}
type User ¶
type User struct {
gorm.Model
Email string `gorm:"uniqueIndex"`
ExternalSource string `gorm:"uniqueIndex:idx_user_external_source"`
ExternalId string `gorm:"uniqueIndex:idx_user_external_source"`
// the default org currently in use by this user
OrganisationId *uint
Organisation Organisation
Username string `gorm:"uniqueIndex:idx_user"`
}
type VCSConnection ¶
type VCSConnection struct {
gorm.Model
GithubId int64 // app id
ClientID string
ClientSecretEncrypted string
WebhookSecretEncrypted string
PrivateKeyEncrypted string
PrivateKeyBase64Encrypted string
Org string
Name string
GithubAppUrl string
BitbucketAccessTokenEncrypted string
BitbucketWebhookSecretEncrypted string
GitlabAccessTokenEncrypted string
GitlabWebhookSecretEncrypted string
VCSType DiggerVCSType `gorm:"default:bitbucket"`
OrganisationID uint
Organisation Organisation
}
func (VCSConnection) TableName ¶
func (VCSConnection) TableName() string
TODO: Create migration to rename this table to vcs_connections for some reason atlas wants to destroy and recreate and I did not have time to look into it