Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyPagination[T any](d *ListOptions, slice []T) []T
- func GenerateNewAgentToken() string
- func GenerateNewAutoscalerToken() string
- func IsThereRunningStage(workflows []*Workflow) bool
- func ParseRepo(str string) (user, repo string, err error)
- type Agent
- type AgentListOptions
- type AgentWithStats
- type ApprovalMode
- type Autoscaler
- type AutoscalerListOptions
- type AutoscalerWithToken
- type CacheEntry
- type Commit
- type Config
- type Cron
- type DistributedLock
- type DistributedMessage
- type Environ
- type Event
- type EventType
- type Feed
- type Forge
- type ForgeRemoteID
- type ForgeType
- type ListOptions
- type LogEntry
- type LogEntryType
- type MaintenanceConfig
- type MaintenanceLog
- type MaintenanceOperationConfig
- type MaintenanceStats
- type Netrc
- type Org
- type OrgPerm
- type Perm
- type Pipeline
- type PipelineConfig
- type PipelineFilter
- type PipelineOptions
- type PullRequest
- type QueueInfo
- type QueueTask
- type Redirection
- type Registry
- type Repo
- type RepoLastPipeline
- type RepoPatch
- type RepoVisibility
- type Secret
- type SecretStore
- type ServerConfig
- type StatusValue
- type Step
- type StepType
- type Task
- type Team
- type TrustedConfiguration
- type TrustedConfigurationPatch
- type User
- type WebhookEvent
- type WebhookEventList
- type Workflow
Constants ¶
const ( FailureIgnore = "ignore" FailureFail = "fail" )
Different ways to handle failure states.
const (
IDNotSet = -1
)
Variables ¶
var ( ErrSecretNameInvalid = errors.New("invalid secret name") ErrSecretImageInvalid = errors.New("invalid secret image") ErrSecretValueInvalid = errors.New("invalid secret value") ErrSecretEventInvalid = errors.New("invalid secret event") )
var ErrInvalidStatusValue = errors.New("invalid status value")
var ErrInvalidWebhookEvent = errors.New("invalid webhook event")
Functions ¶
func ApplyPagination ¶
func ApplyPagination[T any](d *ListOptions, slice []T) []T
func GenerateNewAgentToken ¶
func GenerateNewAgentToken() string
func GenerateNewAutoscalerToken ¶ added in v4.5.0
func GenerateNewAutoscalerToken() string
GenerateNewAutoscalerToken generates a new random token for autoscaler authentication.
func IsThereRunningStage ¶
IsThereRunningStage determine if it contains workflows running or pending to run. TODO: return false based on depends_on (https://github.com/woodpecker-ci/woodpecker/pull/730#discussion_r795681697)
Types ¶
type Agent ¶
type Agent struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
Created int64 `json:"created" xorm:"created"`
Updated int64 `json:"updated" xorm:"updated"`
Name string `json:"name" xorm:"name"`
OwnerID int64 `json:"owner_id" xorm:"'owner_id'"`
Token string `json:"token" xorm:"token"`
LastContact int64 `json:"last_contact" xorm:"last_contact"`
WorkflowPollingHealthy bool `json:"workflow_polling_healthy" xorm:"workflow_polling_healthy"`
LastWork int64 `json:"last_work" xorm:"last_work"` // last time the agent did something, this value is used to determine if the agent is still doing work used by the autoscaler
Platform string `json:"platform" xorm:"VARCHAR(100) 'platform'"`
Backend string `json:"backend" xorm:"VARCHAR(100) 'backend'"`
Capacity int32 `json:"capacity" xorm:"capacity"`
Version string `json:"version" xorm:"'version'"`
NoSchedule bool `json:"no_schedule" xorm:"no_schedule"`
Priority int32 `json:"priority" xorm:"DEFAULT 0 'priority'"`
CustomLabels map[string]string `json:"custom_labels" xorm:"JSON 'custom_labels'"`
LimitMem int64 `json:"limit_mem" xorm:"'limit_mem'"`
LimitCPUQuota int64 `json:"limit_cpu_quota" xorm:"'limit_cpu_quota'"`
// OrgID is counted as unset if set to -1, this is done to ensure a new(Agent) still enforce the OrgID check by default
OrgID int64 `json:"org_id" xorm:"INDEX 'org_id'"`
} // @name Agent
func (*Agent) CanAccessRepo ¶
func (*Agent) IsSystemAgent ¶
type AgentListOptions ¶ added in v4.4.0
type AgentListOptions struct {
ListOptions
Search string // Search in name, platform, backend, custom labels
Platform string // Filter by platform
Backend string // Filter by backend
OrgID *int64 // Filter by org_id (nil = all, -1 = global agents only)
Sort string // Sort field: id, name, platform, backend, last_contact
Order string // Sort order: asc or desc
}
AgentListOptions defines filtering options for listing agents.
type AgentWithStats ¶
AgentWithStats is used for API responses to include runtime stats.
type ApprovalMode ¶
type ApprovalMode string
const ( RequireApprovalNone ApprovalMode = "none" // require approval for no events RequireApprovalForks ApprovalMode = "forks" // require approval for PRs from forks (default) RequireApprovalPullRequests ApprovalMode = "pull_requests" // require approval for all PRs RequireApprovalAllEvents ApprovalMode = "all_events" // require approval for all external events )
func (ApprovalMode) Valid ¶
func (mode ApprovalMode) Valid() bool
type Autoscaler ¶ added in v4.5.0
type Autoscaler struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
Created int64 `json:"created" xorm:"created"`
Updated int64 `json:"updated" xorm:"updated"`
Name string `json:"name" xorm:"UNIQUE NOT NULL 'name'"`
Token string `json:"-" xorm:"token"` // Authentication token (excluded from JSON)
OwnerID int64 `json:"owner_id" xorm:"'owner_id'"`
LastContact int64 `json:"last_contact" xorm:"last_contact"`
MinAgents int32 `json:"min_agents" xorm:"'min_agents'"`
MaxAgents int32 `json:"max_agents" xorm:"'max_agents'"`
WorkflowsPerAgent int32 `json:"workflows_per_agent" xorm:"'workflows_per_agent'"`
Provider string `json:"provider" xorm:"VARCHAR(50) 'provider'"`
InstanceType string `json:"instance_type" xorm:"VARCHAR(100) 'instance_type'"`
Region string `json:"region" xorm:"VARCHAR(100) 'region'"`
AgentLabels map[string]string `json:"agent_labels" xorm:"JSON 'agent_labels'"`
LimitCPUQuota string `json:"limit_cpu_quota" xorm:"VARCHAR(50) 'limit_cpu_quota'"`
LimitMem string `json:"limit_mem" xorm:"VARCHAR(50) 'limit_mem'"`
Enabled bool `json:"enabled" xorm:"DEFAULT true 'enabled'"`
Version string `json:"version" xorm:"'version'"`
ActiveAgents int32 `json:"active_agents" xorm:"'active_agents'"`
PendingAgents int32 `json:"pending_agents" xorm:"'pending_agents'"`
OrgID int64 `json:"org_id" xorm:"INDEX 'org_id'"`
} // @name Autoscaler
Autoscaler represents an autoscaler instance that provisions agents on demand.
func (*Autoscaler) CanProvision ¶ added in v4.5.0
func (a *Autoscaler) CanProvision(requiredLabels map[string]string) bool
CanProvision checks if the autoscaler can provision an agent with the given labels. This performs label matching similar to agent label matching logic.
func (*Autoscaler) IsHealthy ¶ added in v4.5.0
func (a *Autoscaler) IsHealthy() bool
IsHealthy returns true if the autoscaler has sent a heartbeat recently (within 120 seconds).
func (*Autoscaler) IsSystemAutoscaler ¶ added in v4.5.0
func (a *Autoscaler) IsSystemAutoscaler() bool
IsSystemAutoscaler returns true if the autoscaler is a system-level (global) autoscaler.
func (Autoscaler) TableName ¶ added in v4.5.0
func (Autoscaler) TableName() string
TableName returns the database table name for xorm.
type AutoscalerListOptions ¶ added in v4.5.0
type AutoscalerListOptions struct {
ListOptions
Search string // Search in name, provider
Provider string // Filter by provider
Enabled *bool // Filter by enabled status (nil = all)
OrgID *int64 // Filter by org_id (nil = all, -1 = global autoscalers only)
Sort string // Sort field: id, name, provider, last_contact
Order string // Sort order: asc or desc
}
AutoscalerListOptions defines filtering options for listing autoscalers.
type AutoscalerWithToken ¶ added in v4.5.0
type AutoscalerWithToken struct {
*Autoscaler
Token string `json:"token"`
}
AutoscalerWithToken is used for API responses that include the token (only on creation).
type CacheEntry ¶
type CacheEntry struct {
Key string `json:"key" xorm:"pk 'key'"`
Data []byte `json:"data" xorm:"LONGBLOB 'data'"`
ExpiresAt int64 `json:"expires_at" xorm:"'expires_at'"`
CreatedAt int64 `json:"created_at" xorm:"'created_at'"`
}
CacheEntry represents a distributed cache entry.
func (CacheEntry) TableName ¶
func (CacheEntry) TableName() string
TableName returns the table name for cache entries.
type Config ¶
type Config struct {
ID int64 `json:"-" xorm:"pk autoincr 'id'"`
RepoID int64 `json:"-" xorm:"UNIQUE(s) 'repo_id'"`
Hash string `json:"hash" xorm:"UNIQUE(s) 'hash'"`
Name string `json:"name" xorm:"UNIQUE(s) 'name'"`
Data []byte `json:"data" xorm:"LONGBLOB 'data'"`
} // @name Config
Config represents a pipeline configuration.
type Cron ¶
type Cron struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
Name string `json:"name" xorm:"name UNIQUE(s) INDEX"`
RepoID int64 `json:"repo_id" xorm:"repo_id UNIQUE(s) INDEX"`
CreatorID int64 `json:"creator_id" xorm:"creator_id INDEX"`
NextExec int64 `json:"next_exec" xorm:"next_exec"`
Schedule string `json:"schedule" xorm:"schedule NOT NULL"` // @weekly, 3min, ...
Created int64 `json:"created" xorm:"created NOT NULL DEFAULT 0"`
Branch string `json:"branch" xorm:"branch"`
} // @name Cron
type DistributedLock ¶
type DistributedLock struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
Name string `json:"name" xorm:"UNIQUE NOT NULL 'name'"`
InstanceID string `json:"instance_id" xorm:"NOT NULL 'instance_id'"`
AcquiredAt int64 `json:"acquired_at" xorm:"'acquired_at'"`
ExpiresAt int64 `json:"expires_at" xorm:"'expires_at'"`
} // @name DistributedLock
DistributedLock represents a distributed lock for coordinating operations across multiple server instances in HA deployments.
func (DistributedLock) TableName ¶
func (DistributedLock) TableName() string
TableName returns the table name for DistributedLock.
type DistributedMessage ¶
type DistributedMessage struct {
ID string `json:"id" xorm:"pk 'id'"`
Data []byte `json:"data" xorm:"LONGBLOB 'data'"`
Labels map[string]string `json:"labels" xorm:"json 'labels'"`
CreatedAt int64 `json:"created_at" xorm:"'created_at'"`
InstanceID string `json:"instance_id" xorm:"'instance_id'"`
} // @name DistributedMessage
DistributedMessage represents a message stored in the database for distributed pub/sub.
func (DistributedMessage) TableName ¶
func (DistributedMessage) TableName() string
TableName returns the table name for xorm.
type Environ ¶
Environ represents an environment variable.
type Feed ¶
type Feed struct {
RepoID int64 `json:"repo_id" xorm:"repo_id"`
ID int64 `json:"id,omitempty" xorm:"pipeline_id"`
Number int64 `json:"number,omitempty" xorm:"pipeline_number"`
Event string `json:"event,omitempty" xorm:"pipeline_event"`
Status string `json:"status,omitempty" xorm:"pipeline_status"`
Created int64 `json:"created,omitempty" xorm:"pipeline_created"`
Started int64 `json:"started,omitempty" xorm:"pipeline_started"`
Finished int64 `json:"finished,omitempty" xorm:"pipeline_finished"`
Commit string `json:"commit,omitempty" xorm:"pipeline_commit"`
Branch string `json:"branch,omitempty" xorm:"pipeline_branch"`
Ref string `json:"ref,omitempty" xorm:"pipeline_ref"`
Refspec string `json:"refspec,omitempty" xorm:"pipeline_refspec"`
Title string `json:"title,omitempty" xorm:"pipeline_title"`
Message string `json:"message,omitempty" xorm:"pipeline_message"`
Author string `json:"author,omitempty" xorm:"pipeline_author"`
Avatar string `json:"author_avatar,omitempty" xorm:"pipeline_avatar"`
Email string `json:"author_email,omitempty" xorm:"pipeline_email"`
} // @name Feed
Feed represents an item in the user's feed or timeline.
type Forge ¶
type Forge struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
Type ForgeType `json:"type" xorm:"VARCHAR(250)"`
URL string `json:"url" xorm:"VARCHAR(500) 'url'"`
Client string `json:"client,omitempty" xorm:"VARCHAR(250)"`
ClientSecret string `json:"-" xorm:"VARCHAR(250)"` // do not expose client secret
SkipVerify bool `json:"skip_verify,omitempty" xorm:"bool"`
OAuthHost string `json:"oauth_host,omitempty" xorm:"VARCHAR(250) 'oauth_host'"` // public url for oauth if different from url
AdditionalOptions map[string]any `json:"additional_options,omitempty" xorm:"json"`
} // @name Forge
func (*Forge) PublicCopy ¶
PublicCopy returns a copy of the forge without sensitive information and technical details.
type ForgeRemoteID ¶
type ForgeRemoteID string
func (ForgeRemoteID) IsValid ¶
func (r ForgeRemoteID) IsValid() bool
type ListOptions ¶
type LogEntry ¶
type LogEntry struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
StepID int64 `json:"step_id" xorm:"INDEX 'step_id'"`
Time int64 `json:"time" xorm:"'time'"`
Line int `json:"line" xorm:"'line'"`
Data []byte `json:"data" xorm:"LONGBLOB"`
Created int64 `json:"-" xorm:"created"`
Type LogEntryType `json:"type" xorm:"'type'"`
} // @name LogEntry
type LogEntryType ¶
type LogEntryType int // @name LogEntryType
LogEntryType identifies the type of line in the logs.
const ( LogEntryStdout LogEntryType = iota LogEntryStderr LogEntryExitCode LogEntryMetadata LogEntryProgress )
type MaintenanceConfig ¶
type MaintenanceConfig struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
ActionType string `json:"action_type" xorm:"'action_type' unique"` // "vacuum" or "kubernetes_cleanup"
Enabled bool `json:"enabled" xorm:"'enabled'"`
Schedule string `json:"schedule" xorm:"'schedule'"` // Cron format: "0 5 * * *" for 5 AM daily
DryRun bool `json:"dry_run" xorm:"'dry_run' default(false)"`
// Action-specific statistics
TotalRuns int64 `json:"total_runs" xorm:"'total_runs' default(0)"`
SuccessfulRuns int64 `json:"successful_runs" xorm:"'successful_runs' default(0)"`
LastRun time.Time `json:"last_run" xorm:"'last_run'"`
LastRunSuccess bool `json:"last_run_success" xorm:"'last_run_success' default(false)"`
LastRunDuration int64 `json:"last_run_duration" xorm:"'last_run_duration' default(0)"` // Duration in milliseconds
LastRunError string `json:"last_run_error" xorm:"'last_run_error'"`
Created int64 `json:"created" xorm:"created"`
Updated int64 `json:"updated" xorm:"updated"`
// Runtime flags (not persisted)
KubernetesCleanupAvailable bool `json:"kubernetes_cleanup_available" xorm:"-"` // Function is configured, not stored in DB
// Environment variable override flags (not persisted)
EnvVarsSet bool `json:"env_vars_set" xorm:"-"` // True if action-specific env vars are set (vacuum or k8s depending on action)
} // @name MaintenanceConfig
MaintenanceConfig represents the configuration for database maintenance operations.
func (MaintenanceConfig) TableName ¶
func (MaintenanceConfig) TableName() string
type MaintenanceLog ¶
type MaintenanceLog struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
RunTime time.Time `json:"run_time" xorm:"'run_time'"`
Success bool `json:"success" xorm:"'success'"`
Error string `json:"error" xorm:"'error'"`
Duration int64 `json:"duration" xorm:"'duration'"` // Duration in milliseconds
Details string `json:"details" xorm:"'details'"` // JSON formatted details
Created int64 `json:"created" xorm:"created"`
} // @name MaintenanceLog
MaintenanceLog represents a log entry for maintenance operations.
func (MaintenanceLog) TableName ¶
func (MaintenanceLog) TableName() string
type MaintenanceOperationConfig ¶
type MaintenanceOperationConfig struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
Operation string `json:"operation" xorm:"'operation' unique"`
Enabled bool `json:"enabled" xorm:"'enabled'"`
Schedule string `json:"schedule" xorm:"'schedule'"` // Cron format: "0 5 * * *" for 5 AM daily
TotalRuns int64 `json:"total_runs" xorm:"'total_runs'"`
LastRun time.Time `json:"last_run" xorm:"'last_run'"`
Created int64 `json:"created" xorm:"created"`
Updated int64 `json:"updated" xorm:"updated"`
} // @name MaintenanceOperationConfig
MaintenanceOperationConfig represents the configuration for individual maintenance operations.
func (MaintenanceOperationConfig) TableName ¶
func (MaintenanceOperationConfig) TableName() string
type MaintenanceStats ¶
type MaintenanceStats struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
LastRun time.Time `json:"last_run" xorm:"'last_run'"`
LastRunSuccess bool `json:"last_run_success" xorm:"'last_run_success'"`
LastRunError string `json:"last_run_error" xorm:"'last_run_error'"`
LastRunDuration int64 `json:"last_run_duration" xorm:"'last_run_duration'"` // Duration in milliseconds
TotalRuns int64 `json:"total_runs" xorm:"'total_runs'"`
SuccessfulRuns int64 `json:"successful_runs" xorm:"'successful_runs'"`
Created int64 `json:"created" xorm:"created"`
Updated int64 `json:"updated" xorm:"updated"`
} // @name MaintenanceStats
MaintenanceStats represents statistics about maintenance operations.
func (MaintenanceStats) TableName ¶
func (MaintenanceStats) TableName() string
type Org ¶
type Org struct {
ID int64 `json:"id,omitempty" xorm:"pk autoincr 'id'"`
ForgeID int64 `json:"forge_id,omitempty" xorm:"forge_id UNIQUE(s)"`
Name string `json:"name" xorm:"'name' UNIQUE(s)"`
IsUser bool `json:"is_user" xorm:"is_user"`
// if name lookup has to check for membership or not
Private bool `json:"-" xorm:"private"`
} // @name Org
Org represents an organization.
type Perm ¶
type Perm struct {
UserID int64 `json:"-" xorm:"UNIQUE(s) INDEX NOT NULL 'user_id'"`
RepoID int64 `json:"-" xorm:"UNIQUE(s) INDEX NOT NULL 'repo_id'"`
Repo *Repo `json:"-" xorm:"-"`
Pull bool `json:"pull" xorm:"pull"`
Push bool `json:"push" xorm:"push"`
Admin bool `json:"admin" xorm:"admin"`
Synced int64 `json:"synced" xorm:"synced"`
Created int64 `json:"created" xorm:"created"`
Updated int64 `json:"updated" xorm:"updated"`
} // @name Perm
Perm defines a repository permission for an individual user.
type Pipeline ¶
type Pipeline struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
RepoID int64 `json:"-" xorm:"UNIQUE(s) INDEX 'repo_id'"`
Number int64 `json:"number" xorm:"UNIQUE(s) 'number'"`
Author string `json:"author" xorm:"INDEX 'author'"`
Parent int64 `json:"parent" xorm:"parent"`
Event WebhookEvent `json:"event" xorm:"event"`
Status StatusValue `json:"status" xorm:"INDEX 'status'"`
Errors []*types.PipelineError `json:"errors" xorm:"json 'errors'"`
Created int64 `json:"created" xorm:"'created' NOT NULL DEFAULT 0 created"`
Updated int64 `json:"updated" xorm:"'updated' NOT NULL DEFAULT 0 updated"`
Started int64 `json:"started" xorm:"started"`
Finished int64 `json:"finished" xorm:"finished"`
DeployTo string `json:"deploy_to" xorm:"deploy"`
DeployTask string `json:"deploy_task" xorm:"deploy_task"`
Commit string `json:"commit" xorm:"commit"`
Branch string `json:"branch" xorm:"branch"`
Ref string `json:"ref" xorm:"ref"`
Refspec string `json:"refspec" xorm:"refspec"`
Title string `json:"title" xorm:"title"`
Message string `json:"message" xorm:"TEXT 'message'"`
Timestamp int64 `json:"timestamp" xorm:"'timestamp'"`
Sender string `json:"sender" xorm:"sender"` // uses reported user for webhooks and name of cron for cron pipelines
Avatar string `json:"author_avatar" xorm:"varchar(500) avatar"`
Email string `json:"author_email" xorm:"varchar(500) email"`
ForgeURL string `json:"forge_url" xorm:"forge_url"`
Reviewer string `json:"reviewed_by" xorm:"reviewer"`
Reviewed int64 `json:"reviewed" xorm:"reviewed"`
Workflows []*Workflow `json:"workflows,omitempty" xorm:"-"`
ChangedFiles []string `json:"changed_files,omitempty" xorm:"LONGTEXT 'changed_files'"`
AdditionalVariables map[string]string `json:"variables,omitempty" xorm:"json 'additional_variables'"`
PullRequestLabels []string `json:"pr_labels,omitempty" xorm:"json 'pr_labels'"`
IsPrerelease bool `json:"is_prerelease,omitempty" xorm:"is_prerelease"`
FromFork bool `json:"from_fork,omitempty" xorm:"from_fork"`
LogsDeleted bool `json:"logs_deleted,omitempty" xorm:"logs_deleted"`
} // @name Pipeline
func (Pipeline) IsMultiPipeline ¶
IsMultiPipeline checks if step list contain more than one parent step.
type PipelineConfig ¶
type PipelineConfig struct {
ConfigID int64 `json:"-" xorm:"UNIQUE(s) NOT NULL 'config_id'"`
PipelineID int64 `json:"-" xorm:"UNIQUE(s) NOT NULL 'pipeline_id'"`
}
PipelineConfig is the n:n relation between Pipeline and Config.
func (PipelineConfig) TableName ¶
func (PipelineConfig) TableName() string
type PipelineFilter ¶
type PipelineFilter struct {
Before int64
After int64
Branch string
Events []WebhookEvent
RefContains string
Status StatusValue
}
type PipelineOptions ¶
type PullRequest ¶
type PullRequest struct {
Index ForgeRemoteID `json:"index"`
Title string `json:"title"`
} // @name PullRequest
type QueueInfo ¶ added in v4.4.0
type QueueInfo struct {
Pending []QueueTask `json:"pending"`
WaitingOnDeps []QueueTask `json:"waiting_on_deps"`
Running []QueueTask `json:"running"`
Stats struct {
WorkerCount int `json:"worker_count"`
PendingCount int `json:"pending_count"`
WaitingOnDepsCount int `json:"waiting_on_deps_count"`
RunningCount int `json:"running_count"`
} `json:"stats"`
Paused bool `json:"paused"`
} // @name QueueInfo
QueueInfo represents the response structure for queue information API.
type QueueTask ¶ added in v4.4.0
type QueueTask struct {
Task
PipelineNumber int64 `json:"pipeline_number"`
AgentName string `json:"agent_name"`
}
QueueTask represents a task in the queue with additional API-specific fields.
type Redirection ¶
type Redirection struct {
ID int64 `xorm:"pk autoincr 'id'"`
RepoID int64 `xorm:"'repo_id'"`
FullName string `xorm:"UNIQUE INDEX 'repo_full_name'"`
}
func (Redirection) TableName ¶
func (r Redirection) TableName() string
type Registry ¶
type Registry struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
OrgID int64 `json:"org_id" xorm:"NOT NULL DEFAULT 0 UNIQUE(s) INDEX 'org_id'"`
RepoID int64 `json:"repo_id" xorm:"NOT NULL DEFAULT 0 UNIQUE(s) INDEX 'repo_id'"`
Address string `json:"address" xorm:"NOT NULL UNIQUE(s) INDEX 'address'"`
Username string `json:"username" xorm:"varchar(2000) 'username'"`
Password string `json:"password" xorm:"TEXT 'password'"`
ReadOnly bool `json:"readonly" xorm:"-"`
} // @name Registry
Registry represents a docker registry with credentials.
type Repo ¶
type Repo struct {
ID int64 `json:"id,omitempty" xorm:"pk autoincr 'id'"`
UserID int64 `json:"-" xorm:"INDEX 'user_id'"`
ForgeID int64 `json:"forge_id,omitempty" xorm:"forge_id"`
// ForgeRemoteID is the unique identifier for the repository on the forge.
ForgeRemoteID ForgeRemoteID `json:"forge_remote_id" xorm:"forge_remote_id"`
OrgID int64 `json:"org_id" xorm:"INDEX 'org_id'"`
Owner string `json:"owner" xorm:"UNIQUE(name) 'owner'"`
Name string `json:"name" xorm:"UNIQUE(name) 'name'"`
FullName string `json:"full_name" xorm:"UNIQUE 'full_name'"`
Avatar string `json:"avatar_url,omitempty" xorm:"varchar(500) 'avatar'"`
ForgeURL string `json:"forge_url,omitempty" xorm:"varchar(1000) 'forge_url'"`
Clone string `json:"clone_url,omitempty" xorm:"varchar(1000) 'clone'"`
CloneSSH string `json:"clone_url_ssh" xorm:"varchar(1000) 'clone_ssh'"`
Branch string `json:"default_branch,omitempty" xorm:"varchar(500) 'branch'"`
PREnabled bool `json:"pr_enabled" xorm:"DEFAULT TRUE 'pr_enabled'"`
Timeout int64 `json:"timeout,omitempty" xorm:"timeout"`
Visibility RepoVisibility `json:"visibility" xorm:"varchar(10) 'visibility'"`
IsSCMPrivate bool `json:"private" xorm:"private"`
Trusted TrustedConfiguration `json:"trusted" xorm:"json 'trusted'"`
RequireApproval ApprovalMode `json:"require_approval" xorm:"varchar(50) require_approval"`
IsActive bool `json:"active" xorm:"active"`
AllowPull bool `json:"allow_pr" xorm:"allow_pr"`
AllowDeploy bool `json:"allow_deploy" xorm:"allow_deploy"`
Config string `json:"config_file" xorm:"varchar(500) 'config_path'"`
Hash string `json:"-" xorm:"varchar(500) 'hash'"`
Perm *Perm `json:"-" xorm:"-"`
CancelPreviousPipelineEvents []WebhookEvent `json:"cancel_previous_pipeline_events" xorm:"json 'cancel_previous_pipeline_events'"`
NetrcTrustedPlugins []string `json:"netrc_trusted" xorm:"json 'netrc_trusted'"`
LogsPipelinesKeepMin int64 `json:"logs_keep_min,omitempty" xorm:"logs_keep_min"`
LogsDurationKeep string `json:"logs_keep_duration" xorm:"varchar(500) 'logs_keep_duration'"`
} // @name Repo
Repo represents a repository.
func (*Repo) ResetVisibility ¶
func (r *Repo) ResetVisibility()
type RepoLastPipeline ¶
type RepoLastPipeline struct {
*Repo
LastPipeline *Pipeline `json:"last_pipeline,omitempty"`
} // @name RepoLastPipeline
RepoLastPipeline represents a repository with last pipeline execution information.
type RepoPatch ¶
type RepoPatch struct {
Config *string `json:"config_file,omitempty"`
RequireApproval *string `json:"require_approval,omitempty"`
Timeout *int64 `json:"timeout,omitempty"`
Visibility *string `json:"visibility,omitempty"`
AllowPull *bool `json:"allow_pr,omitempty"`
AllowDeploy *bool `json:"allow_deploy,omitempty"`
CancelPreviousPipelineEvents *[]WebhookEvent `json:"cancel_previous_pipeline_events"`
LogsPipelinesKeepMin int64 `json:"logs_keep_min"`
LogsDurationKeep string `json:"logs_keep_duration"`
NetrcTrusted *[]string `json:"netrc_trusted"`
Trusted *TrustedConfigurationPatch `json:"trusted"`
} // @name RepoPatch
RepoPatch represents a repository patch object.
type RepoVisibility ¶
type RepoVisibility string // @name RepoVisibility
RepoVisibility represent to what state a repo in woodpecker is visible to others.
const ( VisibilityPublic RepoVisibility = "public" VisibilityPrivate RepoVisibility = "private" VisibilityInternal RepoVisibility = "internal" )
type Secret ¶
type Secret struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
OrgID int64 `json:"org_id" xorm:"NOT NULL DEFAULT 0 UNIQUE(s) INDEX 'org_id'"`
RepoID int64 `json:"repo_id" xorm:"NOT NULL DEFAULT 0 UNIQUE(s) INDEX 'repo_id'"`
Name string `json:"name" xorm:"NOT NULL UNIQUE(s) INDEX 'name'"`
Value string `json:"value,omitempty" xorm:"TEXT 'value'"`
Images []string `json:"images" xorm:"json 'images'"`
Events []WebhookEvent `json:"events" xorm:"json 'events'"`
} // @name Secret
Secret represents a secret variable, such as a password or token.
func (*Secret) BeforeInsert ¶
func (s *Secret) BeforeInsert()
BeforeInsert will sort events before inserted into database.
type SecretStore ¶
type SecretStore interface {
SecretFind(*Repo, string) (*Secret, error)
SecretList(*Repo, bool, *ListOptions) ([]*Secret, error)
SecretCreate(*Secret) error
SecretUpdate(*Secret) error
SecretDelete(*Secret) error
OrgSecretFind(int64, string) (*Secret, error)
OrgSecretList(int64, *ListOptions) ([]*Secret, error)
GlobalSecretFind(string) (*Secret, error)
GlobalSecretList(*ListOptions) ([]*Secret, error)
SecretListAll() ([]*Secret, error)
}
SecretStore persists secret information to storage.
type ServerConfig ¶
type ServerConfig struct {
Key string `json:"key" xorm:"pk 'key'"`
Value string `json:"value" xorm:"value"`
}
ServerConfig represents a key-value pair for storing server configurations.
func (ServerConfig) TableName ¶
func (ServerConfig) TableName() string
TableName return database table name for xorm.
type StatusValue ¶
type StatusValue string // @name StatusValue
StatusValue represent pipeline states woodpecker know.
const ( StatusSkipped StatusValue = "skipped" // skipped as another step failed StatusPending StatusValue = "pending" // pending to be executed StatusRunning StatusValue = "running" // currently running StatusSuccess StatusValue = "success" // successfully finished StatusFailure StatusValue = "failure" // failed to finish (exit code != 0) StatusKilled StatusValue = "killed" // killed by user StatusError StatusValue = "error" // error with the config / while parsing / some other system problem StatusBlocked StatusValue = "blocked" // waiting for approval StatusDeclined StatusValue = "declined" // blocked and declined StatusCreated StatusValue = "created" // created / internal use only )
func PipelineStatus ¶
func PipelineStatus(workflows []*Workflow) StatusValue
PipelineStatus determine pipeline status based on corresponding workflow list.
func WorkflowStatus ¶
func WorkflowStatus(steps []*Step) StatusValue
WorkflowStatus determine workflow status based on corresponding step list.
func (StatusValue) Validate ¶
func (s StatusValue) Validate() error
type Step ¶
type Step struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
UUID string `json:"uuid" xorm:"INDEX 'uuid'"`
PipelineID int64 `json:"pipeline_id" xorm:"UNIQUE(s) INDEX 'pipeline_id'"`
PID int `json:"pid" xorm:"UNIQUE(s) 'pid'"`
PPID int `json:"ppid" xorm:"ppid"`
Name string `json:"name" xorm:"name"`
State StatusValue `json:"state" xorm:"state"`
Error string `json:"error,omitempty" xorm:"TEXT 'error'"`
Failure string `json:"-" xorm:"failure"`
ExitCode int `json:"exit_code" xorm:"exit_code"`
Started int64 `json:"started,omitempty" xorm:"started"`
Finished int64 `json:"finished,omitempty" xorm:"finished"`
Type StepType `json:"type,omitempty" xorm:"type"`
DependsOn []string `json:"depends_on,omitempty" xorm:"json 'depends_on'"`
} // @name Step
Step represents a process in the pipeline.
type Task ¶
type Task struct {
ID string `json:"id" xorm:"PK UNIQUE 'id'"`
PID int `json:"pid" xorm:"'pid'"`
Name string `json:"name" xorm:"'name'"`
Data []byte `json:"-" xorm:"LONGBLOB 'data'"`
Labels map[string]string `json:"labels" xorm:"json 'labels'"`
Dependencies []string `json:"dependencies" xorm:"json 'dependencies'"`
RunOn []string `json:"run_on" xorm:"json 'run_on'"`
DepStatus map[string]StatusValue `json:"dep_status" xorm:"json 'dependencies_status'"`
AgentID int64 `json:"agent_id" xorm:"'agent_id'"`
PipelineID int64 `json:"pipeline_id" xorm:"'pipeline_id'"`
RepoID int64 `json:"repo_id" xorm:"'repo_id'"`
} // @name Task
Task defines scheduled pipeline Task.
func (*Task) ApplyLabelsFromRepo ¶
type Team ¶
type Team struct {
// Login is the username for this team.
Login string `json:"login"`
// the avatar url for this team.
Avatar string `json:"avatar_url"`
}
Team represents a team or organization in the forge.
type TrustedConfiguration ¶
type User ¶
type User struct {
// the id for this user.
//
// required: true
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
ForgeID int64 `json:"forge_id,omitempty" xorm:"forge_id"`
ForgeRemoteID ForgeRemoteID `json:"-" xorm:"forge_remote_id"`
// Login is the username for this user.
//
// required: true
Login string `json:"login" xorm:"UNIQUE 'login'"`
// AccessToken is the oauth2 access token.
AccessToken string `json:"-" xorm:"TEXT 'access_token'"`
// RefreshToken is the oauth2 refresh token.
RefreshToken string `json:"-" xorm:"TEXT 'refresh_token'"`
// Expiry is the AccessToken expiration timestamp (unix seconds).
Expiry int64 `json:"-" xorm:"expiry"`
// Email is the email address for this user.
//
// required: true
Email string `json:"email" xorm:" varchar(500) 'email'"`
// the avatar url for this user.
Avatar string `json:"avatar_url" xorm:" varchar(500) 'avatar'"`
// Admin indicates the user is a system administrator.
//
// NOTE: If the username is part of the WOODPECKER_ADMIN
// environment variable, this value will be set to true on login.
Admin bool `json:"admin,omitempty" xorm:"admin"`
// Hash is a unique token used to sign tokens.
Hash string `json:"-" xorm:"UNIQUE varchar(500) 'hash'"`
// OrgID is the of the user as model.Org.
OrgID int64 `json:"org_id" xorm:"org_id"`
} // @name User
User represents a registered user.
type WebhookEvent ¶
type WebhookEvent string // @name WebhookEvent
const ( EventPush WebhookEvent = "push" EventPull WebhookEvent = "pull_request" EventPullClosed WebhookEvent = "pull_request_closed" EventPullEdited WebhookEvent = "pull_request_edited" EventTag WebhookEvent = "tag" EventRelease WebhookEvent = "release" EventDeploy WebhookEvent = "deployment" EventCron WebhookEvent = "cron" EventManual WebhookEvent = "manual" )
func (WebhookEvent) Validate ¶
func (s WebhookEvent) Validate() error
type WebhookEventList ¶
type WebhookEventList []WebhookEvent
func (WebhookEventList) Len ¶
func (wel WebhookEventList) Len() int
func (WebhookEventList) Less ¶
func (wel WebhookEventList) Less(i, j int) bool
func (WebhookEventList) Swap ¶
func (wel WebhookEventList) Swap(i, j int)
type Workflow ¶
type Workflow struct {
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
PipelineID int64 `json:"pipeline_id" xorm:"UNIQUE(s) INDEX 'pipeline_id'"`
PID int `json:"pid" xorm:"UNIQUE(s) 'pid'"`
Name string `json:"name" xorm:"name"`
PipelineName string `json:"pipeline_name" xorm:"pipeline_name"`
State StatusValue `json:"state" xorm:"state"`
Error string `json:"error,omitempty" xorm:"TEXT 'error'"`
Started int64 `json:"started,omitempty" xorm:"started"`
Finished int64 `json:"finished,omitempty" xorm:"finished"`
AgentID int64 `json:"agent_id,omitempty" xorm:"agent_id"`
Platform string `json:"platform,omitempty" xorm:"platform"`
Environ map[string]string `json:"environ,omitempty" xorm:"json 'environ'"`
DependsOn []string `json:"depends_on,omitempty" xorm:"json 'depends_on'"`
AxisID int `json:"-" xorm:"axis_id"`
Children []*Step `json:"children,omitempty" xorm:"-"`
}
Workflow represents a workflow in the pipeline.