config

package
v0.0.0-...-ca671ec Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RepoTypeGithub means sources codes of the targets of deployment are stored in github and we deploy from the codes.
	RepoTypeGithub = RepositoryType("github")
	// RepoTypeDocker means prebuilt docker images are the targets of deployment.
	RepoTypeDocker = RepositoryType("docker")

	// HostTypeNode means deploy target host is a normal server
	HostTypeNode = HostType("node")
	// HostTypeK8s means deploy target host is a k8s cluster
	HostTypeK8s = HostType("k8s")
)

Variables

This section is empty.

Functions

func GetPivotalIDFromCommits

func GetPivotalIDFromCommits(owner, repoName, current, latest string) ([]int, error)

func LockEnvironment

func LockEnvironment(client ETCDInterface, projectName, projectEnv, lock string) (err error)

LockEnvironment Locks or unlock an environment for deploy

func PostToPivotal

func PostToPivotal(piv *PivotalConfiguration, env, owner, name, current, latest string) error

func SetComment

func SetComment(client ETCDInterface, projectName, projectEnv, comment string) (err error)

SetComment will set the comment field on an environment

func Store

func Store(client ETCDInterface, cfg Config) error

Store stores "cfg" to etcd

Types

type Config

type Config struct {
	Projects   []Project             `json:"-" yaml:"projects,omitempty"`
	DeployUser string                `json:"deploy_user" yaml:"deploy_user"`
	Notify     string                `json:"notify" yaml:"notify"`
	Pivotal    *PivotalConfiguration `json:"pivotal,omitempty" yaml:"pivotal,omitempty"`
}

Config is a set of Goship configurations

func Load

func Load(client ETCDInterface) (Config, error)

Load loads a deployment configuration from etcd

type ETCDInterface

type ETCDInterface interface {
	Get(string, bool, bool) (*etcd.Response, error)
	Set(string, string, uint64) (*etcd.Response, error)
}

ETCDInterface emulates ETCD to allow testing

type Environment

type Environment struct {
	Name         string   `json:"-" yaml:"name"`
	Deploy       string   `json:"deploy" yaml:"deploy"`
	RepoPath     string   `json:"repo_path" yaml:"repo_path"`
	Hosts        []string `json:"hosts" yaml:"hosts,omitempty"`
	Branch       string   `json:"branch" yaml:"branch"`
	Comment      string   `json:"comment" yaml:"comment"`
	IsLocked     bool     `json:"is_locked,omitempty" yaml:"is_locked,omitempty"`
	K8sNamespace string   `json:"k8s_namespace" yaml:"k8s_namespace"`
}

Environment stores information about an individual environment, such as its name and whether it is deployable.

func EnvironmentFromName

func EnvironmentFromName(projects []Project, projectName, environmentName string) (*Environment, error)

EnvironmentFromName takes an environment and project name as a string and returns an environment by the given environment name under a project with the given project name if it can find one.

type HostType

type HostType string

func (HostType) Valid

func (t HostType) Valid() bool

type PivotalConfiguration

type PivotalConfiguration struct {
	Token    string `json:"token" yaml:"token"`
	AddLabel bool   `json:"add_label" yaml:"add_label"`
}

PivotalConfiguration used to store Pivotal interface

type Project

type Project struct {
	Name         string `json:"-" yaml:"name"`
	Repo         `json:",inline" yaml:",inline"`
	RepoType     RepositoryType `json:"repo_type" yaml:"repo_type"`
	HostType     HostType       `json:"host_type" yaml:"host_type"`
	Environments []Environment  `json:"-" yaml:"envs"`
	TravisToken  string         `json:"travis_token" yaml:"travis_token"`
	K8sResource  string         `json:"k8s_resource" yaml:"k8s_resource"`
	K8sSelector  string         `json:"k8s_selector" yaml:"k8s_selector"`
	// Source is an additional revision control system.
	// It is effective only if RepoType does not serve source codes.
	Source *Repo `json:"source,omitempty" yaml:"source,omitempty"`
}

Project stores information about a GitHub project, such as its GitHub URL and repo name, and a list of extra columns (PluginColumns)

func ProjectFromName

func ProjectFromName(projects []Project, projectName string) (Project, error)

ProjectFromName takes a project name as a string and returns a project by that name if it can find one.

func (Project) SourceRepo

func (p Project) SourceRepo() Repo

type Repo

type Repo struct {
	RepoOwner string `json:"repo_owner" yaml:"repo_owner"`
	RepoName  string `json:"repo_name" yaml:"repo_name"`
}

Repo identifies a revision repository

type RepositoryType

type RepositoryType string

A RepositoryType describes a type of revision control system which manages target revisions of deployment.

func (RepositoryType) Valid

func (t RepositoryType) Valid() bool

Jump to

Keyboard shortcuts

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