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
- type AssignableLabelFilter
- type BranchFilter
- type ChangeStats
- type Check
- type CheckListOptions
- type CheckPayload
- type CheckPayloadInternal
- type CheckPayloadText
- type CheckRecentOptions
- type CheckResult
- type CodeComment
- type CodeCommentFields
- type CodeOwnerEvaluation
- type CodeOwnerEvaluationEntry
- type CodeOwnersValidation
- type CodeOwnersViolation
- type Commit
- type CommitFileStats
- type CommitFilesResponse
- type CommitFilter
- type CommitStats
- type Config
- type Connector
- type CreatedFilter
- type DefineLabelInput
- type DefineValueInput
- type DevcontainerConfig
- type DiffStats
- type Execution
- type FileMatch
- type Fragment
- type GithookInputBase
- type GithookPostReceiveInput
- type GithookPreReceiveInput
- type GithookUpdateInput
- type GitspaceConfig
- type GitspaceEvent
- type GitspaceEventFilter
- type GitspaceEventResponse
- type GitspaceFilter
- type GitspaceInstance
- type Identity
- type InfraProviderConfig
- type InfraProviderParameter
- type InfraProviderParameterSchema
- type InfraProviderResource
- type InfraProviderTemplate
- type InfraProvisioned
- type InfraProvisionedGatewayView
- type InfraProvisionedResponse
- type InfraProvisionedUpdateGatewayRequest
- type Infrastructure
- type Label
- type LabelAssignment
- type LabelFilter
- type LabelInfo
- type LabelPullReqAssignmentInfo
- type LabelValue
- type LabelValueInfo
- type LabelWithValues
- type ListCommitResponse
- 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 PullReqReview
- type PullReqReviewer
- type PullReqStats
- type PullReqUpdateInput
- type PullRequestActivityLabel
- type PullRequestActivityPayloadBranchDelete
- type PullRequestActivityPayloadBranchUpdate
- type PullRequestActivityPayloadCodeComment
- type PullRequestActivityPayloadComment
- type PullRequestActivityPayloadMerge
- type PullRequestActivityPayloadReviewSubmit
- type PullRequestActivityPayloadReviewerDelete
- type PullRequestActivityPayloadStateChange
- type PullRequestActivityPayloadTitleChange
- type RenameDetails
- type RepoFilter
- type Repository
- type RepositoryGitInfo
- type RepositoryPullReqSummary
- type RepositorySizeInfo
- 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 SearchInput
- type SearchResult
- type SearchStats
- type Secret
- type Service
- type ServiceAccount
- type ServiceAccountInput
- type Signature
- type Space
- type SpaceFilter
- type SpacePath
- type SpacePathSegment
- type Stage
- type Step
- type Stream
- type TagFilter
- type Template
- type Token
- type TokenResponse
- type Trigger
- type UpdateLabelInput
- type UpdateValueInput
- type User
- type UserFilter
- type UserGroup
- type UserGroupOwnerEvaluation
- type UserInput
- type Violation
- type Webhook
- type WebhookExecution
- type WebhookExecutionFilter
- type WebhookExecutionRequest
- type WebhookExecutionResponse
- type WebhookFilter
Constants ¶
const AnonymousPrincipalUID = "anonymous"
AnonymousPrincipalUID is an internal UID for anonymous principals.
const NilSHA = "0000000000000000000000000000000000000000"
const (
PathSeparator = "/"
)
Variables ¶
var ( // ErrNoPayload is returned in case the activity doesn't have any payload set. ErrNoPayload = errors.New("activity has no payload") )
Functions ¶
This section is empty.
Types ¶
type AssignableLabelFilter ¶
type AssignableLabelFilter struct { ListQueryFilter Assignable bool `json:"assignable,omitempty"` }
LabelFilter stores label query parameters.
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"` }
BranchFilter stores branch query parameters.
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 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 gitness 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"` Status enum.CheckStatus `json:"status" db:"check_status"` }
func (CheckResult) MarshalJSON ¶
func (s CheckResult) MarshalJSON() ([]byte, error)
TODO [CODE-1363]: remove after identifier migration.
type CodeComment ¶
type CodeComment struct { ID int64 `db:"pullreq_activity_id"` Version int64 `db:"pullreq_activity_version"` Updated int64 `db:"pullreq_activity_updated"` CodeCommentFields }
type CodeCommentFields ¶
type CodeCommentFields struct { Outdated bool `db:"pullreq_activity_outdated" json:"outdated"` MergeBaseSHA string `db:"pullreq_activity_code_comment_merge_base_sha" json:"merge_base_sha"` SourceSHA string `db:"pullreq_activity_code_comment_source_sha" json:"source_sha"` Path string `db:"pullreq_activity_code_comment_path" json:"path"` LineNew int `db:"pullreq_activity_code_comment_line_new" json:"line_new"` SpanNew int `db:"pullreq_activity_code_comment_span_new" json:"span_new"` LineOld int `db:"pullreq_activity_code_comment_line_old" json:"line_old"` SpanOld int `db:"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 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 { DryRunRules bool `json:"dry_run_rules,omitempty"` CommitID string `json:"commit_id"` RuleViolations []RuleViolations `json:"rule_violations,omitempty"` }
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"` 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 gitness instance. // NOTE: If the value is not provided the hostname of the machine is used. InstanceID string `envconfig:"GITNESS_INSTANCE_ID"` Debug bool `envconfig:"GITNESS_DEBUG"` Trace bool `envconfig:"GITNESS_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:"GITNESS_GRACEFUL_SHUTDOWN_TIME" default:"300s"` UserSignupEnabled bool `envconfig:"GITNESS_USER_SIGNUP_ENABLED" default:"true"` NestedSpacesEnabled bool `envconfig:"GITNESS_NESTED_SPACES_ENABLED" default:"false"` // PublicResourceCreationEnabled specifies whether a user can create publicly accessible resources. PublicResourceCreationEnabled bool `envconfig:"GITNESS_PUBLIC_RESOURCE_CREATION_ENABLED" default:"true"` Profiler struct { Type string `envconfig:"GITNESS_PROFILER_TYPE"` ServiceName string `envconfig:"GITNESS_PROFILER_SERVICE_NAME" default:"gitness"` } // 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 HTTP.Server unless explicitly specified (e.g. http://localhost:3000). Base string `envconfig:"GITNESS_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 gitness // 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:"GITNESS_URL_GIT"` // GitSSH defines the external URL via which the GIT SSH server is reachable. GitSSH string `envconfig:"GITNESS_URL_GIT_SSH" default:"localhost"` // API defines the external URL via which the rest API is reachable. // NOTE: for routing to work properly, the request path reaching gitness 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:"GITNESS_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:"GITNESS_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:"GITNESS_URL_INTERNAL"` // Container is the endpoint that can be used by running container builds to communicate // with gitness (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:"GITNESS_URL_CONTAINER"` } // 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:"GITNESS_GIT_TRACE"` // DefaultBranch specifies the default branch for new repositories. DefaultBranch string `envconfig:"GITNESS_GIT_DEFAULTBRANCH" default:"main"` // Root specifies the directory containing git related data (e.g. repos, ...) Root string `envconfig:"GITNESS_GIT_ROOT"` // TmpDir (optional) specifies the directory for temporary data (e.g. repo clones, ...) TmpDir string `envconfig:"GITNESS_GIT_TMP_DIR"` // HookPath points to the binary used as git server hook. HookPath string `envconfig:"GITNESS_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:"GITNESS_GIT_LAST_COMMIT_CACHE_MODE" default:"inmemory"` // Duration defines cache duration of last commit. Duration time.Duration `envconfig:"GITNESS_GIT_LAST_COMMIT_CACHE_DURATION" default:"12h"` } } // Encrypter defines the parameters for the encrypter Encrypter struct { Secret string `envconfig:"GITNESS_ENCRYPTER_SECRET"` // key used for encryption MixedContent bool `envconfig:"GITNESS_ENCRYPTER_MIXED_CONTENT"` } // Server defines the server configuration parameters. Server struct { // HTTP defines the http configuration parameters HTTP struct { Port int `envconfig:"GITNESS_HTTP_PORT" default:"3000"` Proto string `envconfig:"GITNESS_HTTP_PROTO" default:"http"` } // Acme defines Acme configuration parameters. Acme struct { Enabled bool `envconfig:"GITNESS_ACME_ENABLED"` Endpont string `envconfig:"GITNESS_ACME_ENDPOINT"` Email bool `envconfig:"GITNESS_ACME_EMAIL"` Host string `envconfig:"GITNESS_ACME_HOST"` } } SSH struct { Enable bool `envconfig:"GITNESS_SSH_ENABLE" default:"false"` Host string `envconfig:"GITNESS_SSH_HOST"` Port int `envconfig:"GITNESS_SSH_PORT" default:"22"` // 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:"GITNESS_SSH_DEFAULT_USER" default:"git"` Ciphers []string `envconfig:"GITNESS_SSH_CIPHERS"` KeyExchanges []string `envconfig:"GITNESS_SSH_KEY_EXCHANGES"` MACs []string `envconfig:"GITNESS_SSH_MACS"` ServerHostKeys []string `envconfig:"GITNESS_SSH_HOST_KEYS"` TrustedUserCAKeys []string `envconfig:"GITNESS_SSH_TRUSTED_USER_CA_KEYS"` TrustedUserCAKeysFile string `envconfig:"GITNESS_SSH_TRUSTED_USER_CA_KEYS_FILENAME"` TrustedUserCAKeysParsed []gossh.PublicKey KeepAliveInterval time.Duration `envconfig:"GITNESS_SSH_KEEP_ALIVE_INTERVAL" default:"5s"` } // CI defines configuration related to build executions. CI struct { ParallelWorkers int `envconfig:"GITNESS_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. //nolint:lll PluginsZipURL string `envconfig:"GITNESS_CI_PLUGINS_ZIP_URL" default:"https://github.com/bradrydzewski/plugins/archive/refs/heads/master.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 gitness container so that they can interact via the container name. // In that case, GITNESS_URL_CONTAINER should also be changed // (eg to http://<gitness_container_name>:<port>). ContainerNetworks []string `envconfig:"GITNESS_CI_CONTAINER_NETWORKS"` } // Database defines the database configuration parameters. Database struct { Driver string `envconfig:"GITNESS_DATABASE_DRIVER" default:"sqlite3"` Datasource string `envconfig:"GITNESS_DATABASE_DATASOURCE" default:"database.sqlite3"` } // 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:"GITNESS_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:"GITNESS_BLOBSTORE_BUCKET"` // In case of GCS provider, this is expected to be the path to the service account key file. KeyPath string `envconfig:"GITNESS_BLOBSTORE_KEY_PATH" default:""` // Email ID of the google service account that needs to be impersonated TargetPrincipal string `envconfig:"GITNESS_BLOBSTORE_TARGET_PRINCIPAL" default:""` ImpersonationLifetime time.Duration `envconfig:"GITNESS_BLOBSTORE_IMPERSONATION_LIFETIME" default:"12h"` } // Token defines token configuration parameters. Token struct { CookieName string `envconfig:"GITNESS_TOKEN_COOKIE_NAME" default:"token"` Expire time.Duration `envconfig:"GITNESS_TOKEN_EXPIRE" default:"720h"` } Logs struct { // S3 provides optional storage option for logs. S3 struct { Bucket string `envconfig:"GITNESS_LOGS_S3_BUCKET"` Prefix string `envconfig:"GITNESS_LOGS_S3_PREFIX"` Endpoint string `envconfig:"GITNESS_LOGS_S3_ENDPOINT"` PathStyle bool `envconfig:"GITNESS_LOGS_S3_PATH_STYLE"` } } // Cors defines http cors parameters Cors struct { AllowedOrigins []string `envconfig:"GITNESS_CORS_ALLOWED_ORIGINS" default:"*"` AllowedMethods []string `envconfig:"GITNESS_CORS_ALLOWED_METHODS" default:"GET,POST,PATCH,PUT,DELETE,OPTIONS"` AllowedHeaders []string `` //nolint:lll // struct tags can't be multiline /* 156-byte string literal not displayed */ ExposedHeaders []string `envconfig:"GITNESS_CORS_EXPOSED_HEADERS" default:"Link"` AllowCredentials bool `envconfig:"GITNESS_CORS_ALLOW_CREDENTIALS" default:"true"` MaxAge int `envconfig:"GITNESS_CORS_MAX_AGE" default:"300"` } // Secure defines http security parameters. Secure struct { AllowedHosts []string `envconfig:"GITNESS_HTTP_ALLOWED_HOSTS"` HostsProxyHeaders []string `envconfig:"GITNESS_HTTP_PROXY_HEADERS"` SSLRedirect bool `envconfig:"GITNESS_HTTP_SSL_REDIRECT"` SSLTemporaryRedirect bool `envconfig:"GITNESS_HTTP_SSL_TEMPORARY_REDIRECT"` SSLHost string `envconfig:"GITNESS_HTTP_SSL_HOST"` SSLProxyHeaders map[string]string `envconfig:"GITNESS_HTTP_SSL_PROXY_HEADERS"` STSSeconds int64 `envconfig:"GITNESS_HTTP_STS_SECONDS"` STSIncludeSubdomains bool `envconfig:"GITNESS_HTTP_STS_INCLUDE_SUBDOMAINS"` STSPreload bool `envconfig:"GITNESS_HTTP_STS_PRELOAD"` ForceSTSHeader bool `envconfig:"GITNESS_HTTP_STS_FORCE_HEADER"` BrowserXSSFilter bool `envconfig:"GITNESS_HTTP_BROWSER_XSS_FILTER" default:"true"` FrameDeny bool `envconfig:"GITNESS_HTTP_FRAME_DENY" default:"true"` ContentTypeNosniff bool `envconfig:"GITNESS_HTTP_CONTENT_TYPE_NO_SNIFF"` ContentSecurityPolicy string `envconfig:"GITNESS_HTTP_CONTENT_SECURITY_POLICY"` ReferrerPolicy string `envconfig:"GITNESS_HTTP_REFERRER_POLICY"` } Principal struct { // System defines the principal information used to create the system service. System struct { UID string `envconfig:"GITNESS_PRINCIPAL_SYSTEM_UID" default:"gitness"` DisplayName string `envconfig:"GITNESS_PRINCIPAL_SYSTEM_DISPLAY_NAME" default:"Gitness"` Email string `envconfig:"GITNESS_PRINCIPAL_SYSTEM_EMAIL" default:"system@gitness.io"` } // Pipeline defines the principal information used to create the pipeline service. Pipeline struct { UID string `envconfig:"GITNESS_PRINCIPAL_PIPELINE_UID" default:"pipeline"` DisplayName string `envconfig:"GITNESS_PRINCIPAL_PIPELINE_DISPLAY_NAME" default:"Gitness Pipeline"` Email string `envconfig:"GITNESS_PRINCIPAL_PIPELINE_EMAIL" default:"pipeline@gitness.io"` } // Gitspace defines the principal information used to create the gitspace service. Gitspace struct { UID string `envconfig:"GITNESS_PRINCIPAL_GITSPACE_UID" default:"gitspace"` DisplayName string `envconfig:"GITNESS_PRINCIPAL_GITSPACE_DISPLAY_NAME" default:"Gitness Gitspace"` Email string `envconfig:"GITNESS_PRINCIPAL_GITSPACE_EMAIL" default:"gitspace@gitness.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:"GITNESS_PRINCIPAL_ADMIN_UID" default:"admin"` DisplayName string `envconfig:"GITNESS_PRINCIPAL_ADMIN_DISPLAY_NAME" default:"Administrator"` Email string `envconfig:"GITNESS_PRINCIPAL_ADMIN_EMAIL"` // No default email Password string `envconfig:"GITNESS_PRINCIPAL_ADMIN_PASSWORD"` // No default password } } Redis struct { Endpoint string `envconfig:"GITNESS_REDIS_ENDPOINT" default:"localhost:6379"` MaxRetries int `envconfig:"GITNESS_REDIS_MAX_RETRIES" default:"3"` MinIdleConnections int `envconfig:"GITNESS_REDIS_MIN_IDLE_CONNECTIONS" default:"0"` Password string `envconfig:"GITNESS_REDIS_PASSWORD"` SentinelMode bool `envconfig:"GITNESS_REDIS_USE_SENTINEL" default:"false"` SentinelMaster string `envconfig:"GITNESS_REDIS_SENTINEL_MASTER"` SentinelEndpoint string `envconfig:"GITNESS_REDIS_SENTINEL_ENDPOINT"` } Events struct { Mode events.Mode `envconfig:"GITNESS_EVENTS_MODE" default:"inmemory"` Namespace string `envconfig:"GITNESS_EVENTS_NAMESPACE" default:"gitness"` MaxStreamLength int64 `envconfig:"GITNESS_EVENTS_MAX_STREAM_LENGTH" default:"10000"` ApproxMaxStreamLength bool `envconfig:"GITNESS_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:"GITNESS_LOCK_PROVIDER" default:"inmemory"` Expiry time.Duration `envconfig:"GITNESS_LOCK_EXPIRE" default:"8s"` Tries int `envconfig:"GITNESS_LOCK_TRIES" default:"8"` RetryDelay time.Duration `envconfig:"GITNESS_LOCK_RETRY_DELAY" default:"250ms"` DriftFactor float64 `envconfig:"GITNESS_LOCK_DRIFT_FACTOR" default:"0.01"` TimeoutFactor float64 `envconfig:"GITNESS_LOCK_TIMEOUT_FACTOR" default:"0.25"` // AppNamespace is just service app prefix to avoid conflicts on key definition AppNamespace string `envconfig:"GITNESS_LOCK_APP_NAMESPACE" default:"gitness"` // DefaultNamespace is when mutex doesn't specify custom namespace for their keys DefaultNamespace string `envconfig:"GITNESS_LOCK_DEFAULT_NAMESPACE" default:"default"` } PubSub struct { // Provider is a name of distributed lock service like redis, memory, file etc... Provider pubsub.Provider `envconfig:"GITNESS_PUBSUB_PROVIDER" default:"inmemory"` // AppNamespace is just service app prefix to avoid conflicts on channel definition AppNamespace string `envconfig:"GITNESS_PUBSUB_APP_NAMESPACE" default:"gitness"` // DefaultNamespace is custom namespace for their channels DefaultNamespace string `envconfig:"GITNESS_PUBSUB_DEFAULT_NAMESPACE" default:"default"` HealthInterval time.Duration `envconfig:"GITNESS_PUBSUB_HEALTH_INTERVAL" default:"3s"` SendTimeout time.Duration `envconfig:"GITNESS_PUBSUB_SEND_TIMEOUT" default:"60s"` ChannelSize int `envconfig:"GITNESS_PUBSUB_CHANNEL_SIZE" default:"100"` } BackgroundJobs struct { // MaxRunning is maximum number of jobs that can be running at once. MaxRunning int `envconfig:"GITNESS_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:"GITNESS_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:"GITNESS_WEBHOOK_USER_AGENT_IDENTITY" default:"Gitness"` // HeaderIdentity specifies the identity used for headers in webhook calls (e.g. X-Gitness-Trigger, ...). // NOTE: If no value is provided, the UserAgentIdentity will be used. HeaderIdentity string `envconfig:"GITNESS_WEBHOOK_HEADER_IDENTITY"` Concurrency int `envconfig:"GITNESS_WEBHOOK_CONCURRENCY" default:"4"` MaxRetries int `envconfig:"GITNESS_WEBHOOK_MAX_RETRIES" default:"3"` AllowPrivateNetwork bool `envconfig:"GITNESS_WEBHOOK_ALLOW_PRIVATE_NETWORK" default:"false"` AllowLoopback bool `envconfig:"GITNESS_WEBHOOK_ALLOW_LOOPBACK" default:"false"` // RetentionTime is the duration after which webhook executions will be purged from the DB. RetentionTime time.Duration `envconfig:"GITNESS_WEBHOOK_RETENTION_TIME" default:"168h"` // 7 days } Trigger struct { Concurrency int `envconfig:"GITNESS_TRIGGER_CONCURRENCY" default:"4"` MaxRetries int `envconfig:"GITNESS_TRIGGER_MAX_RETRIES" default:"3"` } Metric struct { Enabled bool `envconfig:"GITNESS_METRIC_ENABLED" default:"true"` Endpoint string `envconfig:"GITNESS_METRIC_ENDPOINT" default:"https://stats.drone.ci/api/v1/gitness"` Token string `envconfig:"GITNESS_METRIC_TOKEN"` } RepoSize struct { Enabled bool `envconfig:"GITNESS_REPO_SIZE_ENABLED" default:"true"` CRON string `envconfig:"GITNESS_REPO_SIZE_CRON" default:"0 0 * * *"` MaxDuration time.Duration `envconfig:"GITNESS_REPO_SIZE_MAX_DURATION" default:"15m"` NumWorkers int `envconfig:"GITNESS_REPO_SIZE_NUM_WORKERS" default:"5"` } CodeOwners struct { FilePaths []string `envconfig:"GITNESS_CODEOWNERS_FILEPATH" default:"CODEOWNERS,.harness/CODEOWNERS"` } SMTP struct { Host string `envconfig:"GITNESS_SMTP_HOST"` Port int `envconfig:"GITNESS_SMTP_PORT"` Username string `envconfig:"GITNESS_SMTP_USERNAME"` Password string `envconfig:"GITNESS_SMTP_PASSWORD"` FromMail string `envconfig:"GITNESS_SMTP_FROM_MAIL"` Insecure bool `envconfig:"GITNESS_SMTP_INSECURE"` } Notification struct { MaxRetries int `envconfig:"GITNESS_NOTIFICATION_MAX_RETRIES" default:"3"` Concurrency int `envconfig:"GITNESS_NOTIFICATION_CONCURRENCY" default:"4"` } KeywordSearch struct { Concurrency int `envconfig:"GITNESS_KEYWORD_SEARCH_CONCURRENCY" default:"4"` MaxRetries int `envconfig:"GITNESS_KEYWORD_SEARCH_MAX_RETRIES" default:"3"` } Repos struct { // DeletedRetentionTime is the duration after which deleted repositories will be purged. DeletedRetentionTime time.Duration `envconfig:"GITNESS_REPOS_DELETED_RETENTION_TIME" default:"2160h"` // 90 days } Docker struct { // Host sets the url to the docker server. Host string `envconfig:"GITNESS_DOCKER_HOST" default:"unix:///var/run/docker.sock"` // APIVersion sets the version of the API to reach, leave empty for latest. APIVersion string `envconfig:"GITNESS_DOCKER_API_VERSION"` // CertPath sets the path to load the TLS certificates from. CertPath string `envconfig:"GITNESS_DOCKER_CERT_PATH"` // TLSVerify enables or disables TLS verification, off by default. TLSVerify string `envconfig:"GITNESS_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:"GITNESS_DOCKER_MACHINE_HOST_NAME"` } IDE struct { VSCodeWeb struct { // Port is the port on which the VS Code Web will be accessible. Port int `envconfig:"GITNESS_IDE_VSCODEWEB_PORT" default:"8089"` } } Gitspace struct { // DefaultBaseImage is used to create the Gitspace when no devcontainer.json is absent or doesn't have image. DefaultBaseImage string `envconfig:"GITNESS_GITSPACE_DEFAULT_BASE_IMAGE" default:"mcr.microsoft.com/devcontainers/base:dev-ubuntu-24.04"` //nolint:lll Enable bool `envconfig:"GITNESS_GITSPACE_ENABLE" default:"false"` Events struct { Concurrency int `envconfig:"GITNESS_GITSPACE_EVENTS_CONCURRENCY" default:"4"` MaxRetries int `envconfig:"GITNESS_GITSPACE_EVENTS_MAX_RETRIES" default:"3"` } } }
Config stores the system configuration.
type Connector ¶
type Connector struct { ID int64 `db:"connector_id" json:"-"` Description string `db:"connector_description" json:"description"` SpaceID int64 `db:"connector_space_id" json:"space_id"` Identifier string `db:"connector_uid" json:"identifier"` Type string `db:"connector_type" json:"type"` Data string `db:"connector_data" json:"data"` Created int64 `db:"connector_created" json:"created"` Updated int64 `db:"connector_updated" json:"updated"` Version int64 `db:"connector_version" json:"-"` }
func (Connector) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
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) Validate ¶
func (in DefineLabelInput) Validate() error
type DefineValueInput ¶
type DefineValueInput struct { Value string `json:"value"` Color enum.LabelColor `json:"color"` }
func (DefineValueInput) Validate ¶
func (in DefineValueInput) Validate() error
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 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 string `json:"event,omitempty"` Action string `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"` }
Execution represents an instance of a pipeline execution.
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 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"` InfraProviderResourceID int64 `json:"-"` InfraProviderResourceIdentifier string `json:"resource_identifier"` CodeRepoURL string `json:"code_repo_url"` CodeRepoRef *string `json:"code_repo_ref"` CodeRepoType enum.GitspaceCodeRepoType `json:"code_repo_type"` Branch string `json:"branch"` DevcontainerPath *string `json:"devcontainer_path,omitempty"` UserID string `json:"user_id"` SpaceID int64 `json:"-"` CodeAuthType string `json:"-"` CodeAuthID string `json:"-"` IsDeleted bool `json:"-"` CodeRepoIsPrivate bool `json:"-"` GitspaceInstance *GitspaceInstance `json:"instance"` SpacePath string `json:"space_path"` Created int64 `json:"created"` Updated int64 `json:"updated"` }
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 }
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"` MachineUser *string `json:"machine_user,omitempty"` SpacePath string `json:"space_path"` SpaceID int64 `json:"-"` Created int64 `json:"created"` Updated int64 `json:"updated"` }
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:"-"` Identifier 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"` GatewayHost *string `json:"gateway_host"` GatewayPort *string `json:"gateway_port"` // 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"` }
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 Params string InfraStatus enum.InfraStatus ServerHostIP string ServerHostPort string ProxyHost string ProxyPort int32 }
type Infrastructure ¶
type Infrastructure struct { // Identifier identifies the provisioned infra. Identifier string // ResourceKey is the key for which the infra is provisioned. ResourceKey string // SpaceID for the resource key. SpaceID int64 // SpacePath for the resource key. SpacePath string // ProviderType specifies the type of the infra provider. ProviderType enum.InfraProviderType // Parameters which are required by the provider to provision the infra. Parameters []InfraProviderParameter // Status of the infra. Status enum.InfraStatus // Host through which the infra can be accessed. Host string ProxyHost string // AgentPort on which the agent can be accessed to orchestrate containers. AgentPort int ProxyPort int // Storage is the name of the volume or disk created for the resource. Storage string // PortMappings contains the ports assigned for every requested port. PortMappings map[int]*PortMapping }
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"` ValueCount int64 `json:"value_count"` Value *string `json:"value,omitempty"` ValueColor *string `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 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 DryRun bool `json:"dry_run,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 { 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"` Updated int64 `db:"pipeline_updated" json:"updated"` Version int64 `db:"pipeline_version" json:"-"` }
func (Pipeline) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
type Plugin ¶
type Plugin struct { Identifier string `db:"plugin_uid" json:"identifier"` Description string `db:"plugin_description" json:"description"` // Currently we only support step level plugins but more can be added in the future. Type string `db:"plugin_type" json:"type"` Version string `db:"plugin_version" json:"version"` Logo string `db:"plugin_logo" json:"logo"` // Spec is a YAML template to be used for the plugin. Spec string `db:"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" json:"-"` UID string `db:"principal_uid" json:"uid"` Email string `db:"principal_email" json:"email"` Type enum.PrincipalType `db:"principal_type" json:"type"` DisplayName string `db:"principal_display_name" json:"display_name"` Admin bool `db:"principal_admin" json:"admin"` // Should be part of principal or not? Blocked bool `db:"principal_blocked" json:"blocked"` Salt string `db:"principal_salt" json:"-"` // Other info Created int64 `db:"principal_created" json:"created"` Updated int64 `db:"principal_updated" json:"updated"` }
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:"-"` // not returned, it's updated by the server internally. Clients should use EditedAt. Edited int64 `json:"edited"` 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"` MergeCheckStatus enum.MergeCheckStatus `json:"merge_check_status"` 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) MergeConflicts []string `json:"merge_conflicts,omitempty"` Author PrincipalInfo `json:"author"` Merger *PrincipalInfo `json:"merger"` Stats PullReqStats `json:"stats"` Labels []*LabelPullReqAssignmentInfo `json:"labels,omitempty"` }
PullReq represents a pull request.
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"` CreatedFilter }
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 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 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"` 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 PullRequestActivityPayloadBranchUpdate ¶
type PullRequestActivityPayloadBranchUpdate struct { Old string `json:"old"` New string `json:"new"` }
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 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 RenameDetails ¶
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 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"` 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 RepositoryGitInfo ¶
RepositoryGitInfo holds git info for a repository.
type RepositorySizeInfo ¶
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"` Users map[int64]*PrincipalInfo `json:"users"` }
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"` }
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 {
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 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 Secret ¶
type Secret struct { ID int64 `db:"secret_id" json:"-"` Description string `db:"secret_description" json:"description"` SpaceID int64 `db:"secret_space_id" json:"space_id"` CreatedBy int64 `db:"secret_created_by" json:"created_by"` Identifier string `db:"secret_uid" json:"identifier"` Data string `db:"secret_data" json:"-"` Created int64 `db:"secret_created" json:"created"` Updated int64 `db:"secret_updated" json:"updated"` Version int64 `db:"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" json:"-"` UID string `db:"principal_uid" json:"uid"` Email string `db:"principal_email" json:"email"` DisplayName string `db:"principal_display_name" json:"display_name"` Admin bool `db:"principal_admin" json:"admin"` Blocked bool `db:"principal_blocked" json:"blocked"` Salt string `db:"principal_salt" json:"-"` Created int64 `db:"principal_created" json:"created"` Updated int64 `db:"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" json:"-"` UID string `db:"principal_uid" json:"uid"` Email string `db:"principal_email" json:"email"` DisplayName string `db:"principal_display_name" json:"display_name"` Admin bool `db:"principal_admin" json:"admin"` Blocked bool `db:"principal_blocked" json:"blocked"` Salt string `db:"principal_salt" json:"-"` Created int64 `db:"principal_created" json:"created"` Updated int64 `db:"principal_updated" json:"updated"` // ServiceAccount specific fields ParentType enum.ParentResourceType `db:"principal_sa_parent_type" json:"parent_type"` ParentID int64 `db:"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"` }
Stores spaces query parameters.
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 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"` 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 Step ¶
type Step struct { ID int64 `json:"-"` StageID int64 `json:"-"` Number int64 `json:"number"` Name string `json:"name"` 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 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" json:"-"` Description string `db:"template_description" json:"description"` Type enum.ResolverType `db:"template_type" json:"type"` SpaceID int64 `db:"template_space_id" json:"space_id"` Identifier string `db:"template_uid" json:"identifier"` Data string `db:"template_data" json:"data"` Created int64 `db:"template_created" json:"created"` Updated int64 `db:"template_updated" json:"updated"` Version int64 `db:"template_version" json:"-"` }
func (Template) MarshalJSON ¶
TODO [CODE-1363]: remove after identifier migration.
type Token ¶
type Token struct { // TODO: int64 ID doesn't match DB ID int64 `db:"token_id" json:"-"` PrincipalID int64 `db:"token_principal_id" json:"principal_id"` Type enum.TokenType `db:"token_type" json:"type"` Identifier string `db:"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" json:"expires_at,omitempty"` // IssuedAt is the unix time at which the token was issued. IssuedAt int64 `db:"token_issued_at" json:"issued_at"` CreatedBy int64 `db:"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) Validate ¶
func (in UpdateLabelInput) Validate() error
type UpdateValueInput ¶
type UpdateValueInput struct { Value *string `json:"value"` Color *enum.LabelColor `json:"color"` }
func (UpdateValueInput) Validate ¶
func (in UpdateValueInput) Validate() error
type User ¶
type User struct { // Fields from Principal ID int64 `db:"principal_id" json:"-"` UID string `db:"principal_uid" json:"uid"` Email string `db:"principal_email" json:"email"` DisplayName string `db:"principal_display_name" json:"display_name"` Admin bool `db:"principal_admin" json:"admin"` Blocked bool `db:"principal_blocked" json:"blocked"` Salt string `db:"principal_salt" json:"-"` Created int64 `db:"principal_created" json:"created"` Updated int64 `db:"principal_updated" json:"updated"` // User specific fields Password string `db:"principal_user_password" json:"-"` }
User is a principal representing an end user.
func (*User) ToPrincipal ¶
func (*User) ToPrincipalInfo ¶
func (u *User) ToPrincipalInfo() *PrincipalInfo
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 UserGroupOwnerEvaluation ¶
type UserGroupOwnerEvaluation struct { ID string `json:"id"` Name string `json:"name"` Evaluations []OwnerEvaluation `json:"evaluations"` }
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 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.
Source Files ¶
- authz.go
- check.go
- code_comment.go
- codeowners.go
- commit.go
- config.go
- connector.go
- devcontainer_config.go
- execution.go
- git.go
- githook.go
- gitspace.go
- gitspace_event.go
- infra_provider.go
- infra_provisioned.go
- infrastructure.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
- repo.go
- rule.go
- search.go
- secret.go
- service.go
- service_account.go
- space.go
- stage.go
- step.go
- stream.go
- template.go
- token.go
- trigger.go
- user.go
- usergroup.go
- webhook.go