agent

package
v0.0.0-...-a6c55ee Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2017 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSecretMask           = "********"
	DefaultCancelCommandTimeout = 25 * time.Second
)

Variables

View Source
var (
	CancelCommandTimeout   = DefaultCancelCommandTimeout
	CancelBuildTimeout     = 30 * time.Second
	BuildDebugToConsoleLog = true
)
View Source
var (
	AgentId string
)
View Source
var UNIT_TEST_REPORT_TEMPLATE = `` /* 1774-byte string literal not displayed */

Functions

func AppendUrlParam

func AppendUrlParam(base *url.URL, paramName, paramValue string) *url.URL

func AppendUrlPath

func AppendUrlPath(base *url.URL, path string) *url.URL

func BaseDirOfPathWithWildcard

func BaseDirOfPathWithWildcard(path string) string

func CleanRegistration

func CleanRegistration() error

func Cleandir

func Cleandir(log io.Writer, root string, allows ...string) error

func CommandAnd

func CommandAnd(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandCleandir

func CommandCleandir(s *BuildSession, cmd *protocol.BuildCommand) (err error)

func CommandCompose

func CommandCompose(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandCond

func CommandCond(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandDownloadArtifact

func CommandDownloadArtifact(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandEcho

func CommandEcho(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandExec

func CommandExec(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandExport

func CommandExport(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandFail

func CommandFail(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandGenerateTestReport

func CommandGenerateTestReport(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandMkdirs

func CommandMkdirs(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandOr

func CommandOr(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandReport

func CommandReport(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandSecret

func CommandSecret(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandTest

func CommandTest(s *BuildSession, cmd *protocol.BuildCommand) error

func CommandUploadArtifact

func CommandUploadArtifact(s *BuildSession, cmd *protocol.BuildCommand) error

func ComputeMd5

func ComputeMd5(filePath string) (string, error)

func Err

func Err(f string, args ...interface{}) error

func Executors

func Executors() map[string]Executor

func GetAgentRuntimeInfo

func GetAgentRuntimeInfo() *protocol.AgentRuntimeInfo

func GetState

func GetState(key string) string

func GoServerRemoteClient

func GoServerRemoteClient(withClientCert bool) (*http.Client, error)

func GoServerRootCAs

func GoServerRootCAs() (*x509.CertPool, error)

func GoServerTlsConfig

func GoServerTlsConfig(withClientCert bool) (*tls.Config, error)

func Initialize

func Initialize()

func Join

func Join(sep string, parts ...string) string

func LogDebug

func LogDebug(format string, v ...interface{})

func LogInfo

func LogInfo(format string, v ...interface{})

func Mkdirs

func Mkdirs(path string) error

func NotImplemented

func NotImplemented(s *BuildSession, cmd *protocol.BuildCommand) error

func ParseChecksum

func ParseChecksum(checksum string) map[string]string

func ReadGoServerCACert

func ReadGoServerCACert() error

func Register

func Register() error

func SetState

func SetState(key, value string)

func Sprintf

func Sprintf(f string, args ...interface{}) string

func Start

func Start() error

func UsableSpace

func UsableSpace() int64

func UsableSpaceString

func UsableSpaceString() string

Types

type Artifacts

type Artifacts struct {
	// contains filtered or unexported fields
}

func (*Artifacts) DownloadDir

func (u *Artifacts) DownloadDir(source *url.URL, destPath string) error

func (*Artifacts) DownloadFile

func (u *Artifacts) DownloadFile(source *url.URL, destPath string) (err error)

func (*Artifacts) Upload

func (u *Artifacts) Upload(source, destPath string, destURL *url.URL) (err error)

func (*Artifacts) VerifyChecksum

func (u *Artifacts) VerifyChecksum(srcPath, destPath, checksumFname string) error

func (*Artifacts) VerifyChecksumFile

func (u *Artifacts) VerifyChecksumFile(srcFname, fname, checksumFname string) error

type BuildConsole

type BuildConsole struct {
	Url        *url.URL
	HttpClient *http.Client
	// contains filtered or unexported fields
}

func MakeBuildConsole

func MakeBuildConsole(httpClient *http.Client, url *url.URL) *BuildConsole

func (*BuildConsole) Close

func (console *BuildConsole) Close() error

func (*BuildConsole) Flush

func (console *BuildConsole) Flush()

func (*BuildConsole) Write

func (console *BuildConsole) Write(data []byte) (int, error)

type BuildSession

type BuildSession struct {
	// contains filtered or unexported fields
}

func MakeBuildSession

func MakeBuildSession(buildId string,
	command *protocol.BuildCommand,
	console io.WriteCloser,
	artifacts *Artifacts,
	artifactUploadBaseURL *url.URL,
	send chan *protocol.Message,
	rootDir string) *BuildSession

func (*BuildSession) Close

func (s *BuildSession) Close() error

func (*BuildSession) ConsoleLog

func (s *BuildSession) ConsoleLog(format string, a ...interface{})

func (*BuildSession) Env

func (s *BuildSession) Env() []string

func (*BuildSession) ProcessCommand

func (s *BuildSession) ProcessCommand() error

func (*BuildSession) ReplaceEcho

func (s *BuildSession) ReplaceEcho(name string, value interface{})

func (*BuildSession) Report

func (s *BuildSession) Report(jobState string) *protocol.Report

func (*BuildSession) Run

func (s *BuildSession) Run() error

type Config

type Config struct {
	Hostname           string
	SendMessageTimeout time.Duration
	ServerUrl          *url.URL
	ServerHostAndPort  string
	ContextPath        string
	WebSocketPath      string
	RegistrationPath   string
	TokenPath          string
	WorkingDir         string
	LogDir             string
	ConfigDir          string
	IpAddress          string

	AgentAutoRegisterKey             string
	AgentAutoRegisterResources       string
	AgentAutoRegisterEnvironments    string
	AgentAutoRegisterElasticAgentId  string
	AgentAutoRegisterElasticPluginId string

	GoServerCAFile      string
	AgentPrivateKeyFile string
	AgentCertFile       string
	AgentIdFile         string
	AgentTokenFile      string
	OutputDebugLog      bool
}

func GetConfig

func GetConfig() *Config

func LoadConfig

func LoadConfig() *Config

func (*Config) HttpsServerURL

func (c *Config) HttpsServerURL() string

func (*Config) IsElasticAgent

func (c *Config) IsElasticAgent() bool

func (*Config) MakeFullServerURL

func (c *Config) MakeFullServerURL(u string) (*url.URL, error)

func (*Config) RegistrationURL

func (c *Config) RegistrationURL() (*url.URL, error)

func (*Config) TokenURL

func (c *Config) TokenURL(agentID string) (*url.URL, error)

func (*Config) WssServerURL

func (c *Config) WssServerURL() string

type Error

type Error struct {
	FailureMessage
}

type Executor

type Executor func(session *BuildSession, cmd *protocol.BuildCommand) error

type Failure

type Failure struct {
	FailureMessage
}

type FailureMessage

type FailureMessage struct {
	StackTrace string
}

type Logger

type Logger struct {
	Info  *log.Logger
	Debug *log.Logger
	Error *log.Logger
}

func MakeLogger

func MakeLogger(logDir, file string, debug bool) *Logger

type TestCase

type TestCase struct {
	Name    string
	Failure *Failure
	Error   *Error
}

type UnitTestReport

type UnitTestReport struct {
	Tests     int
	Failures  int
	Skipped   int
	Time      float64
	TestCases []*TestCase
}

func (*UnitTestReport) Merge

func (r *UnitTestReport) Merge(another *UnitTestReport)

type WebsocketConnection

type WebsocketConnection struct {
	Conn     *websocket.Conn
	Send     chan *protocol.Message
	Received chan *protocol.Message
}

func MakeWebsocketConnection

func MakeWebsocketConnection(wsLoc, httpLoc string) (*WebsocketConnection, error)

func (*WebsocketConnection) Close

func (wc *WebsocketConnection) Close()

Jump to

Keyboard shortcuts

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