Documentation
¶
Index ¶
- Variables
- func DownloadArtifacts(artifacts []Artifact, destination string) error
- func EC2InstanceTags() (map[string]string, error)
- func Glob(root string, pattern string) (matches []string, e error)
- func InDebugMode() bool
- func LoggerInitDebug()
- func MachineHostname() string
- func MachineIsWindows() bool
- func StartDownload(quit chan string, download Download)
- func UploadArtifacts(client Client, job *Job, artifacts []*Artifact, destination string) error
- func Version() string
- type Agent
- type AgentRegistration
- type Artifact
- type Client
- func (c *Client) APIReq(v interface{}, method string, path string, body interface{}) error
- func (c *Client) AgentConnect(agent *Agent) error
- func (c *Client) AgentDisconnect(agent *Agent) error
- func (c *Client) AgentRegister(name string, priority string, metaData []string) (string, error)
- func (c *Client) ArtifactUpdate(job *Job, artifact Artifact) (*Artifact, error)
- func (c *Client) CreateArtifacts(job *Job, artifacts []*Artifact) ([]Artifact, error)
- func (c *Client) DataGet(job *Job, key string) (*Data, error)
- func (c *Client) DataSet(job *Job, key string, value string) (*Data, error)
- func (c *Client) DoReq(req *http.Request, v interface{}) error
- func (c *Client) Get(v interface{}, path string) error
- func (c *Client) JobAccept(job *Job) (*Job, error)
- func (c *Client) JobFind(id string) (*Job, error)
- func (c *Client) JobNext() (*Job, error)
- func (c *Client) JobUpdate(job *Job) (*Job, error)
- func (c *Client) NewRequest(method string, path string, body interface{}) (*http.Request, error)
- func (c *Client) Post(v interface{}, path string, body interface{}) error
- func (c *Client) Put(v interface{}, path string, body interface{}) error
- func (c *Client) SearchArtifacts(buildId string, searchQuery string, jobQuery string, stateQuery string) ([]Artifact, error)
- type Data
- type Download
- type FormUploader
- type Job
- type LogFormatter
- type LoggerFields
- type Process
- type S3Uploader
- type Uploader
Constants ¶
This section is empty.
Variables ¶
var Logger = initLogger()
Functions ¶
func DownloadArtifacts ¶
func EC2InstanceTags ¶
func InDebugMode ¶
func InDebugMode() bool
func LoggerInitDebug ¶
func LoggerInitDebug()
func MachineHostname ¶
func MachineHostname() string
func MachineIsWindows ¶
func MachineIsWindows() bool
func StartDownload ¶
func UploadArtifacts ¶
Types ¶
type Agent ¶
type Agent struct {
// The name of the agent
Name string
// The client the agent will use to communicate to
// the API
Client Client
// The PID of the agent
PID int `json:"pid,omitempty"`
// The hostname of the agent
Hostname string `json:"hostname,omitempty"`
// The boostrap script to run
BootstrapScript string
// Run jobs in a PTY
RunInPty bool
// The currently running Job
Job *Job
// contains filtered or unexported fields
}
func (*Agent) MonitorSignals ¶
func (a *Agent) MonitorSignals()
type AgentRegistration ¶
type AgentRegistration struct {
// The access token for the agent
AccessToken string `json:"access_token"`
// Hostname of the machine
Hostname string `json:"hostname"`
// The priority of the agent
Priority string `json:"priority,omitempty"`
// The name of the new agent
Name string `json:"name"`
// Meta data for the agent
MetaData []string `json:"meta_data"`
}
func (*AgentRegistration) String ¶
func (a *AgentRegistration) String() string
type Artifact ¶
type Artifact struct {
// The ID of the artifact
ID string `json:"id,omitempty"`
// The current state of the artifact. Default is "new"
State string `json:"state,omitempty"`
// The relative path to the file
Path string `json:"path"`
// The absolute path path to the file
AbsolutePath string `json:"absolute_path"`
// The glob path that was used to identify this file
GlobPath string `json:"glob_path"`
// The size of the file
FileSize int64 `json:"file_size"`
// Where we should upload the artifact to. If nil,
// it will upload to Buildbox.
URL string `json:"url,omitempty"`
// When uploading artifacts to Buildbox, the API will return some
// extra information on how/where to upload the file.
Uploader struct {
// Where/how to upload the file
Action struct {
// What the host to post to
URL string `json:"url,omitempty"`
// POST, PUT, GET, etc.
Method string
// What's the path at the URL we need to upload to
Path string
// What's the key of the file input named?
FileInput string `json:"file_input"`
}
// Data that should be sent along with the upload
Data map[string]string
}
}
func BuildArtifact ¶
func CollectArtifacts ¶
type Client ¶
type Client struct {
// The URL of the Buildbox Agent API to communicate with. Defaults to
// "https://agent.buildbox.io/v2".
URL string
// The authorization token agent being used to make API requests
AuthorizationToken string
// UserAgent to be provided in API requests. Set to DefaultUserAgent if not
// specified.
UserAgent string
}
func (*Client) AgentConnect ¶
func (*Client) AgentDisconnect ¶
func (*Client) AgentRegister ¶
func (*Client) ArtifactUpdate ¶
func (*Client) CreateArtifacts ¶
Sends all the artifacts at once to the Buildbox Agent API. This will allow the UI to show what artifacts will be uploaded. Their state starts out as "new"
func (*Client) DoReq ¶
Submits an HTTP request, checks its response, and deserializes the response into v.
func (*Client) NewRequest ¶
Generates an HTTP request for the Buildbox API, but does not perform the request.
type Data ¶
type FormUploader ¶
type FormUploader struct {
}
func (*FormUploader) Setup ¶
func (u *FormUploader) Setup(destination string) error
func (*FormUploader) URL ¶
func (u *FormUploader) URL(artifact *Artifact) string
The FormUploader doens't specify a URL, as one is provided by Buildbox after uploading
func (*FormUploader) Upload ¶
func (u *FormUploader) Upload(artifact *Artifact) error
type Job ¶
type Job struct {
ID string
State string
Env map[string]string
Output string `json:"output,omitempty"`
ExitStatus string `json:"exit_status,omitempty"`
StartedAt string `json:"started_at,omitempty"`
FinishedAt string `json:"finished_at,omitempty"`
// contains filtered or unexported fields
}
The Job struct uses strings for StartedAt and FinishedAt because if they were actual date objects, then when this struct is initialized they would have a default value of: 00:00:00.000000000. This causes problems for the Buildbox Agent API because it looks for the presence of values in these properties to determine if the build has finished.
type LogFormatter ¶
type LogFormatter struct {
}
type LoggerFields ¶
type Process ¶
type Process struct {
Output string
Pid int
Running bool
RunInPty bool
ExitStatus string
// contains filtered or unexported fields
}
func InitProcess ¶
type S3Uploader ¶
type S3Uploader struct {
// The destination which includes the S3 bucket name
// and the path.
// s3://my-bucket-name/foo/bar
Destination string
// The S3 Bucket we're uploading these files to
Bucket *s3.Bucket
}
func (*S3Uploader) Setup ¶
func (u *S3Uploader) Setup(destination string) error
func (*S3Uploader) URL ¶
func (u *S3Uploader) URL(artifact *Artifact) string
func (*S3Uploader) Upload ¶
func (u *S3Uploader) Upload(artifact *Artifact) error