flycd

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SkippedAbortedEarlier = fmt.Errorf("skipped: job aborted earlier")
View Source
var SkippedNotValid = fmt.Errorf("skipped: not a valid app")

Functions

func AppIsDeployed

func AppIsDeployed(ctx context.Context, name string) (bool, error)

func DeployAppFromInlineConfig

func DeployAppFromInlineConfig(ctx context.Context, deployCfg DeployConfig, cfg AppConfig) error

func DeploySingleAppFromFolder

func DeploySingleAppFromFolder(ctx context.Context, path string, deployCfg DeployConfig) error

func HandleGithubWebhook

func HandleGithubWebhook(payload github.PushWebhookPayload, path string) error

func NewDefaultDeployParams

func NewDefaultDeployParams() []string

func NewDefaultLaunchParams

func NewDefaultLaunchParams(
	appName string,
	orgSlug string,
) []string

Types

type AppConfig

type AppConfig struct {
	App           string            `yaml:"app" toml:"app"`
	Org           string            `yaml:"org" toml:"org"`
	PrimaryRegion string            `yaml:"primary_region" toml:"primary_region"`
	Source        Source            `yaml:"source" toml:"source"`
	Services      []Service         `yaml:"services" toml:"services"`
	LaunchParams  []string          `yaml:"launch_params" toml:"launch_params"`
	DeployParams  []string          `yaml:"deploy_params" toml:"deploy_params"`
	Env           map[string]string `yaml:"env" toml:"env"`
}

func GetDeployedAppConfig

func GetDeployedAppConfig(ctx context.Context, name string) (AppConfig, error)

func (*AppConfig) Validate

func (a *AppConfig) Validate() error

type Concurrency

type Concurrency struct {
	Type      string `yaml:"type" toml:"type"`
	SoftLimit int    `yaml:"soft_limit" toml:"soft_limit"`
	HardLimit int    `yaml:"hard_limit" toml:"hard_limit"`
}

type DeployConfig

type DeployConfig struct {
	Force             bool
	Retries           int
	AttemptTimeout    time.Duration
	AbortOnFirstError bool
}

func NewDeployConfig

func NewDeployConfig() DeployConfig

func (DeployConfig) WithAbortOnFirstError

func (c DeployConfig) WithAbortOnFirstError(state ...bool) DeployConfig

func (DeployConfig) WithAttemptTimeout

func (c DeployConfig) WithAttemptTimeout(timeout ...time.Duration) DeployConfig

func (DeployConfig) WithForce

func (c DeployConfig) WithForce(force ...bool) DeployConfig

func (DeployConfig) WithRetries

func (c DeployConfig) WithRetries(retries ...int) DeployConfig

type DeployFailure

type DeployFailure struct {
	Spec  SpecNode
	Cause error
}

type DeployResult

type DeployResult struct {
	Succeeded []SpecNode
	Failed    []DeployFailure
}

func DeployAll

func DeployAll(
	ctx context.Context,
	path string,
	deployCfg DeployConfig,
) (DeployResult, error)

func NewDeployResult

func NewDeployResult() DeployResult

func (DeployResult) Success

func (r DeployResult) Success() bool

type GitRef

type GitRef struct {
	Branch string `yaml:"branch" toml:"branch"`
	Tag    string `yaml:"tag" toml:"tag"`
	Commit string `yaml:"commit" toml:"commit"`
}

func (*GitRef) IsEmpty

func (g *GitRef) IsEmpty() bool

type Port

type Port struct {
	Handlers   []string `yaml:"handlers" toml:"handlers"`
	Port       int      `yaml:"port" toml:"port"`
	ForceHttps bool     `yaml:"force_https" toml:"force_https"`
}

type Service

type Service struct {
	InternalPort       int         `yaml:"internal_port" toml:"internal_port"`
	Protocol           string      `yaml:"protocol" toml:"protocol"`
	ForceHttps         bool        `yaml:"force_https" toml:"force_https"`
	AutoStopMachines   bool        `yaml:"auto_stop_machines" toml:"auto_stop_machines"`
	AutoStartMachines  bool        `yaml:"auto_start_machines" toml:"auto_start_machines"`
	MinMachinesRunning int         `yaml:"min_machines_running" toml:"min_machines_running"`
	Concurrency        Concurrency `yaml:"concurrency" toml:"concurrency"`
	Ports              []Port      `yaml:"ports" toml:"ports"`
}

func NewDefaultServiceConfig

func NewDefaultServiceConfig() Service

type Source

type Source struct {
	Repo   string     `yaml:"repo" toml:"repo"`
	Path   string     `yaml:"path" toml:"path"`
	Ref    GitRef     `yaml:"ref" toml:"ref"`
	Type   SourceType `yaml:"type" toml:"type"`
	Inline string     `yaml:"inline" toml:"inline"`
}

func NewGitSource

func NewGitSource(url string) Source

func NewInlineDockerFileSource

func NewInlineDockerFileSource(inline string) Source

func NewLocalFolderSource

func NewLocalFolderSource(path string) Source

func (*Source) Validate

func (s *Source) Validate() error

type SourceType

type SourceType string
const (
	SourceTypeGit              SourceType = "git"
	SourceTypeLocal            SourceType = "local"
	SourceTypeDocker           SourceType = "docker"
	SourceTypeInlineDockerFile SourceType = "inline-docker-file"
)

type SpecNode

type SpecNode struct {
	Path               string
	AppYaml            string
	AppConfig          AppConfig
	AppConfigSyntaxErr error
	AppConfigSemErr    error
	Children           []SpecNode
}

func AnalyseSpec

func AnalyseSpec(path string) (SpecNode, error)

func CurrentApps

func CurrentApps(path string) ([]SpecNode, error)

func ScanForApps

func ScanForApps(path string) ([]SpecNode, error)

func (SpecNode) Flatten

func (s SpecNode) Flatten() ([]SpecNode, error)

func (SpecNode) IsAppNode

func (s SpecNode) IsAppNode() bool

func (SpecNode) IsAppSyntaxValid

func (s SpecNode) IsAppSyntaxValid() bool

func (SpecNode) IsValidApp

func (s SpecNode) IsValidApp() bool

func (SpecNode) Traverse

func (s SpecNode) Traverse(t func(node SpecNode) error) error

type TraversalStepAnalysis

type TraversalStepAnalysis struct {
	HasAppYaml            bool
	HasProjectsDir        bool
	TraversableCandidates []os.DirEntry
}

Directories

Path Synopsis
util

Jump to

Keyboard shortcuts

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