core

package
v0.0.0-...-5fc8188 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PARSER_CMD_BEGIN cmdParserState = iota
	PARSER_SPACE
	PARSER_FLAG_KEY
	PARSER_FLAG_VALUE
	PARSER_ARGS
	PARSER_ERROR
)
View Source
const (
	RepeatedEveryDay  = "every-day"
	RepeatedEveryHour = "every-hour"
)

Variables

View Source
var (
	DefaultDockerUnixSock    = "unix:///var/run/docker.sock"
	DefaultDockerTCPSock     = "tcp://127.0.0.1:2375"
	DefaultDockerHubRegistry = RegistryConfig{}
	DockerCleanImage         = "alpine:3.12.2"
)
View Source
var PluginInsideContainer = filepath.Join("/etc", "vulcan", "plugins")
View Source
var ToolChainInsideContainer = filepath.Join("/etc", "vulcan", "toolchains")

Functions

func CreateTmpDir

func CreateTmpDir() error

func DisplayDockerLog

func DisplayDockerLog(in io.Reader) (string, error)

func ParseCommandLine

func ParseCommandLine(line string) ([]string, error)

func ReadEnvVariableIfHas

func ReadEnvVariableIfHas(str string) string

func RemoveAfterDone

func RemoveAfterDone(cli *client.Client, id string)

func SetCurrentStep

func SetCurrentStep(stepId string) error

func SetOutput

func SetOutput(key, value string) error

func StreamDockerLog

func StreamDockerLog(in io.Reader, f StreamHandler)

func SumContentMD5

func SumContentMD5(file string) (string, error)

func UpdateEnvFromFile

func UpdateEnvFromFile(envFile string) ([]string, error)

func VerifyDockerHostConnection

func VerifyDockerHostConnection(ctx context.Context, dockerHosts []string) (string, error)

Types

type ArgsConfig

type ArgsConfig map[string]string

func (ArgsConfig) ReplaceEnv

func (a ArgsConfig) ReplaceEnv() error

type DockerClient

type DockerClient struct {
	Client *client.Client
	DockerConfig
}

func ConnectDockerHost

func ConnectDockerHost(ctx context.Context, hosts []string) (dockerCli DockerClient, err error)

func (*DockerClient) BuildImageWithOpts

func (c *DockerClient) BuildImageWithOpts(ctx context.Context, tarFile string, opt types.ImageBuildOptions) (types.ImageBuildResponse, error)

func (*DockerClient) Close

func (c *DockerClient) Close()

func (*DockerClient) DeployImage

func (c *DockerClient) DeployImage(ctx context.Context, username, password, image string) (io.ReadCloser, error)

func (*DockerClient) ImageExist

func (c *DockerClient) ImageExist(ctx context.Context, imageRef string) (bool, []string, error)

func (*DockerClient) PullImage

func (c *DockerClient) PullImage(ctx context.Context, registry RegistryConfig, reference string) (io.ReadCloser, error)

func (*DockerClient) RemoveImage

func (c *DockerClient) RemoveImage(ctx context.Context, imageId string) ([]types.ImageDeleteResponseItem, error)

func (*DockerClient) TagImage

func (c *DockerClient) TagImage(ctx context.Context, src, dest string) error

type DockerConfig

type DockerConfig struct {
	Hosts      []string         `yaml:"hosts,omitempty"`
	Registries []RegistryConfig `yaml:"registries,omitempty"`
}

Docker config

type JobConfig

type JobConfig struct {
	Id        string       `yaml:"-"`
	Name      string       `yaml:"name,omitempty"`
	RunOn     string       `yaml:"run-on,omitempty"`
	BaseDir   string       `yaml:"base-dir,omitempty"`
	OS        string       `yaml:"os,omitempty"`
	Arch      string       `yaml:"arch,omitempty"`
	Artifacts []string     `yaml:"artifacts,omitempty"`
	Hosts     []string     `yaml:"hosts,omitempty"`
	Args      *ArgsConfig  `yaml:"args,omitempty"`
	Steps     []StepConfig `yaml:"steps,omitempty"`
}

type OnConfig

type OnConfig struct {
	Branch          []string `yaml:"branch,omitempty"`
	Event           []string `yaml:"event,omitempty"`
	*ScheduleConfig `yaml:"schedule,omitempty"`
}

type OutputVal

type OutputVal struct {
	Key   string
	Value string
}

func GetAllOutputs

func GetAllOutputs() ([]OutputVal, error)

type ProjectConfig

type ProjectConfig struct {
	Name      string `yaml:"name,omitempty"`
	*OnConfig `yaml:"on,omitempty"`
	Jobs      map[string]*JobConfig `yaml:"jobs,omitempty"`
}

func ReadProjectConfig

func ReadProjectConfig(configFile string) (c ProjectConfig, err error)

type RegistryConfig

type RegistryConfig struct {
	Address  string `yaml:"address,omitempty"`
	Username string `yaml:"username,omitempty"`
	Password string `yaml:"password,omitempty"`
}

type ScheduleConfig

type ScheduleConfig struct {
	Cron     string `yaml:"cron,omitempty"`
	Repeated string `yaml:"repeat,omitempty"`
}

type StepConfig

type StepConfig struct {
	Id   string      `yaml:"id,omitempty"`
	Name string      `yaml:"name,omitempty"`
	Run  string      `yaml:"run,omitempty"`
	Use  string      `yaml:"use,omitempty"`
	Args *ArgsConfig `yaml:"args,omitempty"`
	With *ArgsConfig `yaml:"with,omitempty"`
}

type StreamHandler

type StreamHandler func(s string)

type StringList

type StringList []string

func (*StringList) Set

func (s *StringList) Set(value string) error

func (*StringList) String

func (s *StringList) String() string

Implement the flag.Value interface

Jump to

Keyboard shortcuts

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