Documentation
¶
Overview ¶
Package types defines common data structures.
Package types defines common data structures.
Package types defines common data structures.
Package types defines common data structures.
Package types defines common data structures.
Index ¶
- Constants
- Variables
- func ValidateAssetKind(kind AssetKind) error
- type AIConfig
- type AIExtConfig
- type AILastUsedMsg
- type AIRequest
- type AnalyseExecutionInput
- type AnalyseExecutionOutput
- type ArtifactAsset
- type ArtifactAssetExtendBlob
- type ArtifactAssetsRes
- type ArtifactBlob
- type ArtifactFilter
- type ArtifactFormat
- type ArtifactGarbageReportRes
- type ArtifactListItem
- type ArtifactMetaAsset
- type ArtifactNodeInfo
- type ArtifactNodeRemoveReport
- type ArtifactNodeRemoveRes
- type ArtifactPackage
- type ArtifactPackageCapacityRes
- type ArtifactPkgVerMetadata
- type ArtifactRecycleBlobDesc
- type ArtifactRepository
- type ArtifactRepositoryRes
- type ArtifactStatisticReport
- type ArtifactStatisticResponse
- type ArtifactStatus
- type ArtifactTreeFilter
- type ArtifactTreeNode
- type ArtifactTreeNodeId
- type ArtifactTreeNodeMeta
- type ArtifactTreeNodeType
- type ArtifactTreeRes
- type ArtifactVersion
- type ArtifactVersionCapacityDesc
- type ArtifactVersionCapacityRes
- type ArtifactVersionFilter
- type ArtifactVersionInfo
- type ArtifactVersionsRes
- type ArtifactView
- type AssetKind
- type AssignableLabelFilter
- type BasicAuthCreds
- type BearerTokenCreds
- type Branch
- type BranchExtended
- type BranchFilter
- type BranchMetadataOptions
- type ChangeStats
- type Check
- type CheckCountSummary
- type CheckListOptions
- type CheckPayload
- type CheckPayloadInternal
- type CheckPayloadText
- type CheckRecentOptions
- type CheckResult
- type CheckSumRes
- type CodeComment
- type CodeCommentFields
- type CodeOwnerEvaluation
- type CodeOwnerEvaluationEntry
- type CodeOwnersValidation
- type CodeOwnersViolation
- type CodeRepo
- type Commit
- type CommitCount
- type CommitCountData
- type CommitDivergence
- type CommitFileStats
- type CommitFilesResponse
- type CommitFilter
- type CommitStats
- type Config
- type Connector
- type ConnectorAuth
- type ConnectorConfig
- type ConnectorTestResponse
- type CreateBranchOutput
- type CreatedFilter
- type DefineLabelInput
- type DefineValueInput
- type DeleteBranchOutput
- type DevcontainerConfig
- type DiffStats
- type DryRunRulesOutput
- type EditedFilter
- type Execution
- type ExecutionInfo
- type FileMatch
- type Fragment
- type GithookInputBase
- type GithookPostReceiveInput
- type GithookPreReceiveInput
- type GithookUpdateInput
- type GithubConnectorData
- type GitspaceConfig
- type GitspaceEvent
- type GitspaceEventFilter
- type GitspaceEventResponse
- type GitspaceFilter
- type GitspaceInstance
- type GitspacePort
- type GitspaceUser
- type Identity
- type InfraProviderConfig
- type InfraProviderParameter
- type InfraProviderParameterSchema
- type InfraProviderResource
- type InfraProviderTemplate
- type InfraProvisioned
- type InfraProvisionedGatewayView
- type InfraProvisionedUpdateGatewayRequest
- type Infrastructure
- type JobUIDResponse
- type Label
- type LabelAssignment
- type LabelFilter
- type LabelInfo
- type LabelPullReqAssignmentInfo
- type LabelValue
- type LabelValueInfo
- type LabelWithValues
- type ListCommitResponse
- type ListExecutionsFilter
- type ListPipelinesFilter
- type ListQueryFilter
- type Match
- type Membership
- type MembershipKey
- type MembershipSpace
- type MembershipSpaceFilter
- type MembershipUser
- type MembershipUserFilter
- type MergeResponse
- type MergeViolations
- type OwnerEvaluation
- type Pagination
- type PaginationFilter
- type PermissionCheck
- type Pipeline
- type Plugin
- type PortMapping
- type Principal
- type PrincipalFilter
- type PrincipalInfo
- type PublicKey
- type PublicKeyFilter
- type PullReq
- type PullReqActivity
- func (a *PullReqActivity) AsCodeComment() *CodeComment
- func (a *PullReqActivity) GetPayload() (PullReqActivityPayload, error)
- func (a *PullReqActivity) IsBlocking() bool
- func (a *PullReqActivity) IsReply() bool
- func (a *PullReqActivity) IsReplyable() bool
- func (a *PullReqActivity) IsValidCodeComment() bool
- func (a *PullReqActivity) SetPayload(payload PullReqActivityPayload) error
- func (a *PullReqActivity) UpdateMetadata(updates ...PullReqActivityMetadataUpdate)
- type PullReqActivityFilter
- type PullReqActivityMentionsMetadata
- type PullReqActivityMetadata
- type PullReqActivityMetadataUpdate
- func WithPullReqActivityMentionsMetadataUpdate(f func(m *PullReqActivityMentionsMetadata)) PullReqActivityMetadataUpdate
- func WithPullReqActivityMetadataUpdate(f func(m *PullReqActivityMetadata)) PullReqActivityMetadataUpdate
- func WithPullReqActivitySuggestionsMetadataUpdate(f func(m *PullReqActivitySuggestionsMetadata)) PullReqActivityMetadataUpdate
- type PullReqActivityPayload
- type PullReqActivitySuggestionsMetadata
- type PullReqCheck
- type PullReqChecks
- type PullReqCreateInput
- type PullReqFileView
- type PullReqFilter
- type PullReqLabel
- type PullReqMetadataOptions
- type PullReqRepo
- type PullReqReview
- type PullReqReviewer
- type PullReqStats
- type PullReqSummary
- type PullReqSummaryFilter
- type PullReqUpdateInput
- type PullRequestActivityLabel
- type PullRequestActivityPayloadBranchDelete
- type PullRequestActivityPayloadBranchRestore
- type PullRequestActivityPayloadBranchUpdate
- type PullRequestActivityPayloadCodeComment
- type PullRequestActivityPayloadComment
- type PullRequestActivityPayloadMerge
- type PullRequestActivityPayloadReviewSubmit
- type PullRequestActivityPayloadReviewerAdd
- type PullRequestActivityPayloadReviewerDelete
- type PullRequestActivityPayloadStateChange
- type PullRequestActivityPayloadTitleChange
- type RebaseResponse
- type RenameDetails
- type RepoActiveInput
- type RepoActiveOutput
- type RepoCodeFrequencyOutput
- type RepoCommitUsersOutput
- type RepoCommitsInput
- type RepoCommitsOutput
- type RepoFilter
- type RepoTop10Output
- type Repository
- type RepositoryCount
- type RepositoryGitInfo
- type RepositoryMirror
- type RepositoryPullReqSummary
- type RepositorySizeInfo
- type RepositoryStatistics
- type RepositoryStatisticsFilter
- type RepositorySummary
- type Resource
- type Rule
- type RuleFilter
- type RuleInfo
- type RuleInfoInternal
- type RuleType
- type RuleViolations
- type RulesViolations
- type SaveInput
- type SaveLabelInput
- type SaveLabelValueInput
- type Scope
- type ScopeData
- type ScopesLabels
- type SearchAssetOption
- type SearchInput
- type SearchResult
- type SearchStats
- type SearchVersionOption
- type Secret
- type SecretRef
- type Service
- type ServiceAccount
- type ServiceAccountInput
- type Signature
- type Space
- type SpaceFilter
- type SpaceParentData
- type SpacePath
- type SpacePathSegment
- type SquashResponse
- type Stage
- type StatisticsCodeFrequencyStat
- type StatisticsCommitStat
- type Step
- type StorageProviderType
- type Stream
- type SystemCommitsInput
- type SystemCommitsOutput
- type TagFilter
- type Template
- type TimeRangeInput
- type Token
- type TokenResponse
- type Trigger
- type UpdateLabelInput
- type UpdateValueInput
- type UpdatedFilter
- type User
- type UserCodeFrequencyInput
- type UserCodeFrequencyOutput
- type UserFilter
- type UserGroup
- type UserGroupInfo
- type UserGroupOwnerEvaluation
- type UserGroupReviewer
- type UserGroupReviewerDecision
- type UserInput
- type Violation
- type Webhook
- type WebhookCreateInput
- type WebhookExecution
- type WebhookExecutionFilter
- type WebhookExecutionRequest
- type WebhookExecutionResponse
- type WebhookFilter
- type WebhookParentInfo
- type WebhookUpdateInput
Constants ¶
const ( ArtifactNodeRoot = "/" ArtifactNodeLevelAsset = "asset" ArtifactNodeLevelVersion = "version" )
const ( UserAgentPipeline = "gitfox/pipeline" UserAgentFitPrefix = "fit" )
const ( PathSeparatorAsString = string(PathSeparator) PathSeparator = '/' )
const AnonymousPrincipalUID = "anonymous"
AnonymousPrincipalUID is an internal UID for anonymous principals.
const NilSHA = "0000000000000000000000000000000000000000"
Variables ¶
var ( ErrPkgNotFound = errors.New("artifact package not found") ErrPkgNoItemDeleted = errors.New("no artifact package was deleted") ErrPkgVersionNotFound = errors.New("artifact package version not found") ErrPkgVersionNoItemDeleted = errors.New("no artifact package was deleted") ErrAssetNotFound = errors.New("artifact asset not found") ErrAssetNoItemDeleted = errors.New("no artifact asset was deleted") ErrMetaAssetNotFound = errors.New("artifact meta asset not found") ErrMetaAssetNoItemDeleted = errors.New("no artifact meta asset was deleted") ErrBlobNotFound = errors.New("artifact blob not found") ErrBlobNoItemDeleted = errors.New("no artifact blob was deleted") ErrViewDefaultNotFound = errors.New("default view not found") ErrViewNotFound = errors.New("special view not found") ErrArgsValueEmpty = errors.New("args value should not empty") )
var AllArtifactFormatList = []ArtifactFormat{ArtifactRawFormat, ArtifactMavenFormat, ArtifactContainerFormat, ArtifactHelmFormat}
var ( // ErrNoPayload is returned in case the activity doesn't have any payload set. ErrNoPayload = errors.New("activity has no payload") )
Functions ¶
func ValidateAssetKind ¶
Types ¶
type AIConfig ¶
type AIConfig struct {
ID int64 `json:"id"`
SpaceID int64 `json:"space_id"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
CreatedBy int64 `json:"created_by"`
UpdatedBy int64 `json:"updated_by,omitempty"`
IsDefault bool `json:"is_default"`
Provider enum.Provider `json:"provider"`
Model string `json:"model"`
Endpoint string `json:"endpoint"`
Token string `json:"-"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
AIExtConfig
// 最近使用消息
AILastUsedMsg
}
type AIExtConfig ¶
type AIExtConfig struct {
OrgID string `json:"org_id,omitempty"`
Proxy string `json:"proxy,omitempty"`
Socks string `json:"socks,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
TopP float64 `json:"top_p,omitempty"`
FrequencyPenalty float64 `json:"frequency_penalty,omitempty"`
PresencePenalty float64 `json:"presence_penalty,omitempty"`
SkipVerify bool `json:"skip_verify,omitempty"`
Headers []string `json:"headers,omitempty"`
APIVersion string `json:"api_version,omitempty"`
}
type AILastUsedMsg ¶
type AILastUsedMsg struct {
Status enum.AIReqStatus `json:"status"`
Error string `json:"error,omitempty"`
RequestTime int64 `json:"request_time"`
}
type AIRequest ¶
type AIRequest struct {
Created int64 `json:"created"`
Updated int64 `json:"updated"`
RepoID int64 `json:"repo_id"`
PullReqID int64 `json:"pull_req_id"`
ConfigID int64 `json:"-"`
Token int64 `json:"token"`
Duration int64 `json:"duration"`
Status enum.AIReqStatus `json:"status"`
Error string `json:"error,omitempty"`
ClientMode bool `json:"-"`
ReviewMessage string `json:"review_message,omitempty"`
ReviewStatus enum.AIRequestReviewStatus `json:"review_status,omitempty"`
ReviewSHA string `json:"sha,omitempty"`
}
type AnalyseExecutionInput ¶
type AnalyseExecutionOutput ¶
type ArtifactAsset ¶
type ArtifactAsset struct {
ID int64 `gorm:"column:asset_id;primaryKey"`
// VersionID binding with package(with format), view
VersionID null.Int `gorm:"column:asset_version_id;"`
// ViewID used for none-version assets, like index file for a format
ViewID null.Int `gorm:"column:asset_view_id"`
// Format is also used for none-version assets
Format ArtifactFormat `gorm:"column:asset_format"`
Path string `gorm:"column:asset_path"`
ContentType string `gorm:"column:asset_content_type"`
Kind AssetKind `gorm:"column:asset_kind"`
// Metadata store asset-level metadata. example: helm chart metadata, for rebuild index
Metadata string `gorm:"column:asset_metadata"`
BlobID int64 `gorm:"column:asset_blob_id"`
CheckSum string `gorm:"column:asset_checksum"`
Created int64 `gorm:"column:asset_created;autoCreateTime:milli" json:"created"`
Updated int64 `gorm:"column:asset_updated;autoUpdateTime:milli" json:"updated"`
Deleted int64 `gorm:"column:asset_deleted"`
}
type ArtifactAssetExtendBlob ¶
type ArtifactAssetExtendBlob struct {
ArtifactAsset
BlobID int64 `gorm:"column:blob_id"`
StorageID int64 `gorm:"column:storage_id"`
Ref string `gorm:"column:blob_ref"`
Size int64 `gorm:"column:blob_size"`
}
type ArtifactAssetsRes ¶
type ArtifactAssetsRes struct {
Id int64 `gorm:"column:asset_id"`
Path string `gorm:"column:asset_path" json:"path"`
ContentType string `gorm:"column:asset_content_type" json:"content_type"`
Size int64 `gorm:"column:blob_size" json:"size"`
CreatorName string `gorm:"column:principal_uid_unique" json:"creator_name"`
CheckSumString string `gorm:"column:asset_checksum" json:"-"`
Created int64 `gorm:"column:asset_created" json:"created"`
Updated int64 `gorm:"column:blob_created" json:"updated"`
CheckSum *CheckSumRes `gorm:"-" json:"checksum"`
Link string `gorm:"-" json:"link"`
}
type ArtifactBlob ¶
type ArtifactBlob struct {
ID int64 `gorm:"column:blob_id;primaryKey"`
StorageID int64 `gorm:"column:storage_id"`
Ref string `gorm:"column:blob_ref"`
Size int64 `gorm:"column:blob_size"`
Downloads int64 `gorm:"column:blob_downloads"`
// Metadata store file-level metadata. example: container upload progress hash state
Metadata string `gorm:"column:blob_metadata"`
Deleted null.Int `gorm:"column:blob_deleted"`
Created int64 `gorm:"column:blob_created;autoCreateTime:milli" json:"created"`
Creator int64 `gorm:"column:blob_creator"`
}
type ArtifactFilter ¶
type ArtifactFilter struct {
Page int `json:"page"`
Size int `json:"size"`
Query string `json:"query"`
Format string `json:"format"`
Sort enum.SpaceAttr `json:"sort"`
Order enum.Order `json:"order"`
}
ArtifactFilter define artifacts query parameters.
type ArtifactFormat ¶
type ArtifactFormat string
const ( ArtifactAllFormat ArtifactFormat = "all" ArtifactRawFormat ArtifactFormat = "raw" ArtifactMavenFormat ArtifactFormat = "maven" ArtifactContainerFormat ArtifactFormat = "container" ArtifactHelmFormat ArtifactFormat = "helm" ArtifactPypiFormat ArtifactFormat = "pypi" ArtifactNpmFormat ArtifactFormat = "npm" )
type ArtifactListItem ¶
type ArtifactListItem struct {
Format string `gorm:"column:package_format" json:"format"`
Name string `gorm:"column:package_name" json:"name"`
Namespace string `gorm:"column:package_namespace" json:"namespace"`
DisplayName string `gorm:"-" json:"display_name"`
Version string `gorm:"column:version" json:"version"`
UpdateTime int64 `gorm:"column:version_updated" json:"update_time"`
}
type ArtifactMetaAsset ¶
type ArtifactMetaAsset struct {
ID int64 `gorm:"column:meta_asset_id;primaryKey"`
OwnerID int64 `gorm:"column:meta_asset_owner_id"` // to be removed
Format ArtifactFormat `gorm:"column:meta_asset_format"`
Path string `gorm:"column:meta_asset_path"`
ViewID int64 `gorm:"column:meta_asset_view_id"`
ContentType string `gorm:"column:meta_asset_content_type"`
Kind AssetKind `gorm:"column:meta_asset_kind"`
BlobID int64 `gorm:"column:meta_asset_blob_id"`
CheckSum string `gorm:"column:meta_asset_checksum"`
Created int64 `gorm:"column:meta_asset_created;autoCreateTime:milli" json:"created"`
Updated int64 `gorm:"column:meta_asset_updated;autoUpdateTime:milli" json:"updated"`
}
type ArtifactNodeInfo ¶
type ArtifactNodeInfo struct {
Status string `json:"status"`
Format ArtifactFormat `json:"format"`
Metadata *ArtifactPkgVerMetadata `json:"metadata"`
Path string `json:"path"`
ContentType string `json:"content_type"`
Size int64 `json:"size"`
CreatorName string `json:"creator_name"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Link string `json:"link"`
CheckSum *CheckSumRes `json:"checksum"`
}
type ArtifactNodeRemoveReport ¶
type ArtifactNodeRemoveReport struct {
Total int `json:"total"`
Success int `json:"success"`
Failed int `json:"failed"`
Data []*ArtifactNodeRemoveRes `json:"data"`
}
type ArtifactNodeRemoveRes ¶
type ArtifactNodeRemoveRes struct {
NodeId string `json:"node_id"`
Status ArtifactStatus `json:"status"`
Packages int `json:"packages,omitempty"`
Versions int `json:"versions,omitempty"`
Assets int `json:"assets,omitempty"`
}
type ArtifactPackage ¶
type ArtifactPackage struct {
ID int64 `gorm:"column:package_id;primaryKey" json:"id"`
OwnerID int64 `gorm:"column:package_owner_id" json:"owner_id"`
Name string `gorm:"column:package_name" json:"name"`
Namespace string `gorm:"column:package_namespace" json:"namespace"`
Format ArtifactFormat `gorm:"column:package_format" json:"format"`
Created int64 `gorm:"column:package_created;autoCreateTime:milli" json:"created"`
Updated int64 `gorm:"column:package_updated;autoUpdateTime:milli" json:"updated"`
Deleted int64 `gorm:"column:package_deleted"`
}
func (*ArtifactPackage) IsDeleted ¶
func (p *ArtifactPackage) IsDeleted() bool
type ArtifactPackageCapacityRes ¶
type ArtifactPackageCapacityRes struct {
Space string `json:"space"`
Name string `json:"name"`
Namespace string `json:"namespace"`
Format ArtifactFormat `json:"format"`
Size int64 `json:"size"`
ExclusiveSize int64 `json:"exclusive_size"`
Versions []ArtifactVersionCapacityRes `json:"versions"`
}
type ArtifactPkgVerMetadata ¶
type ArtifactRecycleBlobDesc ¶
type ArtifactRepository ¶
type ArtifactRepository struct {
ID int64 `gorm:"column:repo_id;primaryKey" json:"-"`
Identifier string `gorm:"column:repo_identifier" json:"identifier"`
Description string `gorm:"column:repo_description" json:"description"`
DisplayName string `gorm:"column:repo_display_name" json:"display_name"`
Kind enum.ArtifactRepoKind `gorm:"column:repo_kind" json:"kind"`
RefID null.Int `gorm:"column:repo_ref_id" json:"-"`
CreatedBy int64 `gorm:"column:repo_created_by" json:"created_by"`
Created int64 `gorm:"column:repo_created" json:"created"`
Updated int64 `gorm:"column:repo_updated" json:"updated"`
}
type ArtifactRepositoryRes ¶
type ArtifactStatisticReport ¶
type ArtifactStatisticReport struct {
DeleteList []*ArtifactRecycleBlobDesc
TagList []*ArtifactVersionCapacityDesc
}
type ArtifactStatisticResponse ¶
type ArtifactStatisticResponse struct {
GarbageCollect *ArtifactGarbageReportRes `json:"garbage_collect"`
Capacity []*ArtifactPackageCapacityRes `json:"capacity"`
}
type ArtifactStatus ¶
type ArtifactStatus string
const ( ArtifactStatusOK ArtifactStatus = "ok" ArtifactStatusInvalidId ArtifactStatus = "invalid_id" ArtifactStatusNotFound ArtifactStatus = "not found" ArtifactStatusUnknown ArtifactStatus = "unknown" )
type ArtifactTreeFilter ¶
type ArtifactTreeFilter struct {
Path string `json:"path"`
Format ArtifactFormat `json:"format"`
Level string `json:"level"`
}
type ArtifactTreeNode ¶
type ArtifactTreeNode struct {
ID int64 `gorm:"column:node_id;primaryKey"`
ParentID null.Int `gorm:"column:node_parent_id"`
OwnerID int64 `gorm:"column:node_owner_id"`
Name string `gorm:"column:node_name"`
Path string `gorm:"column:node_path"`
Type ArtifactTreeNodeType `gorm:"column:node_type"`
Format ArtifactFormat `gorm:"column:node_format"`
}
func (*ArtifactTreeNode) IsRoot ¶
func (n *ArtifactTreeNode) IsRoot() bool
func (*ArtifactTreeNode) Parent ¶
func (n *ArtifactTreeNode) Parent() *ArtifactTreeNode
Parent return the object parent node
inputs: /a/b/c -> /a/b /a/b -> /a /a -> /
type ArtifactTreeNodeId ¶
type ArtifactTreeNodeId struct {
Type ArtifactTreeNodeType `json:"type"`
Pk int64 `json:"pk"`
}
func (*ArtifactTreeNodeId) String ¶
func (nid *ArtifactTreeNodeId) String() string
type ArtifactTreeNodeMeta ¶
type ArtifactTreeNodeMeta struct {
Type ArtifactTreeNodeType `json:"type"`
Name string `json:"name"`
Group string `json:"group"`
Version string `json:"version"`
NodeId string `json:"node_id,omitempty"`
}
type ArtifactTreeNodeType ¶
type ArtifactTreeNodeType string
const ( ArtifactTreeNodeTypeFormat ArtifactTreeNodeType = "format" ArtifactTreeNodeTypeDirectory ArtifactTreeNodeType = "directory" ArtifactTreeNodeTypeVersion ArtifactTreeNodeType = "version" ArtifactTreeNodeTypeAsset ArtifactTreeNodeType = "asset" )
type ArtifactTreeRes ¶
type ArtifactTreeRes struct {
Name string `json:"name"`
Path string `json:"path"`
Leaf bool `json:"leaf"`
Format ArtifactFormat `json:"format"`
Metadata *ArtifactTreeNodeMeta `json:"metadata,omitempty"`
}
type ArtifactVersion ¶
type ArtifactVersion struct {
ID int64 `gorm:"column:version_id;primaryKey"`
PackageID int64 `gorm:"column:version_package_id"`
Version string `gorm:"column:version"`
ViewID int64 `gorm:"column:version_view_id"`
// Metadata store version-level metadata. example: version creator
Metadata string `gorm:"column:version_metadata"`
Created int64 `gorm:"column:version_created;autoCreateTime:milli" json:"created"`
Updated int64 `gorm:"column:version_updated;autoUpdateTime:milli" json:"updated"`
Deleted int64 `gorm:"column:version_deleted"`
}
func (*ArtifactVersion) IsDeleted ¶
func (v *ArtifactVersion) IsDeleted() bool
type ArtifactVersionFilter ¶
type ArtifactVersionFilter struct {
Page int `json:"page"`
Size int `json:"size"`
Query string `json:"query"`
Package string `json:"package"`
Group string `json:"group"`
}
ArtifactVersionFilter define artifact versions query parameters.
type ArtifactVersionInfo ¶
type ArtifactVersionInfo struct {
ID int64 `gorm:"column:version_id"`
Version string `gorm:"column:version"`
ViewID int64 `gorm:"column:version_view_id"`
Deleted int64 `gorm:"column:version_deleted"`
PackageId int64 `gorm:"column:package_id"`
PackageName string `gorm:"column:package_name"`
PackageNamespace string `gorm:"column:package_namespace"`
PackageFormat ArtifactFormat `gorm:"column:package_format"`
SpaceName string `gorm:"column:space_uid"`
}
type ArtifactVersionsRes ¶
type ArtifactView ¶
type AssignableLabelFilter ¶
type AssignableLabelFilter struct {
ListQueryFilter
Assignable bool `json:"assignable,omitempty"`
}
LabelFilter stores label query parameters.
type BasicAuthCreds ¶
type BasicAuthCreds struct {
Username string `json:"username"`
Password SecretRef `json:"password"`
}
BasicAuthCreds represents credentials for basic authentication.
type BearerTokenCreds ¶
type BearerTokenCreds struct {
Token SecretRef `json:"token"`
}
type BranchExtended ¶
type BranchExtended struct {
Branch
IsDefault bool `json:"is_default"`
CheckSummary *CheckCountSummary `json:"check_summary,omitempty"`
Rules []RuleInfo `json:"rules,omitempty"`
PullRequests []*PullReq `json:"pull_requests,omitempty"`
CommitDivergence *CommitDivergence `json:"commit_divergence,omitempty"`
}
type BranchFilter ¶
type BranchFilter struct {
Query string `json:"query"`
Sort enum.BranchSortOption `json:"sort"`
Order enum.Order `json:"order"`
Page int `json:"page"`
Size int `json:"size"`
IncludeCommit bool `json:"include_commit"`
BranchMetadataOptions
}
BranchFilter stores branch query parameters.
type BranchMetadataOptions ¶
type ChangeStats ¶
type Check ¶
type Check struct {
ID int64 `json:"id"`
CreatedBy int64 `json:"-"` // clients will use "reported_by"
Created int64 `json:"created,omitempty"`
Updated int64 `json:"updated,omitempty"`
RepoID int64 `json:"-"` // status checks are always returned for a commit in a repository
CommitSHA string `json:"-"` // status checks are always returned for a commit in a repository
Identifier string `json:"identifier"`
Status enum.CheckStatus `json:"status"`
Summary string `json:"summary,omitempty"`
Link string `json:"link,omitempty"`
Metadata json.RawMessage `json:"metadata"`
Started int64 `json:"started,omitempty"`
Ended int64 `json:"ended,omitempty"`
Payload CheckPayload `json:"payload"`
ReportedBy *PrincipalInfo `json:"reported_by,omitempty"`
}
func (Check) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
type CheckCountSummary ¶
type CheckListOptions ¶
type CheckListOptions struct {
ListQueryFilter
}
CheckListOptions holds list status checks query parameters.
type CheckPayload ¶
type CheckPayload struct {
Version string `json:"version"`
Kind enum.CheckPayloadKind `json:"kind"`
Data json.RawMessage `json:"data"`
}
type CheckPayloadInternal ¶
type CheckPayloadInternal struct {
Number int64 `json:"execution_number"`
RepoID int64 `json:"repo_id"`
PipelineID int64 `json:"pipeline_id"`
}
CheckPayloadInternal is for internal use for more seamless integration for Harness CI status checks.
type CheckPayloadText ¶
type CheckPayloadText struct {
Details string `json:"details"`
}
type CheckRecentOptions ¶
CheckRecentOptions holds list recent status check query parameters.
type CheckResult ¶
type CheckResult struct {
Identifier string `json:"identifier" db:"check_uid" gorm:"column:check_uid"`
Status enum.CheckStatus `json:"status" db:"check_status" gorm:"column:check_status"`
}
func (CheckResult) MarshalJSON ¶
func (s CheckResult) MarshalJSON() ([]byte, error)
TODO [CODE-1363]: remove after identifier migration.
type CheckSumRes ¶
type CodeComment ¶
type CodeComment struct {
ID int64 `db:"pullreq_activity_id" gorm:"column:pullreq_activity_id"`
Version int64 `db:"pullreq_activity_version" gorm:"column:pullreq_activity_version"`
Updated int64 `db:"pullreq_activity_updated" gorm:"column:pullreq_activity_updated"`
CodeCommentFields
}
type CodeCommentFields ¶
type CodeCommentFields struct {
Outdated bool `db:"pullreq_activity_outdated" gorm:"column:pullreq_activity_outdated" json:"outdated"`
MergeBaseSHA string `` /* 131-byte string literal not displayed */
SourceSHA string `db:"pullreq_activity_code_comment_source_sha" gorm:"column:pullreq_activity_code_comment_source_sha" json:"source_sha"`
Path string `db:"pullreq_activity_code_comment_path" gorm:"column:pullreq_activity_code_comment_path" json:"path"`
LineNew int `db:"pullreq_activity_code_comment_line_new" gorm:"column:pullreq_activity_code_comment_line_new" json:"line_new"`
SpanNew int `db:"pullreq_activity_code_comment_span_new" gorm:"column:pullreq_activity_code_comment_span_new" json:"span_new"`
LineOld int `db:"pullreq_activity_code_comment_line_old" gorm:"column:pullreq_activity_code_comment_line_old" json:"line_old"`
SpanOld int `db:"pullreq_activity_code_comment_span_old" gorm:"column:pullreq_activity_code_comment_span_old" json:"span_old"`
}
type CodeOwnerEvaluation ¶
type CodeOwnerEvaluation struct {
EvaluationEntries []CodeOwnerEvaluationEntry `json:"evaluation_entries"`
FileSha string `json:"file_sha"`
}
type CodeOwnerEvaluationEntry ¶
type CodeOwnerEvaluationEntry struct {
LineNumber int64 `json:"line_number"`
Pattern string `json:"pattern"`
OwnerEvaluations []OwnerEvaluation `json:"owner_evaluations"`
UserGroupOwnerEvaluations []UserGroupOwnerEvaluation `json:"user_group_owner_evaluations"`
}
type CodeOwnersValidation ¶
type CodeOwnersValidation struct {
Violations []CodeOwnersViolation `json:"violations"`
}
func (*CodeOwnersValidation) Add ¶
func (violations *CodeOwnersValidation) Add(code enum.CodeOwnerViolationCode, message string)
func (*CodeOwnersValidation) Addf ¶
func (violations *CodeOwnersValidation) Addf(code enum.CodeOwnerViolationCode, format string, params ...any)
type CodeOwnersViolation ¶
type CodeOwnersViolation struct {
Code enum.CodeOwnerViolationCode `json:"code"`
Message string `json:"message"`
Params []any `json:"params"`
}
type CodeRepo ¶
type CodeRepo struct {
URL string `json:"code_repo_url"`
Ref *string `json:"code_repo_ref"`
Type enum.GitspaceCodeRepoType `json:"code_repo_type"`
Branch string `json:"branch"`
DevcontainerPath *string `json:"devcontainer_path,omitempty"`
IsPrivate bool `json:"code_repo_is_private"`
AuthType string `json:"-"`
AuthID string `json:"-"`
}
type CommitCount ¶
type CommitCount struct {
Date string `json:"date"`
Author string `json:"author"`
CommitCountData
}
type CommitCountData ¶
type CommitDivergence ¶
type CommitDivergence struct {
// Ahead is the count of commits the 'From' ref is ahead of the 'To' ref.
Ahead int32 `json:"ahead"`
// Behind is the count of commits the 'From' ref is behind the 'To' ref.
Behind int32 `json:"behind"`
}
CommitDivergence contains the information of the count of converging commits between two refs.
type CommitFileStats ¶
type CommitFileStats struct {
Path string `json:"path"`
OldPath string `json:"old_path,omitempty"`
Status gitenum.FileDiffStatus `json:"status"`
ChangeStats
}
type CommitFilesResponse ¶
type CommitFilesResponse struct {
CommitID string `json:"commit_id"`
DryRunRulesOutput
}
CommitFilesResponse holds commit id.
type CommitFilter ¶
type CommitFilter struct {
PaginationFilter
After string `json:"after"`
Path string `json:"path"`
Since int64 `json:"since"`
Until int64 `json:"until"`
Committer string `json:"committer"`
CommitterIDs []int64 `json:"committer_ids"`
Author string `json:"author"`
AuthorIDs []int64 `json:"author_ids"`
IncludeStats bool `json:"include_stats"`
}
CommitFilter stores commit query parameters.
type CommitStats ¶
type CommitStats struct {
Total ChangeStats `json:"total,omitempty"`
Files []CommitFileStats `json:"files,omitempty"`
}
type Config ¶
type Config struct {
// InstanceID specifis the ID of the Gitfox instance.
// NOTE: If the value is not provided the hostname of the machine is used.
InstanceID string `envconfig:"GITFOX_INSTANCE_ID"`
Debug bool `envconfig:"GITFOX_DEBUG"`
Trace bool `envconfig:"GITFOX_TRACE"`
// GracefulShutdownTime defines the max time we wait when shutting down a server.
// 5min should be enough for most git clones to complete.
GracefulShutdownTime time.Duration `envconfig:"GITFOX_GRACEFUL_SHUTDOWN_TIME" default:"300s"`
UserSignupEnabled bool `envconfig:"GITFOX_USER_SIGNUP_ENABLED" default:"true"`
NestedSpacesEnabled bool `envconfig:"GITFOX_NESTED_SPACES_ENABLED" default:"false"`
// PublicResourceCreationEnabled specifies whether a user can create publicly accessible resources.
PublicResourceCreationEnabled bool `envconfig:"GITFOX_PUBLIC_RESOURCE_CREATION_ENABLED" default:"true"`
Profiler struct {
Type string `envconfig:"GITFOX_PROFILER_TYPE"`
ServiceName string `envconfig:"GITFOX_PROFILER_SERVICE_NAME" default:"gitfox"`
}
// URL defines the URLs via which the different parts of the service are reachable by.
URL struct {
// Base is used to generate external facing URLs in case they aren't provided explicitly.
// Value is derived from Server.HTTP Config unless explicitly specified (e.g. http://localhost:3000).
Base string `envconfig:"GITFOX_URL_BASE"`
// Git defines the external URL via which the GIT API is reachable.
// NOTE: for routing to work properly, the request path & hostname reaching gitfox
// have to statisfy at least one of the following two conditions:
// - Path ends with `/git`
// - Hostname is different to API hostname
// (this could be after proxy path / header rewrite).
// Value is derived from Base unless explicitly specified (e.g. http://localhost:3000/git).
Git string `envconfig:"GITFOX_URL_GIT"`
// GitSSH defines the external URL via which the GIT SSH server is reachable.
// Value is derived from Base or SSH Config unless explicitly specified (e.g. ssh://localhost).
GitSSH string `envconfig:"GITFOX_URL_GIT_SSH"`
// API defines the external URL via which the rest API is reachable.
// NOTE: for routing to work properly, the request path reaching gitfox has to end with `/api`
// (this could be after proxy path rewrite).
// Value is derived from Base unless explicitly specified (e.g. http://localhost:3000/api).
API string `envconfig:"GITFOX_URL_API"`
// UI defines the external URL via which the UI is reachable.
// Value is derived from Base unless explicitly specified (e.g. http://localhost:3000).
UI string `envconfig:"GITFOX_URL_UI"`
// Internal defines the internal URL via which the service is reachable.
// Value is derived from HTTP.Server unless explicitly specified (e.g. http://localhost:3000).
Internal string `envconfig:"GITFOX_URL_INTERNAL"`
// Container is the endpoint that can be used by running container builds to communicate
// with Gitfox (for example while performing a clone on a local repo).
// host.docker.internal allows a running container to talk to services exposed on the host
// (either running directly or via a port exposed in a docker container).
// Value is derived from HTTP.Server unless explicitly specified (e.g. http://host.docker.internal:3000).
Container string `envconfig:"GITFOX_URL_CONTAINER"`
// Registry is used as a base to generate external facing URLs.
// Value is derived from HTTP.Server unless explicitly specified (e.g. http://host.docker.internal:3000).
Registry string `envconfig:"GITFOX_URL_REGISTRY"`
}
// Git defines the git configuration parameters
Git struct {
// Trace specifies whether git operations should be traces.
// NOTE: Currently limited to 'push' operation until we move to internal command package.
Trace bool `envconfig:"GITFOX_GIT_TRACE"`
// DefaultBranch specifies the default branch for new repositories.
DefaultBranch string `envconfig:"GITFOX_GIT_DEFAULTBRANCH" default:"main"`
// Root specifies the directory containing git related data (e.g. repos, ...)
Root string `envconfig:"GITFOX_GIT_ROOT"`
// TmpDir (optional) specifies the directory for temporary data (e.g. repo clones, ...)
TmpDir string `envconfig:"GITFOX_GIT_TMP_DIR"`
// HookPath points to the binary used as git server hook.
HookPath string `envconfig:"GITFOX_GIT_HOOK_PATH"`
// LastCommitCache holds configuration options for the last commit cache.
LastCommitCache struct {
// Mode determines where the cache will be. Valid values are "inmemory" (default), "redis" or "none".
Mode gitenum.LastCommitCacheMode `envconfig:"GITFOX_GIT_LAST_COMMIT_CACHE_MODE" default:"inmemory"`
// Duration defines cache duration of last commit.
Duration time.Duration `envconfig:"GITFOX_GIT_LAST_COMMIT_CACHE_DURATION" default:"12h"`
}
}
// Encrypter defines the parameters for the encrypter
Encrypter struct {
Secret string `envconfig:"GITFOX_ENCRYPTER_SECRET"` // key used for encryption
MixedContent bool `envconfig:"GITFOX_ENCRYPTER_MIXED_CONTENT"`
}
// HTTP defines the http server configuration parameters
HTTP struct {
Port int `envconfig:"GITFOX_HTTP_PORT" default:"3000"`
Host string `envconfig:"GITFOX_HTTP_HOST"`
Proto string `envconfig:"GITFOX_HTTP_PROTO" default:"http"`
}
// Acme defines Acme configuration parameters.
Acme struct {
Enabled bool `envconfig:"GITFOX_ACME_ENABLED"`
Endpont string `envconfig:"GITFOX_ACME_ENDPOINT"`
Email bool `envconfig:"GITFOX_ACME_EMAIL"`
Host string `envconfig:"GITFOX_ACME_HOST"`
}
SSH struct {
Enable bool `envconfig:"GITFOX_SSH_ENABLE" default:"true"`
Host string `envconfig:"GITFOX_SSH_HOST"`
Port int `envconfig:"GITFOX_SSH_PORT" default:"3022"`
// DefaultUser holds value for generating urls {user}@host:path and force check
// no other user can authenticate unless it is empty then any username is allowed
DefaultUser string `envconfig:"GITFOX_SSH_DEFAULT_USER" default:"git"`
Ciphers []string `envconfig:"GITFOX_SSH_CIPHERS"`
KeyExchanges []string `envconfig:"GITFOX_SSH_KEY_EXCHANGES"`
MACs []string `envconfig:"GITFOX_SSH_MACS"`
ServerHostKeys []string `envconfig:"GITFOX_SSH_HOST_KEYS"`
TrustedUserCAKeys []string `envconfig:"GITFOX_SSH_TRUSTED_USER_CA_KEYS"`
TrustedUserCAKeysFile string `envconfig:"GITFOX_SSH_TRUSTED_USER_CA_KEYS_FILENAME"`
TrustedUserCAKeysParsed []gossh.PublicKey
KeepAliveInterval time.Duration `envconfig:"GITFOX_SSH_KEEP_ALIVE_INTERVAL" default:"5s"`
ServerHostKeysDir string `envconfig:"GITFOX_SSH_HOST_KEYS_DIR"`
}
// CI defines configuration related to build executions.
CI struct {
ParallelWorkers int `envconfig:"GITFOX_CI_PARALLEL_WORKERS" default:"2"`
// PluginsZipURL is a pointer to a zip containing all the plugins schemas.
// This could be a local path or an external location.
// If not provided, the default value is used. https://github.com/bradrydzewski/plugins/archive/refs/heads/master.zip
//nolint:lll
PluginsZipURL string `envconfig:"GITFOX_CI_PLUGINS_ZIP_URL" default:"https://pkg.zentao.net/gitfox/20241024/plugins.zip"`
// ContainerNetworks is a list of networks that all containers created as part of CI
// should be attached to.
// This can be needed when we don't want to use host.docker.internal (eg when a service mesh
// or proxy is being used) and instead want all the containers to run on the same network as
// the gitfox container so that they can interact via the container name.
// In that case, GITFOX_URL_CONTAINER should also be changed
// (eg to http://<gitfox_container_name>:<port>).
ContainerNetworks []string `envconfig:"GITFOX_CI_CONTAINER_NETWORKS"`
Runner string `envconfig:"GITFOX_CI_RUNNER" default:"docker"`
Kubernetes struct {
Namespace string `envconfig:"GITFOX_CI_KUBE_NAMESPACE" default:"quickon-ci"`
ServiceAccount string `envconfig:"GITFOX_CI_KUBE_SERVICE_ACCOUNT" default:"default"`
}
Storage struct {
Provider StorageProviderType `envconfig:"GITFOX_CI_STORAGE_PROVIDER" default:"local"`
Prefix string `envconfig:"GITFOX_CI_STORAGE_PREFIX" default:"pipelines"`
}
}
Artifact struct {
Storage struct {
Provider StorageProviderType `envconfig:"GITFOX_ARTIFACT_STORAGE_PROVIDER" default:"local"`
Prefix string `envconfig:"GITFOX_ARTIFACT_STORAGE_PREFIX" default:"artifacts"`
}
}
// Database defines the database configuration parameters.
Database struct {
Driver string `envconfig:"GITFOX_DATABASE_DRIVER" default:"sqlite3"`
Datasource string `envconfig:"GITFOX_DATABASE_DATASOURCE" default:"gitfox.db"`
Host string `envconfig:"GITFOX_DATABASE_HOST"`
Port int `envconfig:"GITFOX_DATABASE_PORT"`
User string `envconfig:"GITFOX_DATABASE_USERNAME"`
Password string `envconfig:"GITFOX_DATABASE_PASSWORD"`
DBName string `envconfig:"GITFOX_DATABASE_DBNAME"`
ExtraFlags string `envconfig:"GITFOX_DATABASE_EXTRA_OPTIONS"`
Trace bool `envconfig:"GITFOX_DATABASE_TRACE" default:"false"`
}
// BlobStore defines the blob storage configuration parameters.
BlobStore struct {
// Provider is a name of blob storage service like filesystem or gcs
Provider blob.Provider `envconfig:"GITFOX_BLOBSTORE_PROVIDER" default:"filesystem"`
// Bucket is a path to the directory where the files will be stored when using filesystem blob storage,
// in case of gcs provider this will be the actual bucket where the images are stored.
Bucket string `envconfig:"GITFOX_BLOBSTORE_BUCKET"`
// In case of GCS provider, this is expected to be the path to the service account key file.
KeyPath string `envconfig:"GITFOX_BLOBSTORE_KEY_PATH" default:""`
// Email ID of the google service account that needs to be impersonated
TargetPrincipal string `envconfig:"GITFOX_BLOBSTORE_TARGET_PRINCIPAL" default:""`
ImpersonationLifetime time.Duration `envconfig:"GITFOX_BLOBSTORE_IMPERSONATION_LIFETIME" default:"12h"`
}
Storage struct {
Local struct {
Directory string `envconfig:"GITFOX_STORAGE_DIR" default:"data"`
}
S3 struct {
Driver storage.DriverType
Host string
Region string
Bucket string
}
}
// Token defines token configuration parameters.
Token struct {
CookieName string `envconfig:"GITFOX_TOKEN_COOKIE_NAME" default:"token"`
Expire time.Duration `envconfig:"GITFOX_TOKEN_EXPIRE" default:"720h"`
}
Logs struct {
// S3 provides optional storage option for logs.
S3 struct {
Bucket string `envconfig:"GITFOX_LOGS_S3_BUCKET"`
Prefix string `envconfig:"GITFOX_LOGS_S3_PREFIX"`
Endpoint string `envconfig:"GITFOX_LOGS_S3_ENDPOINT"`
PathStyle bool `envconfig:"GITFOX_LOGS_S3_PATH_STYLE"`
}
}
// Cors defines http cors parameters
Cors struct {
AllowedOrigins []string `envconfig:"GITFOX_CORS_ALLOWED_ORIGINS" default:"*"`
AllowedMethods []string `envconfig:"GITFOX_CORS_ALLOWED_METHODS" default:"GET,POST,PATCH,PUT,DELETE,OPTIONS"`
AllowedHeaders []string `` //nolint:lll // struct tags can't be multiline
/* 155-byte string literal not displayed */
ExposedHeaders []string `envconfig:"GITFOX_CORS_EXPOSED_HEADERS" default:"Link"`
AllowCredentials bool `envconfig:"GITFOX_CORS_ALLOW_CREDENTIALS" default:"true"`
MaxAge int `envconfig:"GITFOX_CORS_MAX_AGE" default:"300"`
}
// Secure defines http security parameters.
Secure struct {
AllowedHosts []string `envconfig:"GITFOX_HTTP_ALLOWED_HOSTS"`
HostsProxyHeaders []string `envconfig:"GITFOX_HTTP_PROXY_HEADERS"`
SSLRedirect bool `envconfig:"GITFOX_HTTP_SSL_REDIRECT"`
SSLTemporaryRedirect bool `envconfig:"GITFOX_HTTP_SSL_TEMPORARY_REDIRECT"`
SSLHost string `envconfig:"GITFOX_HTTP_SSL_HOST"`
SSLProxyHeaders map[string]string `envconfig:"GITFOX_HTTP_SSL_PROXY_HEADERS"`
STSSeconds int64 `envconfig:"GITFOX_HTTP_STS_SECONDS"`
STSIncludeSubdomains bool `envconfig:"GITFOX_HTTP_STS_INCLUDE_SUBDOMAINS"`
STSPreload bool `envconfig:"GITFOX_HTTP_STS_PRELOAD"`
ForceSTSHeader bool `envconfig:"GITFOX_HTTP_STS_FORCE_HEADER"`
BrowserXSSFilter bool `envconfig:"GITFOX_HTTP_BROWSER_XSS_FILTER" default:"true"`
FrameDeny bool `envconfig:"GITFOX_HTTP_FRAME_DENY" default:"false"` // 默认true, 支持禅道嵌入改成false
ContentTypeNosniff bool `envconfig:"GITFOX_HTTP_CONTENT_TYPE_NO_SNIFF"`
ContentSecurityPolicy string `envconfig:"GITFOX_HTTP_CONTENT_SECURITY_POLICY"`
ReferrerPolicy string `envconfig:"GITFOX_HTTP_REFERRER_POLICY"`
}
Principal struct {
// System defines the principal information used to create the system service.
System struct {
UID string `envconfig:"GITFOX_PRINCIPAL_SYSTEM_UID" default:"gitfox"`
DisplayName string `envconfig:"GITFOX_PRINCIPAL_SYSTEM_DISPLAY_NAME" default:"Gitfox"`
Email string `envconfig:"GITFOX_PRINCIPAL_SYSTEM_EMAIL" default:"system@gitfox.io"`
}
// Pipeline defines the principal information used to create the pipeline service.
Pipeline struct {
UID string `envconfig:"GITFOX_PRINCIPAL_PIPELINE_UID" default:"pipeline"`
DisplayName string `envconfig:"GITFOX_PRINCIPAL_PIPELINE_DISPLAY_NAME" default:"Gitfox Pipeline"`
Email string `envconfig:"GITFOX_PRINCIPAL_PIPELINE_EMAIL" default:"pipeline@gitfox.io"`
}
// Bot defines the principal information used to create the bot user.
DefaultBot struct {
UID string `envconfig:"GITFOX_PRINCIPAL_BOT_UID" default:"bot"`
DisplayName string `envconfig:"GITFOX_PRINCIPAL_BOT_DISPLAY_NAME" default:"Gitfox Bot"`
Email string `envconfig:"GITFOX_PRINCIPAL_BOT_EMAIL" default:"no_replay_bot@gitfox.io"`
}
// Gitspace defines the principal information used to create the gitspace service.
Gitspace struct {
UID string `envconfig:"GITFOX_PRINCIPAL_GITSPACE_UID" default:"gitspace"`
DisplayName string `envconfig:"GITFOX_PRINCIPAL_GITSPACE_DISPLAY_NAME" default:"Gitfox Gitspace"`
Email string `envconfig:"GITFOX_PRINCIPAL_GITSPACE_EMAIL" default:"gitspace@gitfox.io"`
}
// Admin defines the principal information used to create the admin user.
// NOTE: The admin user is only auto-created in case a password and an email is provided.
Admin struct {
UID string `envconfig:"GITFOX_PRINCIPAL_ADMIN_UID" default:"admin"`
DisplayName string `envconfig:"GITFOX_PRINCIPAL_ADMIN_DISPLAY_NAME" default:"Administrator"`
Email string `envconfig:"GITFOX_PRINCIPAL_ADMIN_EMAIL"` // No default email
Password string `envconfig:"GITFOX_PRINCIPAL_ADMIN_PASSWORD"` // No default password
}
}
Redis struct {
Endpoint string `envconfig:"GITFOX_REDIS_ENDPOINT" default:"localhost:6379"`
MaxRetries int `envconfig:"GITFOX_REDIS_MAX_RETRIES" default:"3"`
MinIdleConnections int `envconfig:"GITFOX_REDIS_MIN_IDLE_CONNECTIONS" default:"0"`
Password string `envconfig:"GITFOX_REDIS_PASSWORD"`
SentinelMode bool `envconfig:"GITFOX_REDIS_USE_SENTINEL" default:"false"`
SentinelMaster string `envconfig:"GITFOX_REDIS_SENTINEL_MASTER"`
SentinelEndpoint string `envconfig:"GITFOX_REDIS_SENTINEL_ENDPOINT"`
}
Events struct {
Mode events.Mode `envconfig:"GITFOX_EVENTS_MODE" default:"inmemory"`
Namespace string `envconfig:"GITFOX_EVENTS_NAMESPACE" default:"gitfox"`
MaxStreamLength int64 `envconfig:"GITFOX_EVENTS_MAX_STREAM_LENGTH" default:"10000"`
ApproxMaxStreamLength bool `envconfig:"GITFOX_EVENTS_APPROX_MAX_STREAM_LENGTH" default:"true"`
}
Lock struct {
// Provider is a name of distributed lock service like redis, memory, file etc...
Provider lock.Provider `envconfig:"GITFOX_LOCK_PROVIDER" default:"inmemory"`
Expiry time.Duration `envconfig:"GITFOX_LOCK_EXPIRE" default:"8s"`
Tries int `envconfig:"GITFOX_LOCK_TRIES" default:"8"`
RetryDelay time.Duration `envconfig:"GITFOX_LOCK_RETRY_DELAY" default:"250ms"`
DriftFactor float64 `envconfig:"GITFOX_LOCK_DRIFT_FACTOR" default:"0.01"`
TimeoutFactor float64 `envconfig:"GITFOX_LOCK_TIMEOUT_FACTOR" default:"0.25"`
// AppNamespace is just service app prefix to avoid conflicts on key definition
AppNamespace string `envconfig:"GITFOX_LOCK_APP_NAMESPACE" default:"gitfox"`
// DefaultNamespace is when mutex doesn't specify custom namespace for their keys
DefaultNamespace string `envconfig:"GITFOX_LOCK_DEFAULT_NAMESPACE" default:"default"`
}
PubSub struct {
// Provider is a name of distributed lock service like redis, memory, file etc...
Provider pubsub.Provider `envconfig:"GITFOX_PUBSUB_PROVIDER" default:"inmemory"`
// AppNamespace is just service app prefix to avoid conflicts on channel definition
AppNamespace string `envconfig:"GITFOX_PUBSUB_APP_NAMESPACE" default:"gitfox"`
// DefaultNamespace is custom namespace for their channels
DefaultNamespace string `envconfig:"GITFOX_PUBSUB_DEFAULT_NAMESPACE" default:"default"`
HealthInterval time.Duration `envconfig:"GITFOX_PUBSUB_HEALTH_INTERVAL" default:"3s"`
SendTimeout time.Duration `envconfig:"GITFOX_PUBSUB_SEND_TIMEOUT" default:"60s"`
ChannelSize int `envconfig:"GITFOX_PUBSUB_CHANNEL_SIZE" default:"100"`
}
BackgroundJobs struct {
// MaxRunning is maximum number of jobs that can be running at once.
MaxRunning int `envconfig:"GITFOX_JOBS_MAX_RUNNING" default:"10"`
// RetentionTime is the duration after which non-recurring,
// finished and failed jobs will be purged from the DB.
RetentionTime time.Duration `envconfig:"GITFOX_JOBS_RETENTION_TIME" default:"120h"` // 5 days
}
Webhook struct {
// UserAgentIdentity specifies the identity used for the user agent header
// IMPORTANT: do not include version.
UserAgentIdentity string `envconfig:"GITFOX_WEBHOOK_USER_AGENT_IDENTITY" default:"Gitfox"`
// HeaderIdentity specifies the identity used for headers in webhook calls (e.g. X-Gitfox-Trigger, ...).
// NOTE: If no value is provided, the UserAgentIdentity will be used.
HeaderIdentity string `envconfig:"GITFOX_WEBHOOK_HEADER_IDENTITY"`
Concurrency int `envconfig:"GITFOX_WEBHOOK_CONCURRENCY" default:"4"`
MaxRetries int `envconfig:"GITFOX_WEBHOOK_MAX_RETRIES" default:"3"`
AllowPrivateNetwork bool `envconfig:"GITFOX_WEBHOOK_ALLOW_PRIVATE_NETWORK" default:"false"`
AllowLoopback bool `envconfig:"GITFOX_WEBHOOK_ALLOW_LOOPBACK" default:"false"`
// RetentionTime is the duration after which webhook executions will be purged from the DB.
RetentionTime time.Duration `envconfig:"GITFOX_WEBHOOK_RETENTION_TIME" default:"168h"` // 7 days
// InternalWebhooksURL is the url for webhooks which are marked as internal
InternalWebhooksURL string `envconfig:"GITFOX_WEBHOOK_INTERNAL_WEBHOOKS_URL"`
}
Trigger struct {
Concurrency int `envconfig:"GITFOX_TRIGGER_CONCURRENCY" default:"4"`
MaxRetries int `envconfig:"GITFOX_TRIGGER_MAX_RETRIES" default:"3"`
}
Metric struct {
Enabled bool `envconfig:"GITFOX_METRIC_ENABLED" default:"true"`
Endpoint string `envconfig:"GITFOX_METRIC_ENDPOINT" default:"https://stats.drone.ci/api/v1/gitfox"`
Token string `envconfig:"GITFOX_METRIC_TOKEN"`
}
RepoSize struct {
Enabled bool `envconfig:"GITFOX_REPO_SIZE_ENABLED" default:"true"`
CRON string `envconfig:"GITFOX_REPO_SIZE_CRON" default:"0 0 * * *"`
MaxDuration time.Duration `envconfig:"GITFOX_REPO_SIZE_MAX_DURATION" default:"15m"`
NumWorkers int `envconfig:"GITFOX_REPO_SIZE_NUM_WORKERS" default:"5"`
}
CodeOwners struct {
FilePaths []string `envconfig:"GITFOX_CODEOWNERS_FILEPATH" default:"CODEOWNERS,.gitfox/CODEOWNERS"`
}
SMTP struct {
Host string `envconfig:"GITFOX_SMTP_HOST"`
Port int `envconfig:"GITFOX_SMTP_PORT"`
Username string `envconfig:"GITFOX_SMTP_USERNAME"`
Password string `envconfig:"GITFOX_SMTP_PASSWORD"`
FromMail string `envconfig:"GITFOX_SMTP_FROM_MAIL"`
Insecure bool `envconfig:"GITFOX_SMTP_INSECURE"`
}
Notification struct {
MaxRetries int `envconfig:"GITFOX_NOTIFICATION_MAX_RETRIES" default:"3"`
Concurrency int `envconfig:"GITFOX_NOTIFICATION_CONCURRENCY" default:"4"`
}
KeywordSearch struct {
Concurrency int `envconfig:"GITFOX_KEYWORD_SEARCH_CONCURRENCY" default:"4"`
MaxRetries int `envconfig:"GITFOX_KEYWORD_SEARCH_MAX_RETRIES" default:"3"`
}
Repos struct {
// DeletedRetentionTime is the duration after which deleted repositories will be purged.
DeletedRetentionTime time.Duration `envconfig:"GITFOX_REPOS_DELETED_RETENTION_TIME" default:"2160h"` // 90 days
}
Docker struct {
// Host sets the url to the docker server.
Host string `envconfig:"GITFOX_DOCKER_HOST"`
// APIVersion sets the version of the API to reach, leave empty for latest.
APIVersion string `envconfig:"GITFOX_DOCKER_API_VERSION"`
// CertPath sets the path to load the TLS certificates from.
CertPath string `envconfig:"GITFOX_DOCKER_CERT_PATH"`
// TLSVerify enables or disables TLS verification, off by default.
TLSVerify string `envconfig:"GITFOX_DOCKER_TLS_VERIFY"`
// MachineHostName is the public host name of the machine on which the Docker.Host is running.
// If not set, it parses the host from the URL.Base (e.g. localhost from http://localhost:3000).
MachineHostName string `envconfig:"GITFOX_DOCKER_MACHINE_HOST_NAME"`
}
IDE struct {
VSCodeWeb struct {
// Port is the port on which the VSCode Web will be accessible.
Port int `envconfig:"GITFOX_IDE_VSCODEWEB_PORT" default:"8089"`
}
VSCode struct {
// Port is the port on which the SSH server for VSCode will be accessible.
Port int `envconfig:"GITFOX_IDE_VSCODE_PORT" default:"8088"`
}
}
Gitspace struct {
// DefaultBaseImage is used to create the Gitspace when no devcontainer.json is absent or doesn't have image.
DefaultBaseImage string `envconfig:"GITFOX_GITSPACE_DEFAULT_BASE_IMAGE" default:"mcr.microsoft.com/devcontainers/base:dev-ubuntu-24.04"` //nolint:lll
Enable bool `envconfig:"GITFOX_GITSPACE_ENABLE" default:"false"`
AgentPort int `envconfig:"GITFOX_GITSPACE_AGENT_PORT" default:"8083"`
Events struct {
Concurrency int `envconfig:"GITFOX_GITSPACE_EVENTS_CONCURRENCY" default:"4"`
MaxRetries int `envconfig:"GITFOX_GITSPACE_EVENTS_MAX_RETRIES" default:"3"`
}
}
UI struct {
ShowPlugin bool `envconfig:"GITFOX_UI_SHOW_PLUGIN" default:"true"`
}
Registry struct {
Enable bool `envconfig:"GITFOX_REGISTRY_ENABLED" default:"true"`
Storage struct {
// StorageType defines the type of storage to use for the registry. Options are: `filesystem`, `s3aws`
StorageType string `envconfig:"GITFOX_REGISTRY_STORAGE_TYPE" default:"filesystem"`
// FileSystemStorage defines the configuration for the filesystem storage if StorageType is `filesystem`.
FileSystemStorage struct {
MaxThreads int `envconfig:"GITFOX_REGISTRY_FILESYSTEM_MAX_THREADS" default:"100"`
RootDirectory string `envconfig:"GITFOX_REGISTRY_FILESYSTEM_ROOT_DIRECTORY"`
}
// S3Storage defines the configuration for the S3 storage if StorageType is `s3aws`.
S3Storage struct {
AccessKey string `envconfig:"GITFOX_REGISTRY_S3_ACCESS_KEY"`
SecretKey string `envconfig:"GITFOX_REGISTRY_S3_SECRET_KEY"`
Region string `envconfig:"GITFOX_REGISTRY_S3_REGION"`
RegionEndpoint string `envconfig:"GITFOX_REGISTRY_S3_REGION_ENDPOINT"`
ForcePathStyle bool `envconfig:"GITFOX_REGISTRY_S3_FORCE_PATH_STYLE" default:"true"`
Accelerate bool `envconfig:"GITFOX_REGISTRY_S3_ACCELERATED" default:"false"`
Bucket string `envconfig:"GITFOX_REGISTRY_S3_BUCKET"`
Encrypt bool `envconfig:"GITFOX_REGISTRY_S3_ENCRYPT" default:"false"`
KeyID string `envconfig:"GITFOX_REGISTRY_S3_KEY_ID"`
Secure bool `envconfig:"GITFOX_REGISTRY_S3_SECURE" default:"true"`
V4Auth bool `envconfig:"GITFOX_REGISTRY_S3_V4_AUTH" default:"true"`
ChunkSize int `envconfig:"GITFOX_REGISTRY_S3_CHUNK_SIZE" default:"10485760"`
MultipartCopyChunkSize int `envconfig:"GITFOX_REGISTRY_S3_MULTIPART_COPY_CHUNK_SIZE" default:"33554432"`
MultipartCopyMaxConcurrency int `envconfig:"GITFOX_REGISTRY_S3_MULTIPART_COPY_MAX_CONCURRENCY" default:"100"`
MultipartCopyThresholdSize int `envconfig:"GITFOX_REGISTRY_S3_MULTIPART_COPY_THRESHOLD_SIZE" default:"33554432"` //nolint:lll
RootDirectory string `envconfig:"GITFOX_REGISTRY_S3_ROOT_DIRECTORY"`
UseDualStack bool `envconfig:"GITFOX_REGISTRY_S3_USE_DUAL_STACK" default:"false"`
LogLevel string `envconfig:"GITFOX_REGISTRY_S3_LOG_LEVEL" default:"info"`
Delete bool `envconfig:"GITFOX_REGISTRY_S3_DELETE_ENABLED" default:"true"`
Redirect bool `envconfig:"GITFOX_REGISTRY_S3_STORAGE_REDIRECT" default:"false"`
}
}
HTTP struct {
// GITFOX_REGISTRY_HTTP_SECRET is used to encrypt the upload session details during docker push.
// If not provided, a random secret will be generated. This may cause problems with uploads if multiple
// registries are behind a load-balancer
Secret string `envconfig:"GITFOX_REGISTRY_HTTP_SECRET"`
}
//nolint:lll
GarbageCollection struct {
Enabled bool `envconfig:"GITFOX_REGISTRY_GARBAGE_COLLECTION_ENABLED" default:"false"`
NoIdleBackoff bool `envconfig:"GITFOX_REGISTRY_GARBAGE_COLLECTION_NO_IDLE_BACKOFF" default:"false"`
MaxBackoffDuration time.Duration `envconfig:"GITFOX_REGISTRY_GARBAGE_COLLECTION_MAX_BACKOFF_DURATION" default:"10m"`
InitialIntervalDuration time.Duration `envconfig:"GITFOX_REGISTRY_GARBAGE_COLLECTION_INITIAL_INTERVAL_DURATION" default:"5s"` //nolint:lll
TransactionTimeoutDuration time.Duration `envconfig:"GITFOX_REGISTRY_GARBAGE_COLLECTION_TRANSACTION_TIMEOUT_DURATION" default:"10s"` //nolint:lll
BlobsStorageTimeoutDuration time.Duration `envconfig:"GITFOX_REGISTRY_GARBAGE_COLLECTION_BLOB_STORAGE_TIMEOUT_DURATION" default:"5s"` //nolint:lll
}
}
Instrumentation struct {
Enable bool `envconfig:"GITFOX_INSTRUMENTATION_ENABLE" default:"false"`
Cron string `envconfig:"GITFOX_INSTRUMENTATION_CRON" default:"0 0 * * *"`
}
}
Config stores the system configuration.
type Connector ¶
type Connector struct {
ID int64 `json:"-"`
Description string `json:"description"`
SpaceID int64 `json:"space_id"`
Identifier string `json:"identifier"`
CreatedBy int64 `json:"created_by"`
Type enum.ConnectorType `json:"type"`
LastTestAttempt int64 `json:"last_test_attempt"`
LastTestErrorMsg string `json:"last_test_error_msg"`
LastTestStatus enum.ConnectorStatus `json:"last_test_status"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Version int64 `json:"-"`
// Pointers to connector specific data
ConnectorConfig
}
type ConnectorAuth ¶
type ConnectorAuth struct {
AuthType enum.ConnectorAuthType `json:"type"`
Basic *BasicAuthCreds `json:"basic,omitempty"`
Bearer *BearerTokenCreds `json:"bearer,omitempty"`
}
ConnectorAuth represents the authentication configuration for a connector.
func (*ConnectorAuth) Validate ¶
func (c *ConnectorAuth) Validate() error
type ConnectorConfig ¶
type ConnectorConfig struct {
Github *GithubConnectorData `json:"github,omitempty"`
}
ConnectorConfig is a list of all the connector and their associated config.
func (ConnectorConfig) Validate ¶
func (c ConnectorConfig) Validate(typ enum.ConnectorType) error
type ConnectorTestResponse ¶
type ConnectorTestResponse struct {
Status enum.ConnectorStatus `json:"status"`
ErrorMsg string `json:"error_msg,omitempty"`
}
type CreateBranchOutput ¶
type CreateBranchOutput struct {
Branch
DryRunRulesOutput
}
type CreatedFilter ¶
type DefineLabelInput ¶
type DefineLabelInput struct {
Key string `json:"key"`
Type enum.LabelType `json:"type"`
Description string `json:"description"`
Color enum.LabelColor `json:"color"`
}
func (*DefineLabelInput) Sanitize ¶
func (in *DefineLabelInput) Sanitize() error
type DefineValueInput ¶
type DefineValueInput struct {
Value string `json:"value"`
Color enum.LabelColor `json:"color"`
}
func (*DefineValueInput) Sanitize ¶
func (in *DefineValueInput) Sanitize() error
type DeleteBranchOutput ¶
type DeleteBranchOutput struct {
DryRunRulesOutput
}
type DevcontainerConfig ¶
type DevcontainerConfig struct {
Image string `json:"image"`
PostCreateCommand string `json:"postCreateCommand"` //nolint:tagliatelle
}
DevcontainerConfig is parsed from code repos and follows the devcontainer.json spec. It uses camelCase.
type DiffStats ¶
type DiffStats struct {
Commits *int64 `json:"commits,omitempty"`
FilesChanged *int64 `json:"files_changed,omitempty"`
Additions *int64 `json:"additions"`
Deletions *int64 `json:"deletions"`
}
DiffStats shows total number of commits and modified files.
func NewDiffStats ¶
type DryRunRulesOutput ¶
type DryRunRulesOutput struct {
DryRunRules bool `json:"dry_run_rules,omitempty"`
RuleViolations []RuleViolations `json:"rule_violations,omitempty"`
}
type EditedFilter ¶
type Execution ¶
type Execution struct {
ID int64 `json:"-"`
PipelineID int64 `json:"pipeline_id"`
CreatedBy int64 `json:"created_by"`
RepoID int64 `json:"repo_id"`
Trigger string `json:"trigger,omitempty"`
Number int64 `json:"number"`
Parent int64 `json:"parent,omitempty"`
Status enum.CIStatus `json:"status"`
Error string `json:"error,omitempty"`
Event enum.TriggerEvent `json:"event,omitempty"`
Action enum.TriggerAction `json:"action,omitempty"`
Link string `json:"link,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
Title string `json:"title,omitempty"`
Message string `json:"message,omitempty"`
Before string `json:"before,omitempty"`
After string `json:"after,omitempty"`
Ref string `json:"ref,omitempty"`
Fork string `json:"source_repo,omitempty"`
Source string `json:"source,omitempty"`
Target string `json:"target,omitempty"`
Author string `json:"author_login,omitempty"`
AuthorName string `json:"author_name,omitempty"`
AuthorEmail string `json:"author_email,omitempty"`
AuthorAvatar string `json:"author_avatar,omitempty"`
Sender string `json:"sender,omitempty"`
Params map[string]string `json:"params,omitempty"`
Cron string `json:"cron,omitempty"`
Deploy string `json:"deploy_to,omitempty"`
DeployID int64 `json:"deploy_id,omitempty"`
Debug bool `json:"debug,omitempty"`
Started int64 `json:"started,omitempty"`
Finished int64 `json:"finished,omitempty"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Version int64 `json:"-"`
Stages []*Stage `json:"stages,omitempty"`
// Pipeline specific information not stored with executions
PipelineUID string `json:"pipeline_uid,omitempty"`
// Repo specific information not stored with executions
RepoUID string `json:"repo_uid,omitempty"`
}
Execution represents an instance of a pipeline execution.
type ExecutionInfo ¶
type ExecutionInfo struct {
Number int64 `db:"execution_number" json:"number"`
PipelineID int64 `db:"execution_pipeline_id" json:"pipeline_id"`
Status enum.CIStatus `db:"execution_status" json:"status"`
CreatedBy int64 `db:"execution_created_by" json:"created_by"`
Trigger string `db:"execution_trigger" json:"trigger,omitempty"`
Event enum.TriggerEvent `db:"execution_event" json:"event,omitempty"`
Started int64 `db:"execution_started" json:"started,omitempty"`
Finished int64 `db:"execution_finished" json:"finished,omitempty"`
}
type Fragment ¶
type Fragment struct {
Pre string `json:"pre"` // the string before the match within the line
Match string `json:"match"` // the matched string
Post string `json:"post"` // the string after the match within the line
}
Fragment holds data of a single contiguous match within a line.
type GithookInputBase ¶
type GithookInputBase struct {
RepoID int64
PrincipalID int64
Internal bool // Internal calls originate from Gitness, and external calls are direct git pushes.
}
GithookInputBase contains the base input of the githook apis.
type GithookPostReceiveInput ¶
type GithookPostReceiveInput struct {
GithookInputBase
hook.PostReceiveInput
}
GithookPostReceiveInput is the input for the post-receive githook api call.
type GithookPreReceiveInput ¶
type GithookPreReceiveInput struct {
GithookInputBase
hook.PreReceiveInput
}
GithookPreReceiveInput is the input for the pre-receive githook api call.
type GithookUpdateInput ¶
type GithookUpdateInput struct {
GithookInputBase
hook.UpdateInput
}
GithookUpdateInput is the input for the update githook api call.
type GithubConnectorData ¶
type GithubConnectorData struct {
APIURL string `json:"api_url"`
Insecure bool `json:"insecure"`
Auth *ConnectorAuth `json:"auth"`
}
func (*GithubConnectorData) Type ¶
func (g *GithubConnectorData) Type() enum.ConnectorType
func (*GithubConnectorData) Validate ¶
func (g *GithubConnectorData) Validate() error
type GitspaceConfig ¶
type GitspaceConfig struct {
ID int64 `json:"-"`
Identifier string `json:"identifier"`
Name string `json:"name"`
IDE enum.IDEType `json:"ide"`
State enum.GitspaceStateType `json:"state"`
SpaceID int64 `json:"-"`
IsDeleted bool `json:"-"`
GitspaceInstance *GitspaceInstance `json:"instance"`
SpacePath string `json:"space_path"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
SSHTokenIdentifier string `json:"ssh_token_identifier"`
InfraProviderResource InfraProviderResource `json:"resource"`
CodeRepo
GitspaceUser
}
type GitspaceEvent ¶
type GitspaceEvent struct {
ID int64 `json:"-"`
Event enum.GitspaceEventType `json:"event,omitempty"`
EntityID int64 `json:"-"`
QueryKey string `json:"query_key,omitempty"`
EntityType enum.GitspaceEntityType `json:"entity_type,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
Created int64 `json:"created,omitempty"`
}
type GitspaceEventFilter ¶
type GitspaceEventFilter struct {
Pagination
QueryKey string
EntityID int64
EntityType enum.GitspaceEntityType
}
type GitspaceEventResponse ¶
type GitspaceEventResponse struct {
GitspaceEvent
EventTime string `json:"event_time,omitempty"`
Message string `json:"message,omitempty"`
}
type GitspaceFilter ¶
type GitspaceFilter struct {
QueryFilter ListQueryFilter
UserID string
SpaceIDs []int64
IncludeDeleted bool
}
type GitspaceInstance ¶
type GitspaceInstance struct {
ID int64 `json:"-"`
GitSpaceConfigID int64 `json:"-"`
Identifier string `json:"identifier"`
URL *string `json:"url,omitempty"`
State enum.GitspaceInstanceStateType `json:"state"`
UserID string `json:"-"`
ResourceUsage *string `json:"resource_usage"`
LastUsed int64 `json:"last_used,omitempty"`
TotalTimeUsed int64 `json:"total_time_used"`
TrackedChanges *string `json:"tracked_changes"`
AccessKey *string `json:"access_key,omitempty"`
AccessType enum.GitspaceAccessType `json:"access_type"`
AccessKeyRef *string `json:"access_key_ref"`
MachineUser *string `json:"machine_user,omitempty"`
SpacePath string `json:"space_path"`
SpaceID int64 `json:"-"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
}
type GitspacePort ¶
type GitspacePort struct {
Port int `json:"port"`
Protocol enum.CommunicationProtocol `json:"protocol"`
}
type GitspaceUser ¶
type InfraProviderConfig ¶
type InfraProviderConfig struct {
ID int64 `json:"-"`
Identifier string `json:"identifier"`
Name string `json:"name"`
Type enum.InfraProviderType `json:"type"`
Metadata map[string]string `json:"metadata"`
Resources []InfraProviderResource `json:"resources"`
SpaceID int64 `json:"-"`
SpacePath string `json:"space_path"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
}
type InfraProviderParameter ¶
type InfraProviderResource ¶
type InfraProviderResource struct {
ID int64 `json:"-"`
UID string `json:"identifier"`
Name string `json:"name"`
InfraProviderConfigID int64 `json:"-"`
InfraProviderConfigIdentifier string `json:"config_identifier"`
CPU *string `json:"cpu"`
Memory *string `json:"memory"`
Disk *string `json:"disk"`
Network *string `json:"network"`
Region string `json:"region"`
Metadata map[string]string `json:"metadata"`
// Deprecated. Set template identifier in Metadata.
TemplateID *int64 `json:"-"`
// Deprecated. Set template identifier in Metadata.
TemplateIdentifier *string `json:"template_identifier"`
SpaceID int64 `json:"-"`
SpacePath string `json:"space_path"`
InfraProviderType enum.InfraProviderType `json:"infra_provider_type"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
}
func (*InfraProviderResource) Identifier ¶
func (i *InfraProviderResource) Identifier() int64
type InfraProviderTemplate ¶
type InfraProviderTemplate struct {
ID int64 `json:"-"`
Identifier string `json:"identifier"`
InfraProviderConfigID int64 `json:"-"`
InfraProviderConfigIdentifier string `json:"config_identifier"`
Description string `json:"description"`
Data string `json:"data"`
Version int64 `json:"-"`
SpaceID int64 `json:"space_id"`
SpacePath string `json:"space_path"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
}
type InfraProvisioned ¶
type InfraProvisioned struct {
ID int64
GitspaceInstanceID int64
InfraProviderType enum.InfraProviderType
InfraProviderResourceID int64
SpaceID int64
Created int64
Updated int64
ResponseMetadata *string
InputParams string
InfraStatus enum.InfraStatus
ServerHostIP string
ServerHostPort string
ProxyHost string
ProxyPort int32
}
type Infrastructure ¶
type Infrastructure struct {
// Identifier identifies the provisioned infra.
Identifier string
// SpaceID for the resource key.
SpaceID int64
// SpacePath for the resource key.
SpacePath string
// GitspaceConfigIdentifier is the gitspace config for which the infra is provisioned.
GitspaceConfigIdentifier string
// GitspaceInstanceIdentifier is the gitspace instance for which the infra is provisioned.
GitspaceInstanceIdentifier string
// ProviderType specifies the type of the infra provider.
ProviderType enum.InfraProviderType
// InputParameters which are required by the provider to provision the infra.
InputParameters []InfraProviderParameter
// Status of the infra.
Status enum.InfraStatus
// AgentHost through which the infra can be accessed.
AgentHost string
// AgentPort on which the agent can be accessed to orchestrate containers.
AgentPort int
// ProxyAgentHost on which to connect to agent incase a proxy is used.
ProxyAgentHost string
ProxyAgentPort int
// HostScheme is scheme to connect to the host e.g. https
HostScheme string
// GitspaceHost on which gitspace is accessible directly, without proxy being configured.
GitspaceHost string
// ProxyGitspaceHost on which gitspace is accessible through a proxy.
ProxyGitspaceHost string
GitspaceScheme string
// Storage is the name of the volume or disk created for the resource.
Storage string
// GitspacePortMappings contains the ports assigned for every requested port.
GitspacePortMappings map[int]*PortMapping
}
type JobUIDResponse ¶
type JobUIDResponse struct {
UID string `json:"uid"`
}
type Label ¶
type Label struct {
ID int64 `json:"id"`
SpaceID *int64 `json:"space_id,omitempty"`
RepoID *int64 `json:"repo_id,omitempty"`
Scope int64 `json:"scope"`
Key string `json:"key"`
Description string `json:"description"`
Type enum.LabelType `json:"type"`
Color enum.LabelColor `json:"color"`
ValueCount int64 `json:"value_count"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
CreatedBy int64 `json:"created_by"`
UpdatedBy int64 `json:"updated_by"`
}
type LabelAssignment ¶
type LabelAssignment struct {
LabelInfo
AssignedValue *LabelValueInfo `json:"assigned_value,omitempty"`
Values []*LabelValueInfo `json:"values,omitempty"` // query param ?assignable=true
}
type LabelFilter ¶
type LabelFilter struct {
ListQueryFilter
Inherited bool `json:"inherited,omitempty"`
}
type LabelPullReqAssignmentInfo ¶
type LabelPullReqAssignmentInfo struct {
PullReqID int64 `json:"-"`
LabelID int64 `json:"id"`
LabelKey string `json:"key"`
LabelColor enum.LabelColor `json:"color,omitempty"`
LabelScope int64 `json:"scope"`
ValueCount int64 `json:"value_count"`
ValueID *int64 `json:"value_id,omitempty"`
Value *string `json:"value,omitempty"`
ValueColor *enum.LabelColor `json:"value_color,omitempty"`
}
type LabelValue ¶
type LabelValueInfo ¶
type LabelWithValues ¶
type LabelWithValues struct {
Label `json:"label"`
Values []*LabelValue `json:"values"`
}
type ListCommitResponse ¶
type ListCommitResponse struct {
Commits []Commit `json:"commits"`
RenameDetails []RenameDetails `json:"rename_details"`
TotalCommits int `json:"total_commits,omitempty"`
}
type ListExecutionsFilter ¶
type ListExecutionsFilter struct {
ListQueryFilter
PipelineIdentifier string `json:"pipeline_identifier"`
Sort enum.ExecutionSort `json:"sort"`
Order enum.Order `json:"order"`
}
ExecutionFilter stores execution query parameters.
type ListPipelinesFilter ¶
type ListPipelinesFilter struct {
ListQueryFilter
Latest bool
LastExecutions int64
}
type ListQueryFilter ¶
type ListQueryFilter struct {
Pagination
Query string `json:"query"`
}
ListQueryFilter has pagination related info and a query param.
type Match ¶
type Match struct {
// LineNum is the line number of the match
LineNum int `json:"line_num"`
// Fragments holds the matched fragments within the line
Fragments []Fragment `json:"fragments"`
// Before holds the content from the line immediately preceding the line where the match was found
Before string `json:"before"`
// After holds the content from the line immediately following the line where the match was found
After string `json:"after"`
}
Match holds the per line data.
type Membership ¶
type Membership struct {
MembershipKey `json:"-"`
CreatedBy int64 `json:"-"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Role enum.MembershipRole `json:"role"`
}
Membership represents a user's membership of a space.
type MembershipKey ¶
MembershipKey can be used as a key for finding a user's space membership info.
type MembershipSpace ¶
type MembershipSpace struct {
Membership
Space Space `json:"space"`
AddedBy PrincipalInfo `json:"added_by"`
}
MembershipSpace adds space info to the Membership data.
type MembershipSpaceFilter ¶
type MembershipSpaceFilter struct {
ListQueryFilter
Sort enum.MembershipSpaceSort `json:"sort"`
Order enum.Order `json:"order"`
}
MembershipSpaceFilter holds membership space query parameters.
type MembershipUser ¶
type MembershipUser struct {
Membership
Principal PrincipalInfo `json:"principal"`
AddedBy PrincipalInfo `json:"added_by"`
}
MembershipUser adds user info to the Membership data.
type MembershipUserFilter ¶
type MembershipUserFilter struct {
ListQueryFilter
Sort enum.MembershipUserSort `json:"sort"`
Order enum.Order `json:"order"`
}
MembershipUserFilter holds membership user query parameters.
type MergeResponse ¶
type MergeResponse struct {
SHA string `json:"sha,omitempty"`
BranchDeleted bool `json:"branch_deleted,omitempty"`
RuleViolations []RuleViolations `json:"rule_violations,omitempty"`
// values only returned on dryrun
DryRunRules bool `json:"dry_run_rules,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
Mergeable bool `json:"mergeable,omitempty"`
ConflictFiles []string `json:"conflict_files,omitempty"`
AllowedMethods []enum.MergeMethod `json:"allowed_methods,omitempty"`
MinimumRequiredApprovalsCount int `json:"minimum_required_approvals_count,omitempty"`
MinimumRequiredApprovalsCountLatest int `json:"minimum_required_approvals_count_latest,omitempty"`
RequiresCodeOwnersApproval bool `json:"requires_code_owners_approval,omitempty"`
RequiresCodeOwnersApprovalLatest bool `json:"requires_code_owners_approval_latest,omitempty"`
RequiresCommentResolution bool `json:"requires_comment_resolution,omitempty"`
RequiresNoChangeRequests bool `json:"requires_no_change_requests,omitempty"`
}
type MergeViolations ¶
type MergeViolations struct {
Message string `json:"message,omitempty"`
ConflictFiles []string `json:"conflict_files,omitempty"`
RuleViolations []RuleViolations `json:"rule_violations,omitempty"`
}
type OwnerEvaluation ¶
type OwnerEvaluation struct {
Owner PrincipalInfo `json:"owner"`
ReviewDecision enum.PullReqReviewDecision `json:"review_decision"`
ReviewSHA string `json:"review_sha"`
}
type Pagination ¶
Pagination stores pagination related params.
type PaginationFilter ¶
PaginationFilter stores pagination query parameters.
type PermissionCheck ¶
type PermissionCheck struct {
Scope Scope
Resource Resource
Permission enum.Permission
}
PermissionCheck represents a permission check.
type Pipeline ¶
type Pipeline struct {
ID int64 `db:"pipeline_id" json:"id"`
Description string `db:"pipeline_description" json:"description"`
Identifier string `db:"pipeline_uid" json:"identifier"`
Disabled bool `db:"pipeline_disabled" json:"disabled"`
CreatedBy int64 `db:"pipeline_created_by" json:"created_by"`
// Seq is the last execution number for this pipeline
Seq int64 `db:"pipeline_seq" json:"seq"`
RepoID int64 `db:"pipeline_repo_id" json:"repo_id"`
DefaultBranch string `db:"pipeline_default_branch" json:"default_branch"`
ConfigPath string `db:"pipeline_config_path" json:"config_path"`
Created int64 `db:"pipeline_created" json:"created"`
// Execution contains information about the latest execution if available
Execution *Execution `db:"-" json:"execution,omitempty"`
LastExecutions []*ExecutionInfo `db:"-" json:"last_executions,omitempty"`
Updated int64 `db:"pipeline_updated" json:"updated"`
Version int64 `db:"pipeline_version" json:"-"`
// Repo specific information not stored with pipelines
RepoUID string `db:"-" json:"repo_uid,omitempty"`
}
func (Pipeline) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
type Plugin ¶
type Plugin struct {
Identifier string `db:"plugin_uid" gorm:"column:plugin_uid;primaryKey" json:"identifier"`
Description string `db:"plugin_description" gorm:"column:plugin_description" json:"description"`
// Currently we only support step level plugins but more can be added in the future.
Type string `db:"plugin_type" gorm:"column:plugin_type" json:"type"`
Version string `db:"plugin_version" gorm:"column:plugin_version" json:"version"`
Logo string `db:"plugin_logo" gorm:"column:plugin_logo" json:"logo"`
// Spec is a YAML template to be used for the plugin.
Spec string `db:"plugin_spec" gorm:"column:plugin_spec" json:"spec"`
}
Plugin represents a Harness plugin. It has an associated template stored in the spec field. The spec is used by the UI to provide a smart visual editor for adding plugins to YAML schema.
func (Plugin) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
type PortMapping ¶
type Principal ¶
type Principal struct {
// TODO: int64 ID doesn't match DB
ID int64 `db:"principal_id" gorm:"column:principal_id;primaryKey" json:"-"`
UID string `db:"principal_uid" gorm:"column:principal_uid" json:"uid"`
Email string `db:"principal_email" gorm:"column:principal_email" json:"email"`
Type enum.PrincipalType `db:"principal_type" gorm:"column:principal_type" json:"type"`
DisplayName string `db:"principal_display_name" gorm:"column:principal_display_name" json:"display_name"`
Admin bool `db:"principal_admin" gorm:"column:principal_admin" json:"admin"`
// Should be part of principal or not?
Blocked bool `db:"principal_blocked" gorm:"column:principal_blocked" json:"blocked"`
Salt string `db:"principal_salt" gorm:"column:principal_salt" json:"-"`
// Other info
Created int64 `db:"principal_created" gorm:"column:principal_created" json:"created"`
Updated int64 `db:"principal_updated" gorm:"column:principal_updated" json:"updated"`
// Source is the source of the user account.
Source enum.PrincipalSource `db:"principal_user_source" gorm:"column:principal_user_source" json:"-"`
}
Principal represents the identity of an acting entity (User, ServiceAccount, Service).
func (*Principal) ToPrincipalInfo ¶
func (p *Principal) ToPrincipalInfo() *PrincipalInfo
type PrincipalFilter ¶
type PrincipalFilter struct {
Page int `json:"page"`
Size int `json:"size"`
Query string `json:"query"`
Types []enum.PrincipalType `json:"types"`
}
type PrincipalInfo ¶
type PrincipalInfo struct {
ID int64 `json:"id"`
UID string `json:"uid"`
DisplayName string `json:"display_name"`
Email string `json:"email"`
Type enum.PrincipalType `json:"type"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
}
PrincipalInfo is a compressed representation of a principal we return as part of non-principal APIs.
func (*PrincipalInfo) Identifier ¶
func (p *PrincipalInfo) Identifier() int64
type PublicKey ¶
type PublicKey struct {
ID int64 `json:"-"` // frontend doesn't need it
PrincipalID int64 `json:"-"` // API always returns keys for the same user
Created int64 `json:"created"`
Verified *int64 `json:"verified"`
Identifier string `json:"identifier"`
Usage enum.PublicKeyUsage `json:"usage"`
Fingerprint string `json:"fingerprint"`
Content string `json:"-"`
Comment string `json:"comment"`
Type string `json:"type"`
}
type PublicKeyFilter ¶
type PublicKeyFilter struct {
ListQueryFilter
Sort enum.PublicKeySort
Order enum.Order
}
type PullReq ¶
type PullReq struct {
ID int64 `json:"-"` // not returned, it's an internal field
Version int64 `json:"-"` // not returned, it's an internal field
Number int64 `json:"number"`
CreatedBy int64 `json:"-"` // not returned, because the author info is in the Author field
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Edited int64 `json:"edited"` // TODO: Remove. Field Edited is equal to Updated
Closed *int64 `json:"closed,omitempty"`
State enum.PullReqState `json:"state"`
IsDraft bool `json:"is_draft"`
CommentCount int `json:"-"` // returned as "conversations" in the Stats
UnresolvedCount int `json:"-"` // returned as "unresolved_count" in the Stats
Title string `json:"title"`
Description string `json:"description"`
SourceRepoID int64 `json:"source_repo_id"`
SourceBranch string `json:"source_branch"`
SourceSHA string `json:"source_sha"`
TargetRepoID int64 `json:"target_repo_id"`
TargetBranch string `json:"target_branch"`
ActivitySeq int64 `json:"-"` // not returned, because it's a server's internal field
MergedBy *int64 `json:"-"` // not returned, because the merger info is in the Merger field
Merged *int64 `json:"merged"`
MergeMethod *enum.MergeMethod `json:"merge_method"`
MergeTargetSHA *string `json:"merge_target_sha"`
MergeBaseSHA string `json:"merge_base_sha"`
MergeSHA *string `json:"-"` // TODO: either remove or ensure it's being set (merge dry-run)
MergeCheckStatus enum.MergeCheckStatus `json:"merge_check_status"`
MergeConflicts []string `json:"merge_conflicts,omitempty"`
RebaseCheckStatus enum.MergeCheckStatus `json:"rebase_check_status"`
RebaseConflicts []string `json:"rebase_conflicts,omitempty"`
Author PrincipalInfo `json:"author"`
Merger *PrincipalInfo `json:"merger"`
Stats PullReqStats `json:"stats"`
WebURL string `json:"web_url"`
Flow enum.PullRequestFlow `json:"flow"`
Labels []*LabelPullReqAssignmentInfo `json:"labels,omitempty"`
CheckSummary *CheckCountSummary `json:"check_summary,omitempty"`
Rules []RuleInfo `json:"rules,omitempty"`
}
PullReq represents a pull request.
func (*PullReq) MarkAsMergeUnchecked ¶
func (pr *PullReq) MarkAsMergeUnchecked()
func (*PullReq) MarkAsMergeable ¶
func (pr *PullReq) MarkAsMergeable()
func (*PullReq) MarkAsMerged ¶
func (pr *PullReq) MarkAsMerged()
func (*PullReq) MarkAsRebaseable ¶
func (pr *PullReq) MarkAsRebaseable()
func (*PullReq) UpdateMergeOutcome ¶
func (pr *PullReq) UpdateMergeOutcome(method enum.MergeMethod, conflictFiles []string)
type PullReqActivity ¶
type PullReqActivity struct {
ID int64 `json:"id"`
Version int64 `json:"-"` // not returned, it's an internal field
CreatedBy int64 `json:"-"` // not returned, because the author info is in the Author field
Created int64 `json:"created"`
Updated int64 `json:"updated"` // we need updated to determine the latest version reliably.
Edited int64 `json:"edited"`
Deleted *int64 `json:"deleted,omitempty"`
ParentID *int64 `json:"parent_id"`
RepoID int64 `json:"repo_id"`
PullReqID int64 `json:"pullreq_id"`
Order int64 `json:"order"`
SubOrder int64 `json:"sub_order"`
ReplySeq int64 `json:"-"` // not returned, because it's a server's internal field
Type enum.PullReqActivityType `json:"type"`
Kind enum.PullReqActivityKind `json:"kind"`
Text string `json:"text"`
PayloadRaw json.RawMessage `json:"payload"`
Metadata *PullReqActivityMetadata `json:"metadata,omitempty"`
ResolvedBy *int64 `json:"-"` // not returned, because the resolver info is in the Resolver field
Resolved *int64 `json:"resolved,omitempty"`
Author PrincipalInfo `json:"author"`
Resolver *PrincipalInfo `json:"resolver,omitempty"`
CodeComment *CodeCommentFields `json:"code_comment,omitempty"`
Mentions map[int64]*PrincipalInfo `json:"mentions,omitempty"` // used only in response
}
PullReqActivity represents a pull request activity.
func (*PullReqActivity) AsCodeComment ¶
func (a *PullReqActivity) AsCodeComment() *CodeComment
func (*PullReqActivity) GetPayload ¶
func (a *PullReqActivity) GetPayload() (PullReqActivityPayload, error)
GetPayload returns the payload of the activity. An error is returned in case there's an issue retrieving the payload from its raw value. NOTE: To ensure rawValue gets changed always use SetPayload() with the updated payload.
func (*PullReqActivity) IsBlocking ¶
func (a *PullReqActivity) IsBlocking() bool
IsBlocking returns true if the pull request activity (comment/code-comment) is blocking the pull request merge.
func (*PullReqActivity) IsReply ¶
func (a *PullReqActivity) IsReply() bool
func (*PullReqActivity) IsReplyable ¶
func (a *PullReqActivity) IsReplyable() bool
func (*PullReqActivity) IsValidCodeComment ¶
func (a *PullReqActivity) IsValidCodeComment() bool
func (*PullReqActivity) SetPayload ¶
func (a *PullReqActivity) SetPayload(payload PullReqActivityPayload) error
SetPayload sets the payload and verifies it's of correct type for the activity.
func (*PullReqActivity) UpdateMetadata ¶
func (a *PullReqActivity) UpdateMetadata(updates ...PullReqActivityMetadataUpdate)
UpdateMetadata updates the metadata with the provided options.
type PullReqActivityFilter ¶
type PullReqActivityFilter struct {
After int64 `json:"after"`
Before int64 `json:"before"`
Limit int `json:"limit"`
Types []enum.PullReqActivityType `json:"type"`
Kinds []enum.PullReqActivityKind `json:"kind"`
}
PullReqActivityFilter stores pull request activity query parameters.
type PullReqActivityMentionsMetadata ¶
type PullReqActivityMentionsMetadata struct {
IDs []int64 `json:"ids,omitempty"`
}
PullReqActivityMentionsMetadata contains metadata for code comment mentions.
func (*PullReqActivityMentionsMetadata) IsEmpty ¶
func (m *PullReqActivityMentionsMetadata) IsEmpty() bool
type PullReqActivityMetadata ¶
type PullReqActivityMetadata struct {
Suggestions *PullReqActivitySuggestionsMetadata `json:"suggestions,omitempty"`
Mentions *PullReqActivityMentionsMetadata `json:"mentions,omitempty"`
}
PullReqActivityMetadata contains metadata related to pull request activity.
func (*PullReqActivityMetadata) IsEmpty ¶
func (m *PullReqActivityMetadata) IsEmpty() bool
type PullReqActivityMetadataUpdate ¶
type PullReqActivityMetadataUpdate interface {
// contains filtered or unexported methods
}
func WithPullReqActivityMentionsMetadataUpdate ¶
func WithPullReqActivityMentionsMetadataUpdate( f func(m *PullReqActivityMentionsMetadata), ) PullReqActivityMetadataUpdate
func WithPullReqActivityMetadataUpdate ¶
func WithPullReqActivityMetadataUpdate(f func(m *PullReqActivityMetadata)) PullReqActivityMetadataUpdate
func WithPullReqActivitySuggestionsMetadataUpdate ¶
func WithPullReqActivitySuggestionsMetadataUpdate( f func(m *PullReqActivitySuggestionsMetadata), ) PullReqActivityMetadataUpdate
type PullReqActivityPayload ¶
type PullReqActivityPayload interface {
// ActivityType returns the pr activity type the payload is meant for.
// NOTE: this allows us to do easy payload type verification without any kind of reflection.
ActivityType() enum.PullReqActivityType
}
PullReqActivityPayload is an interface used to identify PR activity payload types. The approach is inspired by what protobuf is doing for oneof.
type PullReqActivitySuggestionsMetadata ¶
type PullReqActivitySuggestionsMetadata struct {
CheckSums []string `json:"check_sums,omitempty"`
AppliedCheckSum string `json:"applied_check_sum,omitempty"`
AppliedCommitSHA string `json:"applied_commit_sha,omitempty"`
}
PullReqActivitySuggestionsMetadata contains metadata for code comment suggestions.
func (*PullReqActivitySuggestionsMetadata) IsEmpty ¶
func (m *PullReqActivitySuggestionsMetadata) IsEmpty() bool
type PullReqCheck ¶
type PullReqChecks ¶
type PullReqChecks struct {
CommitSHA string `json:"commit_sha"`
Checks []PullReqCheck `json:"checks"`
}
type PullReqCreateInput ¶
type PullReqCreateInput struct {
LabelID int64 `json:"label_id"`
ValueID *int64 `json:"value_id"`
Value string `json:"value"`
}
func (PullReqCreateInput) Validate ¶
func (in PullReqCreateInput) Validate() error
type PullReqFileView ¶
type PullReqFileView struct {
PullReqID int64 `json:"-"`
PrincipalID int64 `json:"-"`
Path string `json:"path"`
SHA string `json:"sha"`
Obsolete bool `json:"obsolete"`
Created int64 `json:"-"`
Updated int64 `json:"-"`
}
PullReqFileView represents a file reviewed entry for a given pr and principal. NOTE: keep api lightweight and don't return unnecessary extra data.
type PullReqFilter ¶
type PullReqFilter struct {
Page int `json:"page"`
Size int `json:"size"`
Query string `json:"query"`
CreatedBy []int64 `json:"created_by"`
SourceRepoID int64 `json:"-"` // caller should use source_repo_ref
SourceRepoRef string `json:"source_repo_ref"`
SourceBranch string `json:"source_branch"`
TargetRepoID int64 `json:"-"`
TargetBranch string `json:"target_branch"`
States []enum.PullReqState `json:"state"`
Sort enum.PullReqSort `json:"sort"`
Order enum.Order `json:"order"`
LabelID []int64 `json:"label_id"`
ValueID []int64 `json:"value_id"`
AuthorID int64 `json:"author_id"`
CommenterID int64 `json:"commenter_id"`
ReviewerID int64 `json:"reviewer_id"`
ReviewDecisions []enum.PullReqReviewDecision `json:"review_decisions"`
MentionedID int64 `json:"mentioned_id"`
ExcludeDescription bool `json:"exclude_description"`
CreatedFilter
UpdatedFilter
EditedFilter
PullReqMetadataOptions
// internal use only
SpaceIDs []int64
RepoIDBlacklist []int64
}
PullReqFilter stores pull request query parameters.
type PullReqLabel ¶
type PullReqLabel struct {
PullReqID int64 `json:"pullreq_id"`
LabelID int64 `json:"label_id"`
ValueID *int64 `json:"value_id,omitempty"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
CreatedBy int64 `json:"created_by"`
UpdatedBy int64 `json:"updated_by"`
}
Used to assign label to pullreq.
type PullReqMetadataOptions ¶
type PullReqMetadataOptions struct {
IncludeChecks bool `json:"include_checks"`
IncludeRules bool `json:"include_rules"`
}
func (PullReqMetadataOptions) IsAllFalse ¶
func (options PullReqMetadataOptions) IsAllFalse() bool
type PullReqRepo ¶
type PullReqRepo struct {
PullRequest *PullReq `json:"pull_request"`
Repository *Repository `json:"repository"`
}
type PullReqReview ¶
type PullReqReview struct {
ID int64 `json:"id"`
CreatedBy int64 `json:"created_by"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
PullReqID int64 `json:"pullreq_id"`
Decision enum.PullReqReviewDecision `json:"decision"`
SHA string `json:"sha"`
}
PullReqReview holds pull request review.
type PullReqReviewer ¶
type PullReqReviewer struct {
PullReqID int64 `json:"-"`
PrincipalID int64 `json:"-"`
CreatedBy int64 `json:"-"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
RepoID int64 `json:"-"`
Type enum.PullReqReviewerType `json:"type"`
LatestReviewID *int64 `json:"latest_review_id"`
ReviewDecision enum.PullReqReviewDecision `json:"review_decision"`
SHA string `json:"sha"`
Reviewer PrincipalInfo `json:"reviewer"`
AddedBy PrincipalInfo `json:"added_by"`
}
PullReqReviewer holds pull request reviewer.
type PullReqStats ¶
type PullReqStats struct {
DiffStats
Conversations int `json:"conversations,omitempty"`
UnresolvedCount int `json:"unresolved_count,omitempty"`
}
PullReqStats shows Diff statistics and number of conversations.
type PullReqSummary ¶
type PullReqSummaryFilter ¶
type PullReqUpdateInput ¶
type PullReqUpdateInput struct {
LabelValueID *int64 `json:"label_value_id,omitempty"`
}
type PullRequestActivityLabel ¶
type PullRequestActivityLabel struct {
Label string `json:"label"`
LabelColor enum.LabelColor `json:"label_color"`
LabelScope int64 `json:"label_scope"`
Value *string `json:"value,omitempty"`
ValueColor *enum.LabelColor `json:"value_color,omitempty"`
OldValue *string `json:"old_value,omitempty"`
OldValueColor *enum.LabelColor `json:"old_value_color,omitempty"`
Type enum.PullReqLabelActivityType `json:"type"`
}
func (*PullRequestActivityLabel) ActivityType ¶
func (a *PullRequestActivityLabel) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadBranchDelete ¶
type PullRequestActivityPayloadBranchDelete struct {
SHA string `json:"sha"`
}
func (*PullRequestActivityPayloadBranchDelete) ActivityType ¶
func (a *PullRequestActivityPayloadBranchDelete) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadBranchRestore ¶
type PullRequestActivityPayloadBranchRestore struct {
SHA string `json:"sha"`
}
func (*PullRequestActivityPayloadBranchRestore) ActivityType ¶
func (a *PullRequestActivityPayloadBranchRestore) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadBranchUpdate ¶
type PullRequestActivityPayloadBranchUpdate struct {
Old string `json:"old"`
New string `json:"new"`
Forced bool `json:"forced"`
CommitTitle string `json:"commit_title"`
}
func (*PullRequestActivityPayloadBranchUpdate) ActivityType ¶
func (a *PullRequestActivityPayloadBranchUpdate) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadCodeComment ¶
type PullRequestActivityPayloadCodeComment struct {
Title string `json:"title"`
Lines []string `json:"lines"`
LineStartNew bool `json:"line_start_new"`
LineEndNew bool `json:"line_end_new"`
}
func (*PullRequestActivityPayloadCodeComment) ActivityType ¶
func (a *PullRequestActivityPayloadCodeComment) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadComment ¶
type PullRequestActivityPayloadComment struct{}
func (PullRequestActivityPayloadComment) ActivityType ¶
func (a PullRequestActivityPayloadComment) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadMerge ¶
type PullRequestActivityPayloadMerge struct {
MergeMethod enum.MergeMethod `json:"merge_method"`
MergeSHA string `json:"merge_sha"`
TargetSHA string `json:"target_sha"`
SourceSHA string `json:"source_sha"`
RulesBypassed bool `json:"rules_bypassed,omitempty"`
}
func (*PullRequestActivityPayloadMerge) ActivityType ¶
func (a *PullRequestActivityPayloadMerge) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadReviewSubmit ¶
type PullRequestActivityPayloadReviewSubmit struct {
CommitSHA string `json:"commit_sha"`
Decision enum.PullReqReviewDecision `json:"decision"`
}
func (*PullRequestActivityPayloadReviewSubmit) ActivityType ¶
func (a *PullRequestActivityPayloadReviewSubmit) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadReviewerAdd ¶
type PullRequestActivityPayloadReviewerAdd struct {
PrincipalID int64 `json:"principal_id"`
ReviewerType enum.PullReqReviewerType `json:"reviewer_type"`
}
func (*PullRequestActivityPayloadReviewerAdd) ActivityType ¶
func (a *PullRequestActivityPayloadReviewerAdd) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadReviewerDelete ¶
type PullRequestActivityPayloadReviewerDelete struct {
CommitSHA string `json:"commit_sha"`
Decision enum.PullReqReviewDecision `json:"decision"`
PrincipalID int64 `json:"principal_id"`
}
func (*PullRequestActivityPayloadReviewerDelete) ActivityType ¶
func (a *PullRequestActivityPayloadReviewerDelete) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadStateChange ¶
type PullRequestActivityPayloadStateChange struct {
Old enum.PullReqState `json:"old"`
New enum.PullReqState `json:"new"`
OldDraft bool `json:"old_draft"`
NewDraft bool `json:"new_draft"`
}
func (*PullRequestActivityPayloadStateChange) ActivityType ¶
func (a *PullRequestActivityPayloadStateChange) ActivityType() enum.PullReqActivityType
type PullRequestActivityPayloadTitleChange ¶
type PullRequestActivityPayloadTitleChange struct {
Old string `json:"old"`
New string `json:"new"`
}
func (*PullRequestActivityPayloadTitleChange) ActivityType ¶
func (a *PullRequestActivityPayloadTitleChange) ActivityType() enum.PullReqActivityType
type RebaseResponse ¶
type RebaseResponse struct {
AlreadyAncestor bool `json:"already_ancestor,omitempty"`
NewHeadBranchSHA sha.SHA `json:"new_head_branch_sha"`
RuleViolations []RuleViolations `json:"rule_violations,omitempty"`
DryRunRules bool `json:"dry_run_rules,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
ConflictFiles []string `json:"conflict_files,omitempty"`
}
type RenameDetails ¶
type RepoActiveInput ¶
type RepoActiveInput struct {
TimeRangeInput
Repos []string `json:"repos"`
}
func (*RepoActiveInput) Validate ¶
func (in *RepoActiveInput) Validate() error
type RepoActiveOutput ¶
type RepoCodeFrequencyOutput ¶
type RepoCodeFrequencyOutput struct {
Total int `json:"total"`
RepoPath string `json:"repo_path"`
RepoID int64 `json:"repo_id"`
Period string `json:"period"`
CommitStats []StatisticsCodeFrequencyStat `json:"stats"`
}
type RepoCommitUsersOutput ¶
type RepoCommitUsersOutput struct {
Total int `json:"total"`
RepoPath string `json:"repo_path"`
RepoID int64 `json:"repo_id"`
CommitStats []StatisticsCommitStat `json:"stats"`
}
type RepoCommitsInput ¶
type RepoCommitsInput struct {
TimeRangeInput
Repo string `json:"repo"`
}
func (*RepoCommitsInput) Validate ¶
func (in *RepoCommitsInput) Validate() error
type RepoCommitsOutput ¶
type RepoCommitsOutput struct {
Total int `json:"total"`
RepoPath string `json:"repo_path"`
RepoID int64 `json:"repo_id"`
Period string `json:"period"`
CommitStats []StatisticsCommitStat `json:"stats"`
}
type RepoFilter ¶
type RepoFilter struct {
Page int `json:"page"`
Size int `json:"size"`
Query string `json:"query"`
Sort enum.RepoAttr `json:"sort"`
Order enum.Order `json:"order"`
DeletedAt *int64 `json:"deleted_at,omitempty"`
DeletedBeforeOrAt *int64 `json:"deleted_before_or_at,omitempty"`
Recursive bool
}
RepoFilter stores repo query parameters.
type RepoTop10Output ¶
type RepoTop10Output struct {
RepoID string `json:"repo_id"`
RepoName string `json:"repo_name"`
CommitCount int `json:"commit_count"`
BranchCount int `json:"branch_count"`
TagCount int `json:"tag_count"`
PullReqCount int `json:"pull_req_count"`
PushReqCount int `json:"push_req_count"`
TotalReqCount int `json:"total_req_count"`
}
type Repository ¶
type Repository struct {
// TODO: int64 ID doesn't match DB
ID int64 `json:"id" yaml:"id"`
Version int64 `json:"-" yaml:"-"`
ParentID int64 `json:"parent_id" yaml:"parent_id"`
Identifier string `json:"identifier" yaml:"identifier"`
Path string `json:"path" yaml:"path"`
Description string `json:"description" yaml:"description"`
CreatedBy int64 `json:"created_by" yaml:"created_by"`
Created int64 `json:"created" yaml:"created"`
Updated int64 `json:"updated" yaml:"updated"`
Deleted *int64 `json:"deleted,omitempty" yaml:"deleted"`
// Size of the repository in KiB.
Size int64 `json:"size" yaml:"size"`
// SizeUpdated is the time when the Size was last updated.
SizeUpdated int64 `json:"size_updated" yaml:"size_updated"`
GitUID string `json:"-" yaml:"-"`
DefaultBranch string `json:"default_branch" yaml:"default_branch"`
ForkID int64 `json:"fork_id" yaml:"fork_id"`
PullReqSeq int64 `json:"-" yaml:"-"`
NumForks int `json:"num_forks" yaml:"num_forks"`
NumPulls int `json:"num_pulls" yaml:"num_pulls"`
NumClosedPulls int `json:"num_closed_pulls" yaml:"num_closed_pulls"`
NumOpenPulls int `json:"num_open_pulls" yaml:"num_open_pulls"`
NumMergedPulls int `json:"num_merged_pulls" yaml:"num_merged_pulls"`
Mirror bool `json:"mirror,omitempty" yaml:"mirror"`
State enum.RepoState `json:"state" yaml:"-"`
IsEmpty bool `json:"is_empty,omitempty" yaml:"is_empty"`
// git urls
GitURL string `json:"git_url" yaml:"-"`
GitSSHURL string `json:"git_ssh_url,omitempty" yaml:"-"`
}
Repository represents a code repository.
func (Repository) Clone ¶
func (r Repository) Clone() Repository
Clone makes deep copy of repository object.
func (Repository) GetGitUID ¶
func (r Repository) GetGitUID() string
type RepositoryCount ¶
type RepositoryGitInfo ¶
RepositoryGitInfo holds git info for a repository.
func (*RepositoryGitInfo) GetGitUID ¶
func (rgi *RepositoryGitInfo) GetGitUID() string
type RepositoryMirror ¶
type RepositoryMirror struct {
SyncInterval int64 `json:"sync_interval"`
EnablePrune bool `json:"enable_prune"`
UpdatedUnix int64 `json:"updated_unix"`
NextUpdateUnix int64 `json:"next_update_unix"`
LfsEnabled bool `json:"lfs_enabled"`
RemoteAddress string `json:"remote_address"`
Token string `json:"token,omitempty"`
RepoID int64 `json:"repo_id,omitempty"`
SpaceID int64 `json:"space_id,omitempty"`
RepoGitUID string `json:"repo_git_uid,omitempty"`
}
type RepositorySizeInfo ¶
type RepositoryStatistics ¶
type RepositoryStatistics struct {
CommitStats []CommitCount
Committer string `json:"author,omitempty"`
Total int `json:"total,omitempty"`
}
type RepositorySummary ¶
type RepositorySummary struct {
DefaultBranchCommitCount int `json:"default_branch_commit_count"`
BranchCount int `json:"branch_count"`
TagCount int `json:"tag_count"`
PullReqSummary RepositoryPullReqSummary `json:"pull_req_summary"`
}
type Resource ¶
type Resource struct {
Type enum.ResourceType
Identifier string
}
Resource represents the resource of a permission check. Note: Keep the name empty in case access is requested for all resources of that type.
type Rule ¶
type Rule struct {
ID int64 `json:"-"`
Version int64 `json:"-"`
CreatedBy int64 `json:"-"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
RepoID *int64 `json:"-"`
SpaceID *int64 `json:"-"`
Identifier string `json:"identifier"`
Description string `json:"description"`
Type RuleType `json:"type"`
State enum.RuleState `json:"state"`
Pattern json.RawMessage `json:"pattern"`
Definition json.RawMessage `json:"definition"`
CreatedByInfo PrincipalInfo `json:"created_by"`
Buildin bool `json:"buildin"`
Users map[int64]*PrincipalInfo `json:"users"`
UserGroups map[int64]*UserGroupInfo `json:"user_groups"`
}
func (Rule) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
func (Rule) MarshalYAML ¶
type RuleFilter ¶
type RuleInfo ¶
type RuleInfo struct {
SpacePath string `json:"space_path,omitempty"`
RepoPath string `json:"repo_path,omitempty"`
ID int64 `json:"-"`
Identifier string `json:"identifier"`
Type RuleType `json:"type"`
State enum.RuleState `json:"state"`
Buildin bool `json:"buildin"`
}
RuleInfo holds basic info about a rule that is used to describe the rule in RuleViolations.
func (RuleInfo) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
type RuleInfoInternal ¶
type RuleInfoInternal struct {
RuleInfo
Pattern json.RawMessage
Definition json.RawMessage
}
type RuleViolations ¶
type RuleViolations struct {
Rule RuleInfo `json:"rule"`
Bypassable bool `json:"bypassable"`
Bypassed bool `json:"bypassed"`
Violations []Violation `json:"violations"`
}
RuleViolations holds several violations of a rule.
func (*RuleViolations) Add ¶
func (violations *RuleViolations) Add(code, message string)
func (*RuleViolations) Addf ¶
func (violations *RuleViolations) Addf(code, format string, params ...any)
func (*RuleViolations) IsBypassed ¶
func (violations *RuleViolations) IsBypassed() bool
func (*RuleViolations) IsCritical ¶
func (violations *RuleViolations) IsCritical() bool
type RulesViolations ¶
type RulesViolations struct {
Message string `json:"message"`
Violations []RuleViolations `json:"violations"`
}
type SaveInput ¶
type SaveInput struct {
Label SaveLabelInput `json:"label"`
Values []*SaveLabelValueInput `json:"values,omitempty"`
}
type SaveLabelInput ¶
type SaveLabelInput struct {
ID int64 `json:"id"`
DefineLabelInput
}
type SaveLabelValueInput ¶
type SaveLabelValueInput struct {
ID int64 `json:"id"`
DefineValueInput
}
type Scope ¶
Scope represents the scope of a permission check Notes:
- In case the permission check is for resource REPO, keep repo empty (repo is resource, not scope)
- In case the permission check is for resource SPACE, SpacePath is an ancestor of the space (space is resource, not scope)
- Repo isn't use as of now (will be useful once we add access control for repo child resources, e.g. branches).
type ScopeData ¶
type ScopeData struct {
// Scope = 0 is repo, scope >= 1 is a depth level of a space
Scope int64 `json:"scope"`
Space *Space `json:"space,omitempty"`
Repo *Repository `json:"repository,omitempty"`
}
type ScopesLabels ¶
type ScopesLabels struct {
ScopeData []*ScopeData `json:"scope_data"`
LabelData []*LabelAssignment `json:"label_data"`
}
Used to fetch label and values from a repo and space hierarchy.
type SearchAssetOption ¶
type SearchInput ¶
type SearchInput struct {
Query string `json:"query"`
// RepoPaths contains the paths of repositories to search in
RepoPaths []string `json:"repo_paths"`
// SpacePaths contains the paths of spaces to search in
SpacePaths []string `json:"space_paths"`
// MaxResultCount is the maximum number of results to return
MaxResultCount int `json:"max_result_count"`
// EnableRegex enables regex search on the query
EnableRegex bool `json:"enable_regex"`
// Search all the repos in a space and its subspaces recursively.
// Valid only when spacePaths is set.
Recursive bool `json:"recursive"`
}
type SearchResult ¶
type SearchResult struct {
FileMatches []FileMatch `json:"file_matches"`
Stats SearchStats `json:"stats"`
}
type SearchStats ¶
type SearchVersionOption ¶
type Secret ¶
type Secret struct {
ID int64 `db:"secret_id" gorm:"column:secret_id;primaryKey" json:"-"`
Description string `db:"secret_description" gorm:"column:secret_description" json:"description"`
SpaceID int64 `db:"secret_space_id" gorm:"column:secret_space_id" json:"space_id"`
CreatedBy int64 `db:"secret_created_by" gorm:"column:secret_created_by" json:"created_by"`
Identifier string `db:"secret_uid" gorm:"column:secret_uid" json:"identifier"`
Data string `db:"secret_data" gorm:"column:secret_data" json:"-"`
Created int64 `db:"secret_created" gorm:"column:secret_created" json:"created"`
Updated int64 `db:"secret_updated" gorm:"column:secret_updated" json:"updated"`
Version int64 `db:"secret_version" gorm:"column:secret_version" json:"-"`
}
func (*Secret) CopyWithoutData ¶
Copy makes a copy of the secret without the value.
func (Secret) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
type Service ¶
type Service struct {
// Fields from Principal
ID int64 `db:"principal_id" gorm:"column:principal_id;primaryKey" json:"-"`
UID string `db:"principal_uid" gorm:"column:principal_uid" json:"uid"`
Email string `db:"principal_email" gorm:"column:principal_email" json:"email"`
DisplayName string `db:"principal_display_name" gorm:"column:principal_display_name" json:"display_name"`
Admin bool `db:"principal_admin" gorm:"column:principal_admin" json:"admin"`
Blocked bool `db:"principal_blocked" gorm:"column:principal_blocked" json:"blocked"`
Salt string `db:"principal_salt" gorm:"column:principal_salt" json:"-"`
Created int64 `db:"principal_created" gorm:"column:principal_created" json:"created"`
Updated int64 `db:"principal_updated" gorm:"column:principal_updated" json:"updated"`
}
Service is a principal representing a different internal service that runs alongside gitness.
func (*Service) ToPrincipal ¶
func (*Service) ToPrincipalInfo ¶
func (s *Service) ToPrincipalInfo() *PrincipalInfo
type ServiceAccount ¶
type ServiceAccount struct {
// Fields from Principal (without admin, as it's never an admin)
ID int64 `db:"principal_id" gorm:"column:principal_id;primaryKey" json:"-"`
UID string `db:"principal_uid" gorm:"column:principal_uid" json:"uid"`
Email string `db:"principal_email" gorm:"column:principal_email" json:"email"`
DisplayName string `db:"principal_display_name" gorm:"column:principal_display_name" json:"display_name"`
Admin bool `db:"principal_admin" gorm:"column:principal_admin" json:"admin"`
Blocked bool `db:"principal_blocked" gorm:"column:principal_blocked" json:"blocked"`
Salt string `db:"principal_salt" gorm:"column:principal_salt" json:"-"`
Created int64 `db:"principal_created" gorm:"column:principal_created" json:"created"`
Updated int64 `db:"principal_updated" gorm:"column:principal_updated" json:"updated"`
// ServiceAccount specific fields
ParentType enum.ParentResourceType `db:"principal_sa_parent_type" gorm:"column:principal_sa_parent_type" json:"parent_type"`
ParentID int64 `db:"principal_sa_parent_id" gorm:"column:principal_sa_parent_id" json:"parent_id"`
}
ServiceAccount is a principal representing a service account.
func (*ServiceAccount) ToPrincipal ¶
func (s *ServiceAccount) ToPrincipal() *Principal
func (*ServiceAccount) ToPrincipalInfo ¶
func (s *ServiceAccount) ToPrincipalInfo() *PrincipalInfo
type ServiceAccountInput ¶
type ServiceAccountInput struct {
DisplayName *string `json:"display_name"`
ParentType *enum.ParentResourceType `json:"parent_type"`
ParentID *int64 `json:"parent_id"`
}
ServiceAccountInput store details used to create or update a service account.
type Space ¶
type Space struct {
ID int64 `json:"id"`
Version int64 `json:"-"`
ParentID int64 `json:"parent_id"`
Path string `json:"path"`
Identifier string `json:"identifier"`
Description string `json:"description"`
CreatedBy int64 `json:"created_by"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Deleted *int64 `json:"deleted,omitempty"`
}
Space represents a space. There isn't a one-solves-all hierarchical data structure for DBs, so for now we are using a mix of materialized paths and adjacency list. Every space stores its parent, and a space's path (and aliases) is stored in a separate table. PRO: Quick lookup of childs, quick lookup based on fqdn (apis). CON: we require a separate table.
Interesting reads: https://stackoverflow.com/questions/4048151/what-are-the-options-for-storing-hierarchical-data-in-a-relational-database https://www.slideshare.net/billkarwin/models-for-hierarchical-data
type SpaceFilter ¶
type SpaceFilter struct {
Page int `json:"page"`
Size int `json:"size"`
Query string `json:"query"`
Sort enum.SpaceAttr `json:"sort"`
Order enum.Order `json:"order"`
DeletedAt *int64 `json:"deleted_at,omitempty"`
DeletedBeforeOrAt *int64 `json:"deleted_before_or_at,omitempty"`
Recursive bool `json:"recursive"`
}
SpaceFilter stores spaces query parameters.
type SpaceParentData ¶
type SpacePath ¶
type SpacePath struct {
Value string `json:"value"`
IsPrimary bool `json:"is_primary"`
SpaceID int64 `json:"space_id"`
}
SpacePath represents a full path to a space.
type SpacePathSegment ¶
type SpacePathSegment struct {
// TODO: int64 ID doesn't match DB
ID int64 `json:"-"`
Identifier string `json:"identifier"`
IsPrimary bool `json:"is_primary"`
SpaceID int64 `json:"space_id"`
ParentID int64 `json:"parent_id"`
CreatedBy int64 `json:"created_by"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
}
SpacePathSegment represents a segment of a path to a space.
func (SpacePathSegment) MarshalJSON ¶
func (s SpacePathSegment) MarshalJSON() ([]byte, error)
TODO [CODE-1363]: remove after identifier migration.
type SquashResponse ¶
type Stage ¶
type Stage struct {
ID int64 `json:"-"`
ExecutionID int64 `json:"execution_id"`
RepoID int64 `json:"repo_id"`
Number int64 `json:"number"`
Name string `json:"name"`
Display string `json:"-"`
Kind string `json:"kind,omitempty"`
Type string `json:"type,omitempty"`
Status enum.CIStatus `json:"status"`
Error string `json:"error,omitempty"`
ErrIgnore bool `json:"errignore,omitempty"`
ExitCode int `json:"exit_code"`
Machine string `json:"machine,omitempty"`
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
Variant string `json:"variant,omitempty"`
Kernel string `json:"kernel,omitempty"`
Limit int `json:"limit,omitempty"`
LimitRepo int `json:"throttle,omitempty"`
Started int64 `json:"started,omitempty"`
Stopped int64 `json:"stopped,omitempty"`
Created int64 `json:"-"`
Updated int64 `json:"-"`
Version int64 `json:"-"`
OnSuccess bool `json:"on_success"`
OnFailure bool `json:"on_failure"`
DependsOn []string `json:"depends_on,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Steps []*Step `json:"steps,omitempty"`
}
type StatisticsCommitStat ¶
type Step ¶
type Step struct {
ID int64 `json:"-"`
StageID int64 `json:"-"`
Number int64 `json:"number"`
Name string `json:"name"`
Display string `json:"-"`
Status enum.CIStatus `json:"status"`
Error string `json:"error,omitempty"`
ErrIgnore bool `json:"errignore,omitempty"`
ExitCode int `json:"exit_code"`
Started int64 `json:"started,omitempty"`
Stopped int64 `json:"stopped,omitempty"`
Version int64 `json:"-" db:"step_version"`
DependsOn []string `json:"depends_on,omitempty"`
Image string `json:"image,omitempty"`
Detached bool `json:"detached"`
Schema string `json:"schema,omitempty"`
}
type StorageProviderType ¶
type StorageProviderType string
const ( StorageProviderLocal StorageProviderType = "local" StorageProviderS3 StorageProviderType = "s3" )
type SystemCommitsInput ¶
type SystemCommitsInput struct {
TimeRangeInput
}
func (*SystemCommitsInput) Validate ¶
func (in *SystemCommitsInput) Validate() error
type SystemCommitsOutput ¶
type SystemCommitsOutput struct {
Total int `json:"total"`
Period string `json:"period"`
CommitStats []StatisticsCommitStat `json:"stats"`
}
type TagFilter ¶
type TagFilter struct {
Query string `json:"query"`
Sort enum.TagSortOption `json:"sort"`
Order enum.Order `json:"order"`
Page int `json:"page"`
Size int `json:"size"`
}
TagFilter stores commit tag query parameters.
type Template ¶
type Template struct {
ID int64 `db:"template_id" gorm:"column:template_id;primaryKey" json:"-"`
Description string `db:"template_description" gorm:"column:template_description" json:"description"`
Type enum.ResolverType `db:"template_type" gorm:"column:template_type" json:"type"`
SpaceID int64 `db:"template_space_id" gorm:"column:template_space_id" json:"space_id"`
Identifier string `db:"template_uid" gorm:"column:template_uid" json:"identifier"`
Data string `db:"template_data" gorm:"column:template_data" json:"data"`
Created int64 `db:"template_created" gorm:"column:template_created" json:"created"`
Updated int64 `db:"template_updated" gorm:"column:template_updated" json:"updated"`
Version int64 `db:"template_version" gorm:"column:template_version" json:"-"`
}
func (Template) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
type TimeRangeInput ¶
type TimeRangeInput struct {
BeginTime string `json:"begin_time,omitempty"`
EndTime string `json:"end_time,omitempty"`
Period string `json:"period,omitempty"`
}
func (*TimeRangeInput) ValidateTimeRange ¶
func (t *TimeRangeInput) ValidateTimeRange() error
type Token ¶
type Token struct {
// TODO: int64 ID doesn't match DB
ID int64 `db:"token_id" gorm:"column:token_id;primaryKey" json:"-"`
PrincipalID int64 `db:"token_principal_id" gorm:"column:token_principal_id" json:"principal_id"`
Type enum.TokenType `db:"token_type" gorm:"column:token_type" json:"type"`
Identifier string `db:"token_uid" gorm:"column:token_uid" json:"identifier"`
// ExpiresAt is an optional unix time that if specified restricts the validity of a token.
ExpiresAt *int64 `db:"token_expires_at" gorm:"column:token_expires_at" json:"expires_at,omitempty"`
// IssuedAt is the unix time at which the token was issued.
IssuedAt int64 `db:"token_issued_at" gorm:"column:token_issued_at" json:"issued_at"`
CreatedBy int64 `db:"token_created_by" gorm:"column:token_created_by" json:"created_by"`
}
Represents server side infos stored for tokens we distribute.
func (Token) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
type TokenResponse ¶
TokenResponse is returned as part of token creation for PAT / SAT / User Session.
type Trigger ¶
type Trigger struct {
ID int64 `json:"-"`
Description string `json:"description"`
Type string `json:"trigger_type"`
PipelineID int64 `json:"pipeline_id"`
Secret string `json:"-"`
RepoID int64 `json:"repo_id"`
CreatedBy int64 `json:"created_by"`
Disabled bool `json:"disabled"`
Actions []enum.TriggerAction `json:"actions"`
Identifier string `json:"identifier"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Version int64 `json:"-"`
}
func (Trigger) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
type UpdateLabelInput ¶
type UpdateLabelInput struct {
Key *string `json:"key,omitempty"`
Type *enum.LabelType `json:"type,omitempty"`
Description *string `json:"description,omitempty"`
Color *enum.LabelColor `json:"color,omitempty"`
}
func (*UpdateLabelInput) Sanitize ¶
func (in *UpdateLabelInput) Sanitize() error
type UpdateValueInput ¶
type UpdateValueInput struct {
Value *string `json:"value"`
Color *enum.LabelColor `json:"color"`
}
func (*UpdateValueInput) Sanitize ¶
func (in *UpdateValueInput) Sanitize() error
type UpdatedFilter ¶
type User ¶
type User struct {
// Fields from Principal
ID int64 `db:"principal_id" gorm:"column:principal_id;primaryKey" json:"id"`
UID string `db:"principal_uid" gorm:"column:principal_uid" json:"uid"`
Email string `db:"principal_email" gorm:"column:principal_email" json:"email"`
DisplayName string `db:"principal_display_name" gorm:"column:principal_display_name" json:"display_name"`
Admin bool `db:"principal_admin" gorm:"column:principal_admin" json:"admin"`
Blocked bool `db:"principal_blocked" gorm:"column:principal_blocked" json:"blocked"`
Salt string `db:"principal_salt" gorm:"column:principal_salt" json:"-"`
Created int64 `db:"principal_created" gorm:"column:principal_created" json:"created"`
Updated int64 `db:"principal_updated" gorm:"column:principal_updated" json:"updated"`
// User specific fields
Password string `db:"principal_user_password" gorm:"column:principal_user_password" json:"-"`
// Source is the source of the user account.
Source enum.PrincipalSource `db:"principal_user_source" gorm:"column:principal_user_source" json:"-"`
}
User is a principal representing an end user.
func (*User) ToPrincipal ¶
func (*User) ToPrincipalInfo ¶
func (u *User) ToPrincipalInfo() *PrincipalInfo
type UserCodeFrequencyInput ¶
type UserCodeFrequencyInput struct {
TimeRangeInput
User string `json:"user"`
}
func (*UserCodeFrequencyInput) Validate ¶
func (in *UserCodeFrequencyInput) Validate() error
type UserCodeFrequencyOutput ¶
type UserCodeFrequencyOutput struct {
Total int `json:"total"`
User string `json:"user"`
Period string `json:"period"`
CommitStats []StatisticsCodeFrequencyStat `json:"stats"`
}
type UserFilter ¶
type UserFilter struct {
Page int `json:"page"`
Size int `json:"size"`
Sort enum.UserAttr `json:"sort"`
Order enum.Order `json:"order"`
Admin bool `json:"admin"`
}
UserFilter stores user query parameters.
type UserGroup ¶
type UserGroup struct {
ID int64 `json:"-"`
Identifier string `json:"identifier"`
Name string `json:"name"`
Description string `json:"description"`
SpaceID int64 `json:"-"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Users []string // Users are used by the code owners code
}
func (*UserGroup) ToUserGroupInfo ¶
func (u *UserGroup) ToUserGroupInfo() *UserGroupInfo
type UserGroupInfo ¶
type UserGroupOwnerEvaluation ¶
type UserGroupOwnerEvaluation struct {
ID string `json:"id"`
Name string `json:"name"`
Evaluations []OwnerEvaluation `json:"evaluations"`
}
type UserGroupReviewer ¶
type UserGroupReviewer struct {
PullReqID int64 `json:"-"`
UserGroupID int64 `json:"-"`
CreatedBy int64 `json:"-"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
RepoID int64 `json:"-"`
AddedBy PrincipalInfo `json:"added_by"`
UserGroup UserGroupInfo `json:"reviewer_group"`
// Reviewers Info
Reviewers []UserGroupReviewerDecision `json:"reviewers"`
}
type UserGroupReviewerDecision ¶
type UserGroupReviewerDecision struct {
ReviewDecision enum.PullReqReviewDecision `json:"review_decision"`
SHA string `json:"sha"`
Reviewer PrincipalInfo `json:"reviewer"`
}
type UserInput ¶
type UserInput struct {
Email *string `json:"email"`
Password *string `json:"password"`
Name *string `json:"name"`
Admin *bool `json:"admin"`
}
UserInput store user account details used to create or update a user.
type Violation ¶
type Violation struct {
Code string `json:"code"`
Message string `json:"message"`
Params []any `json:"params"`
}
Violation represents a single violation.
type Webhook ¶
type Webhook struct {
// TODO [CODE-1364]: Hide once UID/Identifier migration is completed.
ID int64 `json:"id"`
Version int64 `json:"version"`
ParentID int64 `json:"parent_id"`
ParentType enum.WebhookParent `json:"parent_type"`
CreatedBy int64 `json:"created_by"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Internal bool `json:"-"`
Identifier string `json:"identifier"`
// TODO [CODE-1364]: Remove once UID/Identifier migration is completed.
DisplayName string `json:"display_name"`
Description string `json:"description"`
URL string `json:"url"`
Secret string `json:"-"`
Enabled bool `json:"enabled"`
Insecure bool `json:"insecure"`
Triggers []enum.WebhookTrigger `json:"triggers"`
LatestExecutionResult *enum.WebhookExecutionResult `json:"latest_execution_result,omitempty"`
}
Webhook represents a webhook.
func (*Webhook) MarshalJSON ¶
MarshalJSON overrides the default json marshaling for `Webhook` allowing us to inject the `HasSecret` field. NOTE: This is required as we don't expose the `Secret` field and thus the caller wouldn't know whether the webhook contains a secret or not. NOTE: This is used as an alternative to adding an `HasSecret` field to Webhook itself, which would require us to keep `HasSecret` in sync with the `Secret` field, while `HasSecret` is not used internally at all.
type WebhookCreateInput ¶
type WebhookCreateInput struct {
// TODO [CODE-1363]: remove after identifier migration.
UID string `json:"uid" deprecated:"true"`
Identifier string `json:"identifier"`
// TODO [CODE-1364]: Remove once UID/Identifier migration is completed.
DisplayName string `json:"display_name"`
Description string `json:"description"`
URL string `json:"url"`
Secret string `json:"secret"`
Enabled bool `json:"enabled"`
Insecure bool `json:"insecure"`
Triggers []enum.WebhookTrigger `json:"triggers"`
}
type WebhookExecution ¶
type WebhookExecution struct {
ID int64 `json:"id"`
RetriggerOf *int64 `json:"retrigger_of,omitempty"`
Retriggerable bool `json:"retriggerable"`
Created int64 `json:"created"`
WebhookID int64 `json:"webhook_id"`
TriggerType enum.WebhookTrigger `json:"trigger_type"`
TriggerID string `json:"-"`
Result enum.WebhookExecutionResult `json:"result"`
Duration int64 `json:"duration"`
Error string `json:"error,omitempty"`
Request WebhookExecutionRequest `json:"request"`
Response WebhookExecutionResponse `json:"response"`
}
WebhookExecution represents a single execution of a webhook.
type WebhookExecutionFilter ¶
WebhookExecutionFilter stores WebhookExecution query parameters for listing.
type WebhookExecutionRequest ¶
type WebhookExecutionRequest struct {
URL string `json:"url"`
Headers string `json:"headers"`
Body string `json:"body"`
}
WebhookExecutionRequest represents the request of a webhook execution.
type WebhookExecutionResponse ¶
type WebhookExecutionResponse struct {
StatusCode int `json:"status_code"`
Status string `json:"status"`
Headers string `json:"headers"`
Body string `json:"body"`
}
WebhookExecutionResponse represents the response of a webhook execution.
type WebhookFilter ¶
type WebhookFilter struct {
Query string `json:"query"`
Page int `json:"page"`
Size int `json:"size"`
Sort enum.WebhookAttr `json:"sort"`
Order enum.Order `json:"order"`
SkipInternal bool `json:"-"`
}
WebhookFilter stores Webhook query parameters for listing.
type WebhookParentInfo ¶
type WebhookParentInfo struct {
Type enum.WebhookParent
ID int64
}
type WebhookUpdateInput ¶
type WebhookUpdateInput struct {
// TODO [CODE-1363]: remove after identifier migration.
UID *string `json:"uid" deprecated:"true"`
Identifier *string `json:"identifier"`
// TODO [CODE-1364]: Remove once UID/Identifier migration is completed.
DisplayName *string `json:"display_name"`
Description *string `json:"description"`
URL *string `json:"url"`
Secret *string `json:"secret"`
Enabled *bool `json:"enabled"`
Insecure *bool `json:"insecure"`
Triggers []enum.WebhookTrigger `json:"triggers"`
}
Source Files
¶
- ai.go
- artifact.go
- artifact_opt.go
- artifact_resp.go
- authz.go
- branch.go
- check.go
- code_comment.go
- codeowners.go
- commit.go
- config.go
- connector.go
- connector_auth.go
- connector_config.go
- connector_test_response.go
- devcontainer_config.go
- execution.go
- execution_analysis.go
- git.go
- git_gitfox.go
- githook.go
- github_connector_data.go
- gitspace.go
- gitspace_event.go
- gitspace_port.go
- infra_provider.go
- infra_provisioned.go
- infrastructure.go
- job.go
- label.go
- list_filters.go
- membership.go
- pagination.go
- path.go
- pipeline.go
- plugin.go
- principal.go
- public_key.go
- pullreq.go
- pullreq_activity.go
- pullreq_activity_metadata.go
- pullreq_activity_payload.go
- rebase.go
- repo.go
- rule.go
- search.go
- secret.go
- secret_ref.go
- service.go
- service_account.go
- space.go
- stage.go
- statistics.go
- step.go
- stream.go
- template.go
- token.go
- trigger.go
- user.go
- usergroup.go
- webhook.go