brigade

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package brigade provides the common types for brigade components.

Index

Constants

View Source
const DefaultVCSSidecar = "deis/git-sidecar:latest"

DefaultVCSSidecar is the default image that fetches a repo from a VCS.

Variables

This section is empty.

Functions

func ProjectID

func ProjectID(id string) string

ProjectID will encode a project name.

Types

type Build

type Build struct {
	// ID is the unique ID for a webhook event.
	ID string `json:"id"`
	// ProjectID is the computed name of the project (brigade-aeff2343a3234ff)
	ProjectID string `json:"project_id"`
	// Type is the event type (push, pull_request, tag, etc.)
	Type string `json:"type"`
	// Provider is the name of the service that caused the event (github, vsts, cron, ...)
	Provider string `json:"provider"`
	// Commit is the ID of the VCS version, such as the Git commit SHA.
	Commit string `json:"commit"`
	// Payload is the raw data as received by the webhook.
	Payload []byte `json:"payload,omitempty"`
	// Script is the brigadeJS to be executed.
	Script []byte `json:"script"`
	// Worker is the master job that is running this build.
	// The Worker's properties (creation time, state, exit code, and so on)
	// reflect a "roll-up" of the job.
	// This property is not guaranteed to be set, and may be nil.
	Worker *Worker `json:"worker,omitempty"`
}

Build represents an invocation of an event in Brigade.

Each build has a unique ID, and is tied to a project, as well as an event type.

type Github

type Github struct {
	// Token is used for oauth2 for client interactions.
	Token string `json:"token"`
}

Github describes the Github configuration for a project.

type Job

type Job struct {
	// ID is the name for the pod running this job
	ID string `json:"id"`
	// Name is the name for the job
	Name string `json:"name"`
	// Image is the execution environment running the job
	Image string `json:"image"`
	// CreationTime is a timestamp representing the server time when this object was
	// created. It is not guaranteed to be set in happens-before order across separate operations.
	CreationTime time.Time `json:"creation_time"`
	// StartTime is the time the job started.
	StartTime time.Time `json:"start_time"`
	// EndTime is the time the job completed. This may not be present
	// if the job has not completed.
	EndTime time.Time `json:"end_time"`
	// ExitCode is the exit code of the job. This may not be present
	// if the job has not completed.
	ExitCode int32 `json:"exit_code"`
	// Status is a textual representation of the job's running status
	Status JobStatus `json:"status"`
}

Job is a single job that is executed when a build is triggered for an event.

type JobStatus

type JobStatus string

JobStatus is a label for the condition of a Job at the current time.

const (
	// JobPending means the job has been accepted by the system, but one or more of the containers
	// has not been started. This includes time before being bound to a node, as well as time spent
	// pulling images onto the host.
	JobPending JobStatus = "Pending"
	// JobRunning means the job has been bound to a node and all of the containers have been started.
	// At least one container is still running or is in the process of being restarted.
	JobRunning JobStatus = "Running"
	// JobSucceeded means that all containers in the job have voluntarily terminated
	// with a container exit code of 0, and the system is not going to restart any of these containers.
	JobSucceeded JobStatus = "Succeeded"
	// JobFailed means that all containers in the job have terminated, and at least one container has
	// terminated in a failure (exited with a non-zero exit code or was stopped by the system).
	JobFailed JobStatus = "Failed"
	// JobUnknown means that for some reason the state of the job could not be obtained, typically due
	// to an error in communicating with the host of the job.
	JobUnknown JobStatus = "Unknown"
)

These are the valid statuses of jobs.

type Kubernetes

type Kubernetes struct {
	// Namespace is the namespace of this project.
	Namespace string `json:"namespace"`
	// VCSSidecar is the image name/tag for the sidecar that pulls VCS data
	VCSSidecar string `json:"vcsSidecar"`
}

Kubernetes describes the Kubernetes configuration for a project.

type Project

type Project struct {
	// ID is the computed name of the project (brigade-aeff2343a3234ff)
	ID string `json:"id"`
	// Name is the human readable name of project.
	Name string `json:"name"`
	// Repo describes the repository where the source code is stored.
	Repo Repo `json:"repo"`
	// Kubernetes holds information about Kubernetes
	Kubernetes Kubernetes `json:"kubernetes"`
	// SharedSecret is the GitHub shared key
	SharedSecret string `json:"shared_secret"`
	// Github holds information about Github.
	Github Github `json:"github"`
	// Secrets is environment variables for brigade.js
	Secrets map[string]string `json:"secrets"`
}

Project describes an Brigade project

This is an internal representation of a project, and contains data that should not be made available to the JavaScript runtime.

type Repo

type Repo struct {
	// Name of the repository. For GitHub, this is of the form `org/name` or `user/name`
	Name string `json:"name"`
	// Owner of the repositoy. For Github this is `org` or `user`
	Owner string `json:"owner"`
	// CloneURL is the URL at which the repository can be cloned
	// Traditionally, this is an HTTPS URL.
	CloneURL string `json:"cloneURL"`
	// SSHKey is the auth string for SSH-based cloning
	SSHKey string `json:"sshKey"`
}

Repo describes a Git repository.

type Worker

type Worker struct {
	// ID is the name for the pod running this job
	ID string `json:"id"`
	// BuildID is the build ID (ULID).
	BuildID string `json:"build_id"`
	// ProjectID is the computed name of the project (brigade-aeff2343a3234ff)
	ProjectID string `json:"project_id"`
	// Commit is the ID of the VCS version, such as the Git commit SHA.
	Commit string `json:"commit"`
	// StartTime is the time the worker started.
	StartTime time.Time `json:"start_time"`
	// EndTime is the time the worker completed. This may not be present
	// if the job has not completed.
	EndTime time.Time `json:"end_time"`
	// ExitCode is the exit code of the job. This may not be present
	// if the job has not completed.
	ExitCode int32 `json:"exit_code"`
	// Status is a textual representation of the job's running status
	Status JobStatus `json:"status"`
}

Worker represents the worker that runs a build. A worker executes (and wraps) the jobs in a build.

Jump to

Keyboard shortcuts

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