Help us shape the future of Go! Take the 2026 Go Developer Survey

extent

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VarnameDeployTask   = "GITPLOY_DEPLOY_TASK"
	VarnameRollbackTask = "GITPLOY_ROLLBACK_TASK"
	VarnameIsRollback   = "GITPLOY_IS_ROLLBACK"
)
View Source
const (
	// DefaultDeployTask is the value of the 'GITPLOY_DEPLOY_TASK' variable.
	DefaultDeployTask = "deploy"
	// DefaultRollbackTask is the value of the 'GITPLOY_ROLLBACK_TASK' variable.
	DefaultRollbackTask = "rollback"
)
View Source
const (
	TrialMemberLimit        = 5
	TrialDeploymentLimit    = 5000
	InfiniteMemberLimit     = math.MaxInt
	InfiniteDeploymentLimit = math.MaxInt
)

Variables

This section is empty.

Functions

func UnmarshalYAML

func UnmarshalYAML(content []byte, c *Config) error

Types

type Author

type Author struct {
	Login     string    `json:"login"`
	AvatarURL string    `json:"avatar_url"`
	Date      time.Time `json:"date"`
}

type Branch

type Branch struct {
	Name      string `json:"name"`
	CommitSHA string `json:"commit_sha"`
}

type Commit

type Commit struct {
	SHA           string  `json:"sha"`
	Message       string  `json:"message"`
	IsPullRequest bool    `json:"is_pull_request"`
	HTMLURL       string  `json:"html_url"`
	Author        *Author `json:"author,omitempty"`
}

type CommitFile

type CommitFile struct {
	FileName  string `json:"filename"`
	Additions int    `json:"addtitions"`
	Deletions int    `json:"deletions"`
	Changes   int    `json:"changes"`
}

type Config

type Config struct {
	Envs []*Env `json:"envs" yaml:"envs"`
	// contains filtered or unexported fields
}

func (*Config) Eval

func (c *Config) Eval(v *EvalValues) error

func (*Config) GetEnv

func (c *Config) GetEnv(name string) *Env

func (*Config) HasEnv

func (c *Config) HasEnv(name string) bool

type DynamicPayload

type DynamicPayload struct {
	Enabled bool             `json:"enabled" yaml:"enabled"`
	Inputs  map[string]Input `json:"inputs" yaml:"inputs"`
}

DynamicPayload can be set to dynamically fill in the payload.

func (*DynamicPayload) Validate

func (dp *DynamicPayload) Validate(values map[string]interface{}) (err error)

Validate validates the payload.

type Env

type Env struct {
	Name string `json:"name" yaml:"name"`

	// GitHub parameters of deployment.
	Task                  *string         `json:"task" yaml:"task"`
	Description           *string         `json:"description" yaml:"description"`
	AutoMerge             *bool           `json:"auto_merge" yaml:"auto_merge"`
	RequiredContexts      *[]string       `json:"required_contexts,omitempty" yaml:"required_contexts"`
	Payload               interface{}     `json:"payload" yaml:"payload"`
	DynamicPayload        *DynamicPayload `json:"dynamic_payload" yaml:"dynamic_payload"`
	ProductionEnvironment *bool           `json:"production_environment" yaml:"production_environment"`

	// DeployableRef validates the ref is deployable or not.
	DeployableRef *string `json:"deployable_ref" yaml:"deployable_ref"`

	// AutoDeployOn deploys automatically when the pattern is matched.
	AutoDeployOn *string `json:"auto_deploy_on" yaml:"auto_deploy_on"`

	// Serialization verify if there is a running deployment.
	Serialization *bool `json:"serialization" yaml:"serialization"`

	// Review is the configuration of Review,
	// It is disabled when it is empty.
	Review *Review `json:"review,omitempty" yaml:"review"`

	// FrozenWindows is the list of windows to freeze deployments.
	FrozenWindows []FrozenWindow `json:"frozen_windows" yaml:"frozen_windows"`
}

func (*Env) HasReview

func (e *Env) HasReview() bool

HasReview check whether the review is enabled or not.

func (*Env) IsAutoDeployOn

func (e *Env) IsAutoDeployOn(ref string) (bool, error)

IsAutoDeployOn verifies the ref is matched with 'auto_deploy_on'.

func (*Env) IsDeployableRef

func (e *Env) IsDeployableRef(ref string) (bool, error)

IsDeployableRef verifies the ref is deployable.

func (*Env) IsDynamicPayloadEnabled

func (e *Env) IsDynamicPayloadEnabled() bool

func (*Env) IsFreezed

func (e *Env) IsFreezed(t time.Time) (bool, error)

IsFreezed verifies whether the current time is in a freeze window. It returns an error when parsing an expression is failed.

func (*Env) IsProductionEnvironment

func (e *Env) IsProductionEnvironment() bool

IsProductionEnvironment verifies whether the environment is production or not.

func (*Env) ValidateDynamicPayload

func (e *Env) ValidateDynamicPayload(values map[string]interface{}) error

type EvalValues

type EvalValues struct {
	IsRollback bool
}

type FrozenWindow

type FrozenWindow struct {
	Start    string `json:"start" yaml:"start"`
	Duration string `json:"duration" yaml:"duration"`
	Location string `json:"location" yaml:"location"`
}

type Input

type Input struct {
	Type        InputType    `json:"type" yaml:"type"`
	Required    *bool        `json:"required" yaml:"required"`
	Default     *interface{} `json:"default" yaml:"default"`
	Description *string      `json:"description" yaml:"description"`
	Options     *[]string    `json:"options" yaml:"options"`
}

Input defines specifications for input values.

type InputType

type InputType string

InputType is the type for input.

const (
	InputTypeSelect  InputType = "select"
	InputTypeNumber  InputType = "number"
	InputTypeString  InputType = "string"
	InputTypeBoolean InputType = "boolean"
)

type License

type License struct {
	Kind            LicenseKind `json:"kind"`
	MemberCount     int         `json:"member_count"`
	MemberLimit     int         `json:"memeber_limit"`
	DeploymentCount int         `json:"deployment_count"`
	DeploymentLimit int         `json:"deployment_limit"`
	ExpiredAt       time.Time   `json:"expired_at"`
}

func NewOSSLicense

func NewOSSLicense() *License

func NewStandardLicense

func NewStandardLicense(memberCnt int, d *SigningData) *License

func NewTrialLicense

func NewTrialLicense(memberCnt, deploymentCnt int) *License

func (*License) IsExpired

func (l *License) IsExpired() bool

IsExpired verify that the license is expired or not.

func (*License) IsOSS

func (l *License) IsOSS() bool

func (*License) IsOverLimit

func (l *License) IsOverLimit() bool

IsOverLimit verify it is over the limit of the license.

func (*License) IsStandard

func (l *License) IsStandard() bool

func (*License) IsTrial

func (l *License) IsTrial() bool

type LicenseKind

type LicenseKind string
const (
	// LicenseKindOSS is a license for the community edition.
	LicenseKindOSS LicenseKind = "oss"
	// LicenseKindTrial is a trial license of the enterprise edition.
	LicenseKindTrial LicenseKind = "trial"
	// LicenseKindStandard is a license of the enterprise edition.
	LicenseKindStandard LicenseKind = "standard"
)

type RateLimit

type RateLimit struct {
	Limit     int       `json:"limit"`
	Remaining int       `json:"remaining"`
	Reset     time.Time `json:"reset"`
}

type RemoteDeployment

type RemoteDeployment struct {
	UID     int64  `json:"uid"`
	SHA     string `json:"sha"`
	HTLMURL string `json:"html_url"`
}

type RemoteDeploymentStatus

type RemoteDeploymentStatus struct {
	ID          int64  `json:"id"`
	Status      string `json:"status"`
	Description string `json:"description"`
	LogURL      string `json:"log_url"`
}

type RemoteRepo

type RemoteRepo struct {
	ID          int64          `json:"id"`
	Namespace   string         `json:"namespace"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Perm        RemoteRepoPerm `json:"repo_perm"`
}

type RemoteRepoPerm

type RemoteRepoPerm string
const (
	RemoteRepoPermRead  RemoteRepoPerm = "read"
	RemoteRepoPermWrite RemoteRepoPerm = "write"
	RemoteRepoPermAdmin RemoteRepoPerm = "admin"
)

type RemoteUser

type RemoteUser struct {
	ID        int64
	Login     string
	AvatarURL string
}

type Review

type Review struct {
	Enabled   bool     `json:"enabled" yaml:"enabled"`
	Reviewers []string `json:"reviewers" yaml:"reviewers"`
}

type SigningData

type SigningData struct {
	MemberLimit int       `json:"memeber_limit"`
	ExpiredAt   time.Time `json:"expired_at"`
}

SigningData marshal and unmarshal the content of license.

type Status

type Status struct {
	Context   string      `json:"context"`
	AvatarURL string      `json:"avatar_url"`
	TargetURL string      `json:"target_url"`
	State     StatusState `json:"state"`
}

type StatusState

type StatusState string
const (
	StatusStateSuccess   StatusState = "success"
	StatusStateFailure   StatusState = "failure"
	StatusStatePending   StatusState = "pending"
	StatusStateCancelled StatusState = "cancelled"
	StatusStateSkipped   StatusState = "skipped"
)

type Tag

type Tag struct {
	Name      string `json:"name,omitempty"`
	CommitSHA string `json:"commit_sha,omitempty"`
}

type WebhookConfig

type WebhookConfig struct {
	URL    string
	Secret string
	SSL    bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL