gocd

package
v0.0.0-...-d3e7e1b Latest Latest
Warning

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

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

Documentation

Overview

Package gocd provides a client for using the GoCD Server API.

Usage:

import "github.com/drewsonne/go-gocd/gocd"

Construct a new GoCD client and supply the URL to your GoCD server and if required, username and password. Then use the various services on the client to access different parts of the GoCD API. For example:

package main
import (
	"github.com/drewsonne/go-gocd/gocd"
	"context"
	"fmt"
)

func main() {
	cfg := gocd.Configuration{
		Server: "https://my_gocd/go/",
		Username: "ApiUser",
		Password: "MySecretPassword",
	}

	c := cfg.Client()

	// list all agents in use by the GoCD Server
	var a []*gocd.Agent
	var err error
	var r *gocd.APIResponse
	if a, r, err = c.Agents.List(context.Background()); err != nil {
		if r.HTTP.StatusCode == 404 {
			fmt.Println("Couldn't find agent")
		} else {
			panic(err)
		}
	}

	fmt.Println(a)
}

If you wish to use your own http client, you can use the following idiom

package main

import (
	"github.com/drewsonne/go-gocd/gocd"
	"net/http"
	"context"
)

func main() {
	client := gocd.NewClient(
		&gocd.Configuration{},
		&http.Client{},
	)
	client.Login(context.Background())
}

The services of a client divide the API into logical chunks and correspond to the structure of the GoCD API documentation at https://api.gocd.org/current/.

Index

Constants

View Source
const (
	EnvVarDefaultProfile = "GOCD_DEFAULT_PROFILE"
	EnvVarServer         = "GOCD_SERVER"
	EnvVarUsername       = "GOCD_USERNAME"
	EnvVarPassword       = "GOCD_PASSWORD"
	EnvVarSkipSsl        = "GOCD_SKIP_SSL_CHECK"
)

Environment variables for configuration.

View Source
const (
	// JobStateTransitionPassed "Passed"
	JobStateTransitionPassed = "Passed"
	// JobStateTransitionScheduled "Scheduled"
	JobStateTransitionScheduled = "Scheduled"
)
View Source
const (
	LogLevelEnvVarName = "GOCD_LOG_LEVEL"
	LogLevelDefault    = "WARNING"
	LogTypeEnvVarName  = "GOCD_LOG_TYPE"
	LogTypeDefault     = "TEXT"
)

Set logging level and type constants

View Source
const ConfigDirectoryPath = "~/.gocd.conf"

ConfigDirectoryPath is the location where the authentication information is stored

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(response *http.Response) error

CheckResponse asserts that the http response status code was 2xx.

func ConfigFilePath

func ConfigFilePath() (string, error)

ConfigFilePath specifies the default path to a config file

func LoadConfigByName

func LoadConfigByName(name string, cfg *Configuration) (err error)

LoadConfigByName loads configurations from yaml at default file location

func LoadConfigFromFile

func LoadConfigFromFile() (cfgs map[string]*Configuration, err error)

LoadConfigFromFile on disk and return it as a Config item

func SetupLogging

func SetupLogging(log *logrus.Logger)

SetupLogging based on Environment Variables

Set Logging level with $GOCD_LOG_LEVEL
Allowed Values:
  - DEBUG
  - INFO
  - WARNING
  - ERROR
  - FATAL
  - PANIC

Set Logging type  with $GOCD_LOG_TYPE
Allowed Values:
  - JSON
  - TEXT

Types

type APIClientRequest

type APIClientRequest struct {
	Method       string
	Path         string
	APIVersion   string
	RequestBody  interface{}
	ResponseType string
	ResponseBody interface{}
	Headers      map[string]string
}

APIClientRequest helper struct to reduce amount of code.

type APIRequest

type APIRequest struct {
	HTTP *http.Request
	Body string
}

APIRequest encapsulates the net/http.Request object, and a string representing the Body.

type APIResponse

type APIResponse struct {
	HTTP    *http.Response
	Body    string
	Request *APIRequest
}

APIResponse encapsulates the net/http.Response object, a string representing the Body, and a gocd.Request object encapsulating the response from the API.

type Agent

type Agent struct {
	UUID             string        `json:"uuid,omitempty"`
	Hostname         string        `json:"hostname,omitempty"`
	ElasticAgentID   string        `json:"elastic_agent_id,omitempty"`
	ElasticPluginID  string        `json:"elastic_plugin_id,omitempty"`
	IPAddress        string        `json:"ip_address,omitempty"`
	Sandbox          string        `json:"sandbox,omitempty"`
	OperatingSystem  string        `json:"operating_system,omitempty"`
	FreeSpace        int           `json:"free_space,omitempty"`
	AgentConfigState string        `json:"agent_config_state,omitempty"`
	AgentState       string        `json:"agent_state,omitempty"`
	Resources        []string      `json:"resources,omitempty"`
	Environments     []string      `json:"environments,omitempty"`
	BuildState       string        `json:"build_state,omitempty"`
	BuildDetails     *BuildDetails `json:"build_details,omitempty"`
	Links            *HALLinks     `json:"_links,omitempty,omitempty"`
	// contains filtered or unexported fields
}

Agent represents agent in GoCD.

func (a *Agent) GetLinks() *HALLinks

GetLinks returns HAL links for agent

func (a *Agent) RemoveLinks()

RemoveLinks sets the `Link` attribute as `nil`. Used when rendering an `Agent` struct to JSON.

type AgentBulkOperationUpdate

type AgentBulkOperationUpdate struct {
	Add    []string `json:"add,omitempty"`
	Remove []string `json:"remove,omitempty"`
}

AgentBulkOperationUpdate describes an action to be performed on an Environment or Resource during an agent update.

type AgentBulkOperationsUpdate

type AgentBulkOperationsUpdate struct {
	Environments *AgentBulkOperationUpdate `json:"environments,omitempty"`
	Resources    *AgentBulkOperationUpdate `json:"resources,omitempty"`
}

AgentBulkOperationsUpdate describes the structure for a single Operation in AgentBulkUpdate the PUT payload when updating multiple agents

type AgentBulkUpdate

type AgentBulkUpdate struct {
	Uuids            []string                   `json:"uuids"`
	Operations       *AgentBulkOperationsUpdate `json:"operations,omitempty"`
	AgentConfigState string                     `json:"agent_config_state,omitempty"`
}

AgentBulkUpdate describes the structure for the PUT payload when updating multiple agents

type AgentsResponse

type AgentsResponse struct {
	Links    *HALLinks `json:"_links,omitempty"`
	Embedded *struct {
		Agents []*Agent `json:"agents"`
	} `json:"_embedded,omitempty"`
}

AgentsResponse describes the structure of the API response when listing collections of agent object.

type AgentsService

type AgentsService service

AgentsService describes Actions which can be performed on agents

func (*AgentsService) BulkUpdate

func (s *AgentsService) BulkUpdate(ctx context.Context, agents AgentBulkUpdate) (string, *APIResponse, error)

BulkUpdate will change the configuration for multiple agents in a single request.

func (*AgentsService) Delete

func (s *AgentsService) Delete(ctx context.Context, uuid string) (string, *APIResponse, error)

Delete will remove an existing agent. Note: The agent must be disabled, and not currently building to be deleted.

func (*AgentsService) Get

func (s *AgentsService) Get(ctx context.Context, uuid string) (*Agent, *APIResponse, error)

Get will retrieve a single agent based on the provided UUID.

func (*AgentsService) JobRunHistory

func (s *AgentsService) JobRunHistory(ctx context.Context, uuid string) ([]*Job, *APIResponse, error)

JobRunHistory will return a list of Jobs run on this agent.

func (*AgentsService) List

func (s *AgentsService) List(ctx context.Context) ([]*Agent, *APIResponse, error)

List will retrieve all agents, their status, and metadata from the GoCD Server.

func (*AgentsService) Update

func (s *AgentsService) Update(ctx context.Context, uuid string, agent *Agent) (*Agent, *APIResponse, error)

Update will modify the configuration for an existing agents.

type Approval

type Approval struct {
	Type          string         `json:"type,omitempty"`
	Authorization *Authorization `json:"authorization,omitempty"`
}

Approval represents a request/response object describing the approval configuration for a GoCD Job

func (*Approval) Clean

func (a *Approval) Clean()

Clean ensures integrity of the schema by making sure empty elements are not printed to json.

type Artifact

type Artifact struct {
	Type        string `json:"type"`
	Source      string `json:"source"`
	Destination string `json:"destination"`
}

Artifact describes the result of a job

type Auth

type Auth struct {
	Username string
	Password string
}

Auth structure wrapping the Username and Password variables, which are used to get an Auth cookie header used for subsequent requests.

type Authorization

type Authorization struct {
	Users []string `json:"users,omitempty"`
	Roles []string `json:"roles,omitempty"`
}

Authorization describes the access control for a "manual" approval type. Specifies whoe (role or users) can approve the job to move to the next stage of the pipeline.

type BuildCause

type BuildCause struct {
	Approver          string             `json:"approver,omitempty"`
	MaterialRevisions []MaterialRevision `json:"material_revisions"`
	TriggerForced     bool               `json:"trigger_forced"`
	TriggerMessage    string             `json:"trigger_message"`
}

BuildCause describes the triggers which caused the build to start.

type BuildDetails

type BuildDetails struct {
	Links    *HALLinks `json:"_links"`
	Pipeline string    `json:"pipeline"`
	Stage    string    `json:"stage"`
	Job      string    `json:"job"`
}

BuildDetails describes the builds being performed on this agent.

type CipherText

type CipherText struct {
	EncryptedValue string    `json:"encrypted_value"`
	Links          *HALLinks `json:"_links"`
}

CipherText sescribes the response from the api with an encrypted value.

type Client

type Client struct {
	BaseURL  *url.URL
	Username string
	Password string

	UserAgent string

	Log *logrus.Logger

	Agents            *AgentsService
	PipelineGroups    *PipelineGroupsService
	Stages            *StagesService
	Jobs              *JobsService
	PipelineTemplates *PipelineTemplatesService
	Pipelines         *PipelinesService
	PipelineConfigs   *PipelineConfigsService
	Configuration     *ConfigurationService
	Encryption        *EncryptionService
	Plugins           *PluginsService
	Environments      *EnvironmentsService
	Properties        *PropertiesService
	// contains filtered or unexported fields
}

Client struct which acts as an interface to the GoCD Server. Exposes resource service handlers.

func NewClient

func NewClient(cfg *Configuration, httpClient *http.Client) *Client

NewClient creates a new client based on the provided configuration payload, and optionally a custom httpClient to allow overriding of http client structures.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *APIRequest, v interface{}, responseType string) (*APIResponse, error)

Do takes an HTTP request and resposne the response from the GoCD API endpoint.

func (*Client) Lock

func (c *Client) Lock()

Lock the client until release

func (*Client) Login

func (c *Client) Login(ctx context.Context) error

Login sends basic auth to the GoCD Server and sets an auth cookie in the client to enable cookie based auth for future requests.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}, apiVersion string) (req *APIRequest, err error)

NewRequest creates an HTTP requests to the GoCD API endpoints.

func (*Client) Unlock

func (c *Client) Unlock()

Unlock the client after a lock action

type ConfigApproval

type ConfigApproval struct {
	Type string `xml:"type,attr,omitempty" json:",omitempty"`
}

ConfigApproval part of cruise-control.xml. @TODO better documentation

type ConfigArtifact

type ConfigArtifact struct {
	Src         string `xml:"src,attr"`
	Destination string `xml:"dest,attr,omitempty" json:",omitempty"`
}

ConfigArtifact part of cruise-control.xml. @TODO better documentation

type ConfigAuthConfig

type ConfigAuthConfig struct {
	ID         string           `xml:"id,attr"`
	PluginID   string           `xml:"pluginId,attr"`
	Properties []ConfigProperty `xml:"property"`
}

ConfigAuthConfig part of cruise-control.xml. @TODO better documentation

type ConfigElastic

type ConfigElastic struct {
	Profiles []ConfigElasticProfile `xml:"profiles>profile"`
}

ConfigElastic part of cruise-control.xml. @TODO better documentation

type ConfigElasticProfile

type ConfigElasticProfile struct {
	ID         string           `xml:"id,attr"`
	PluginID   string           `xml:"pluginId,attr"`
	Properties []ConfigProperty `xml:"property"`
}

ConfigElasticProfile part of cruise-control.xml. @TODO better documentation

type ConfigEnvironmentVariable

type ConfigEnvironmentVariable struct {
	Name  string `xml:"name,attr"`
	Value string `xml:"value"`
}

ConfigEnvironmentVariable part of cruise-control.xml. @TODO better documentation

type ConfigFilter

type ConfigFilter struct {
	Ignore string `xml:"pattern,attr,omitempty"`
}

ConfigFilter part of cruise-control.xml. @TODO better documentation

type ConfigJob

type ConfigJob struct {
	Name                 string                      `xml:"name,attr"`
	EnvironmentVariables []ConfigEnvironmentVariable `xml:"environmentvariables>variable" json:",omitempty"`
	Tasks                ConfigTasks                 `xml:"tasks"`
	Resources            []string                    `xml:"resources>resource" json:",omitempty"`
	Artifacts            []ConfigArtifact            `xml:"artifacts>artifact" json:",omitempty"`
}

ConfigJob part of cruise-control.xml. @TODO better documentation

type ConfigMaterialRepository

type ConfigMaterialRepository struct {
	ID                  string                    `xml:"id,attr"`
	Name                string                    `xml:"name,attr"`
	PluginConfiguration ConfigPluginConfiguration `xml:"pluginConfiguration"`
	Configuration       []ConfigProperty          `xml:"configuration>property"`
	Packages            []ConfigPackage           `xml:"packages>package"`
}

ConfigMaterialRepository part of cruise-control.xml. @TODO better documentation

type ConfigPackage

type ConfigPackage struct {
	ID            string           `xml:"id,attr"`
	Name          string           `xml:"name,attr"`
	Configuration []ConfigProperty `xml:"configuration>property"`
}

ConfigPackage part of cruise-control.xml. @TODO better documentation

type ConfigParam

type ConfigParam struct {
	Name  string `xml:"name,attr"`
	Value string `xml:",chardata"`
}

ConfigParam part of cruise-control.xml. @TODO better documentation

type ConfigPipeline

type ConfigPipeline struct {
	Name                 string                      `xml:"name,attr"`
	LabelTemplate        string                      `xml:"labeltemplate,attr"`
	Params               []ConfigParam               `xml:"params>param"`
	GitMaterials         []GitRepositoryMaterial     `xml:"materials>git,omitempty"`
	PipelineMaterials    []PipelineMaterial          `xml:"materials>pipeline,omitempty"`
	Timer                string                      `xml:"timer"`
	EnvironmentVariables []ConfigEnvironmentVariable `xml:"environmentvariables>variable"`
	Stages               []ConfigStage               `xml:"stage"`
}

ConfigPipeline part of cruise-control.xml. @TODO better documentation

type ConfigPipelineGroup

type ConfigPipelineGroup struct {
	Name      string           `xml:"group,attr"`
	Pipelines []ConfigPipeline `xml:"pipeline"`
}

ConfigPipelineGroup contains a single pipeline groups

type ConfigPluginConfiguration

type ConfigPluginConfiguration struct {
	ID      string `xml:"id,attr"`
	Version string `xml:"version,attr"`
}

ConfigPluginConfiguration part of cruise-control.xml. @TODO better documentation

type ConfigProperty

type ConfigProperty struct {
	Key   string `xml:"key"`
	Value string `xml:"value"`
}

ConfigProperty part of cruise-control.xml. @TODO better documentation

type ConfigRepository

type ConfigRepository struct {
	Plugin string              `xml:"plugin,attr"`
	ID     string              `xml:"id,attr"`
	Git    ConfigRepositoryGit `xml:"git"`
}

ConfigRepository part of cruise-control.xml. @TODO better documentation

type ConfigRepositoryGit

type ConfigRepositoryGit struct {
	URL string `xml:"url,attr"`
}

ConfigRepositoryGit part of cruise-control.xml. @TODO better documentation

type ConfigRole

type ConfigRole struct {
	Name  string   `xml:"name,attr"`
	Users []string `xml:"users>user"`
}

ConfigRole part of cruise-control.xml. @TODO better documentation

type ConfigSCM

type ConfigSCM struct {
	ID                  string                    `xml:"id,attr"`
	Name                string                    `xml:"name,attr"`
	PluginConfiguration ConfigPluginConfiguration `xml:"pluginConfiguration"`
	Configuration       []ConfigProperty          `xml:"configuration>property"`
}

ConfigSCM part of cruise-control.xml. @TODO better documentation

type ConfigSecurity

type ConfigSecurity struct {
	AuthConfigs  []ConfigAuthConfig `xml:"authConfigs>authConfig"`
	Roles        []ConfigRole       `xml:"roles>role"`
	Admins       []string           `xml:"admins>user"`
	PasswordFile PasswordFilePath   `xml:"passwordFile"`
}

ConfigSecurity part of cruise-control.xml. @TODO better documentation

type ConfigServer

type ConfigServer struct {
	MailHost                  MailHost       `xml:"mailhost"`
	Security                  ConfigSecurity `xml:"security"`
	Elastic                   ConfigElastic  `xml:"elastic"`
	ArtifactsDir              string         `xml:"artifactsdir,attr"`
	SiteURL                   string         `xml:"siteUrl,attr"`
	SecureSiteURL             string         `xml:"secureSiteUrl,attr"`
	PurgeStart                string         `xml:"purgeStart,attr"`
	PurgeUpTo                 string         `xml:"purgeUpto,attr"`
	JobTimeout                int            `xml:"jobTimeout,attr"`
	AgentAutoRegisterKey      string         `xml:"agentAutoRegisterKey,attr"`
	WebhookSecret             string         `xml:"webhookSecret,attr"`
	CommandRepositoryLocation string         `xml:"commandRepositoryLocation,attr"`
	ServerID                  string         `xml:"serverId,attr"`
}

ConfigServer part of cruise-control.xml. @TODO better documentation

type ConfigStage

type ConfigStage struct {
	Name     string         `xml:"name,attr"`
	Approval ConfigApproval `xml:"approval,omitempty" json:",omitempty"`
	Jobs     []ConfigJob    `xml:"jobs>job"`
}

ConfigStage part of cruise-control.xml. @TODO better documentation

type ConfigTask

type ConfigTask struct {
	// Because we need to preserve the order of tasks, and we have an array of elements with mixed types,
	// we need to use this generic xml type for tasks.
	XMLName  xml.Name        `json:",omitempty"`
	Type     string          `xml:"type,omitempty"`
	RunIf    ConfigTaskRunIf `xml:"runif"`
	Command  string          `xml:"command,attr,omitempty"  json:",omitempty"`
	Args     []string        `xml:"arg,omitempty"  json:",omitempty"`
	Pipeline string          `xml:"pipeline,attr,omitempty"  json:",omitempty"`
	Stage    string          `xml:"stage,attr,omitempty"  json:",omitempty"`
	Job      string          `xml:"job,attr,omitempty"  json:",omitempty"`
	SrcFile  string          `xml:"srcfile,attr,omitempty"  json:",omitempty"`
	SrcDir   string          `xml:"srcdir,attr,omitempty"  json:",omitempty"`
}

ConfigTask part of cruise-control.xml. @TODO better documentation

type ConfigTaskRunIf

type ConfigTaskRunIf struct {
	Status string `xml:"status,attr"`
}

ConfigTaskRunIf part of cruise-control.xml. @TODO better documentation

type ConfigTasks

type ConfigTasks struct {
	Tasks []ConfigTask `xml:",any"`
}

ConfigTasks part of cruise-control.xml. @TODO better documentation

type ConfigXML

type ConfigXML struct {
	Repositories       []ConfigMaterialRepository `xml:"repositories>repository"`
	Server             ConfigServer               `xml:"server"`
	SCMS               []ConfigSCM                `xml:"scms>scm"`
	ConfigRepositories []ConfigRepository         `xml:"config-repos>config-repo"`
	PipelineGroups     []ConfigPipelineGroup      `xml:"pipelines"`
}

ConfigXML part of cruise-control.xml. @TODO better documentation

type Configuration

type Configuration struct {
	Server       string
	Username     string `yaml:"username,omitempty"`
	Password     string `yaml:"password,omitempty"`
	SkipSslCheck bool   `yaml:"skip_ssl_check,omitempty" survey:"skip_ssl_check"`
}

Configuration object used to initialise a gocd lib client to interact with the GoCD server.

func (*Configuration) Client

func (c *Configuration) Client() *Client

Client returns a client which allows us to interact with the GoCD Server.

func (*Configuration) HasAuth

func (c *Configuration) HasAuth() bool

HasAuth checks whether or not we have the required Username/Password variables provided.

type ConfigurationService

type ConfigurationService service

ConfigurationService describes the HAL _link resource for the api response object for a pipelineconfig

func (*ConfigurationService) Get

Get will retrieve all agents, their status, and metadata from the GoCD Server. Get returns a list of pipeline instanves describing the pipeline history.

func (*ConfigurationService) GetVersion

func (cs *ConfigurationService) GetVersion(ctx context.Context) (*Version, *APIResponse, error)

GetVersion will return version information about the GoCD server.

type EmbeddedEnvironments

type EmbeddedEnvironments struct {
	Environments []*Environment `json:"environments"`
}

EmbeddedEnvironments encapsulates the environment struct

type EncryptionService

type EncryptionService service

EncryptionService describes the HAL _link resource for the api response object for a pipelineconfig

func (*EncryptionService) Encrypt

func (es *EncryptionService) Encrypt(ctx context.Context, plaintext string) (*CipherText, *APIResponse, error)

Encrypt takes a plaintext value and returns a cipher text.

type Environment

type Environment struct {
	Links                *HALLinks              `json:"_links,omitempty"`
	Name                 string                 `json:"name"`
	Pipelines            []*Pipeline            `json:"pipelines,omitempty"`
	Agents               []*Agent               `json:"agents,omitempty"`
	EnvironmentVariables []*EnvironmentVariable `json:"environment_variables,omitempty"`
	Version              string                 `json:"version"`
}

Environment describes a group of pipelines and agents

func (env *Environment) GetLinks() *HALLinks

GetLinks from the Environment

func (*Environment) GetVersion

func (env *Environment) GetVersion() (version string)

GetVersion retrieves a version string for this pipeline

func (env *Environment) RemoveLinks()

RemoveLinks gets the Environment ready to be submitted to the GoCD API.

func (*Environment) SetVersion

func (env *Environment) SetVersion(version string)

SetVersion sets a version string for this pipeline

type EnvironmentPatchRequest

type EnvironmentPatchRequest struct {
	Pipelines            *PatchStringAction          `json:"pipelines"`
	Agents               *PatchStringAction          `json:"agents"`
	EnvironmentVariables *EnvironmentVariablesAction `json:"environment_variables"`
}

EnvironmentPatchRequest describes the actions to perform on an environment

type EnvironmentVariable

type EnvironmentVariable struct {
	Name           string `json:"name"`
	Value          string `json:"value,omitempty"`
	EncryptedValue string `json:"encrypted_value,omitempty"`
	Secure         bool   `json:"secure"`
}

EnvironmentVariable describes an environment variable key/pair.

type EnvironmentVariablesAction

type EnvironmentVariablesAction struct {
	Add    []*EnvironmentVariable `json:"add"`
	Remove []*EnvironmentVariable `json:"remove"`
}

EnvironmentVariablesAction describes a collection of Environment Variables to add or remove.

type EnvironmentsResponse

type EnvironmentsResponse struct {
	Links    *HALLinks             `json:"_links"`
	Embedded *EmbeddedEnvironments `json:"_embedded"`
}

EnvironmentsResponse describes the response obejct for a plugin API call.

func (er *EnvironmentsResponse) GetLinks() *HALLinks

GetLinks from the EnvironmentResponse

func (er *EnvironmentsResponse) RemoveLinks()

RemoveLinks gets the EnvironmentsResponse ready to be submitted to the GoCD API.

type EnvironmentsService

type EnvironmentsService service

EnvironmentsService exposes calls for interacting with Environment objects in the GoCD API.

func (*EnvironmentsService) Create

Create an environment

func (*EnvironmentsService) Delete

func (es *EnvironmentsService) Delete(ctx context.Context, name string) (string, *APIResponse, error)

Delete an environment

func (*EnvironmentsService) Get

Get a single environment by name

func (*EnvironmentsService) List

List all environments

func (*EnvironmentsService) Patch

Patch an environments configuration by adding or removing pipelines, agents, environment variables

type GitRepositoryMaterial

type GitRepositoryMaterial struct {
	URL     string         `xml:"url,attr"`
	Filters []ConfigFilter `xml:"filter>ignore,omitempty"`
}

GitRepositoryMaterial part of cruise-control.xml. @TODO better documentation

type HALContainer

type HALContainer interface {
	RemoveLinks()
	GetLinks() *HALLinks
}

HALContainer represents objects with HAL _link and _embedded resources.

type HALLink struct {
	Name string
	URL  *url.URL
}

HALLink describes a HAL link

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

HALLinks describes a collection of HALLinks

func (*HALLinks) Add

func (al *HALLinks) Add(link *HALLink)

Add a link

func (HALLinks) Get

func (al HALLinks) Get(name string) *HALLink

Get a HALLink by name

func (HALLinks) GetOk

func (al HALLinks) GetOk(name string) (*HALLink, bool)

GetOk a HALLink by name, and if it doesn't exist, return false

func (HALLinks) Keys

func (al HALLinks) Keys() []string

Keys returns a string list of link names

func (HALLinks) MarshallJSON

func (al HALLinks) MarshallJSON() ([]byte, error)

MarshallJSON allows the encoding of links into JSON

func (*HALLinks) UnmarshalJSON

func (al *HALLinks) UnmarshalJSON(j []byte) (e error)

UnmarshalJSON allows the decoding of links from JSON

type Job

type Job struct {
	AgentUUID            string                 `json:"agent_uuid,omitempty"`
	Name                 string                 `json:"name"`
	JobStateTransitions  []*JobStateTransition  `json:"job_state_transitions,omitempty"`
	ScheduledDate        int                    `json:"scheduled_date,omitempty"`
	OriginalJobID        string                 `json:"original_job_id,omitempty"`
	PipelineCounter      int                    `json:"pipeline_counter,omitempty"`
	Rerun                bool                   `json:"rerun,omitempty"`
	PipelineName         string                 `json:"pipeline_name,omitempty"`
	Result               string                 `json:"result,omitempty"`
	State                string                 `json:"state,omitempty"`
	ID                   int                    `json:"id,omitempty"`
	StageCounter         string                 `json:"stage_counter,omitempty"`
	StageName            string                 `json:"stage_name,omitempty"`
	RunInstanceCount     int                    `json:"run_instance_count,omitempty"`
	Timeout              int                    `json:"timeout,omitempty"`
	EnvironmentVariables []*EnvironmentVariable `json:"environment_variables,omitempty"`
	Properties           []*JobProperty         `json:"properties,omitempty"`
	Resources            []string               `json:"resources,omitempty"`
	Tasks                []*Task                `json:"tasks,omitempty"`
	Tabs                 []*Tab                 `json:"tabs,omitempty"`
	Artifacts            []*Artifact            `json:"artifacts,omitempty"`
	ElasticProfileID     string                 `json:"elastic_profile_id,omitempty"`
}

Job describes a job object.

func (*Job) JSONString

func (j *Job) JSONString() (string, error)

JSONString returns a string of this stage as a JSON object.

func (*Job) Validate

func (j *Job) Validate() error

Validate a job structure has non-nil values on correct attributes

type JobProperty

type JobProperty struct {
	Name   string `json:"name"`
	Source string `json:"source"`
	XPath  string `json:"xpath"`
}

JobProperty describes the property for a job

type JobRunHistoryResponse

type JobRunHistoryResponse struct {
	Jobs       []*Job              `json:"jobs,omitempty"`
	Pagination *PaginationResponse `json:"pagination,omitempty"`
}

JobRunHistoryResponse describes the api response from

type JobSchedule

type JobSchedule struct {
	Name                 string               `xml:"name,attr"`
	ID                   string               `xml:"id,attr"`
	Link                 JobScheduleLink      `xml:"link"`
	BuildLocator         string               `xml:"buildLocator"`
	Resources            []string             `xml:"resources>resource"`
	EnvironmentVariables *[]JobScheduleEnvVar `xml:"environmentVariables,omitempty>variable"`
}

JobSchedule describes the event causes for a job

type JobScheduleEnvVar

type JobScheduleEnvVar struct {
	Name  string `xml:"name,attr"`
	Value string `xml:",innerxml"`
}

JobScheduleEnvVar describes the environmnet variables for a job schedule

type JobScheduleLink struct {
	Rel  string `xml:"rel,attr"`
	HRef string `xml:"href,attr"`
}

JobScheduleLink describes the HAL links for a job schedule

type JobScheduleResponse

type JobScheduleResponse struct {
	Jobs []*JobSchedule `xml:"job"`
}

JobScheduleResponse contains a collection of jobs

type JobStateTransition

type JobStateTransition struct {
	StateChangeTime int    `json:"state_change_time,omitempty"`
	ID              int    `json:"id,omitempty"`
	State           string `json:"state,omitempty"`
}

JobStateTransition describes a State Transition object in a GoCD api response

type JobsService

type JobsService service

JobsService describes the HAL _link resource for the api response object for a job

func (*JobsService) ListScheduled

func (js *JobsService) ListScheduled(ctx context.Context) ([]*JobSchedule, *APIResponse, error)

ListScheduled lists Pipeline groups

type MailHost

type MailHost struct {
	Hostname string `xml:"hostname,attr"`
	Port     int    `xml:"port,attr"`
	TLS      bool   `xml:"tls,attr"`
	From     string `xml:"from,attr"`
	Admin    string `xml:"admin,attr"`
}

MailHost part of cruise-control.xml. @TODO better documentation

type Material

type Material struct {
	Type        string             `json:"type"`
	Fingerprint string             `json:"fingerprint,omitempty"`
	Description string             `json:"description,omitempty"`
	Attributes  MaterialAttributes `json:"attributes"`
}

Material describes an artifact dependency for a pipeline object.

func (Material) Equal

func (m Material) Equal(a *Material) bool

Equal is true if the two materials are logically equivalent. Not neccesarily literally equal.

type MaterialAttributes

type MaterialAttributes struct {
	URL             string          `json:"url,omitempty"`
	Destination     string          `json:"destination,omitempty"`
	Filter          *MaterialFilter `json:"filter,omitempty"`
	InvertFilter    bool            `json:"invert_filter"`
	Name            string          `json:"name,omitempty"`
	AutoUpdate      bool            `json:"auto_update,omitempty"`
	Branch          string          `json:"branch,omitempty"`
	SubmoduleFolder string          `json:"submodule_folder,omitempty"`
	ShallowClone    bool            `json:"shallow_clone,omitempty"`
	Pipeline        string          `json:"pipeline,omitempty"`
	Stage           string          `json:"stage,omitempty"`
	Ref             string          `json:"ref"`
}

MaterialAttributes describes a material type

type MaterialFilter

type MaterialFilter struct {
	Ignore []string `json:"ignore"`
}

MaterialFilter describes which globs to ignore

type MaterialRevision

type MaterialRevision struct {
	Modifications []Modification `json:"modifications"`
	Material      struct {
		Description string `json:"description"`
		Fingerprint string `json:"fingerprint"`
		Type        string `json:"type"`
		ID          int    `json:"id"`
	} `json:"material"`
	Changed bool `json:"changed"`
}

MaterialRevision describes the uniquely identifiable version for the material which was pulled for this build

type Modification

type Modification struct {
	EmailAddress string `json:"email_address"`
	ID           int    `json:"id"`
	ModifiedTime int    `json:"modified_time"`
	UserName     string `json:"user_name"`
	Comment      string `json:"comment"`
	Revision     string `json:"revision"`
}

Modification describes the commit/revision for the material which kicked off the build.

type PaginationResponse

type PaginationResponse struct {
	Offset   int `json:"offset"`
	Total    int `json:"total"`
	PageSize int `json:"page_size"`
}

PaginationResponse is a struct used to handle paging through resposnes.

type Parameter

type Parameter struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Parameter represents a key/value

type PasswordFilePath

type PasswordFilePath struct {
	Path string `xml:"path,attr"`
}

PasswordFilePath describes the location to set of user/passwords on disk

type PatchStringAction

type PatchStringAction struct {
	Add    []string `json:"add"`
	Remove []string `json:"remove"`
}

PatchStringAction describes a collection of resources to add or remove.

type Pipeline

type Pipeline struct {
	Group                 string                 `json:"group,omitempty"`
	Links                 *HALLinks              `json:"_links,omitempty"`
	Name                  string                 `json:"name"`
	LabelTemplate         string                 `json:"label_template,omitempty"`
	EnablePipelineLocking bool                   `json:"enable_pipeline_locking,omitempty"`
	Template              string                 `json:"template,omitempty"`
	Origin                *PipelineConfigOrigin  `json:"origin,omitempty"`
	Parameters            []*Parameter           `json:"parameters,omitempty"`
	EnvironmentVariables  []*EnvironmentVariable `json:"environment_variables,omitempty"`
	Materials             []Material             `json:"materials,omitempty"`
	Label                 string                 `json:"label,omitempty"`
	Stages                []*Stage               `json:"stages,omitempty"`
	Version               string                 `json:"version,omitempty"`
}

Pipeline describes a pipeline object

func (*Pipeline) AddStage

func (p *Pipeline) AddStage(stage *Stage)

AddStage appends a stage to this pipeline

func (p *Pipeline) GetLinks() *HALLinks

GetLinks from pipeline

func (*Pipeline) GetName

func (p *Pipeline) GetName() string

GetName of the pipeline

func (*Pipeline) GetStage

func (p *Pipeline) GetStage(stageName string) *Stage

GetStage from the pipeline template

func (*Pipeline) GetStages

func (p *Pipeline) GetStages() []*Stage

GetStages from the pipeline

func (*Pipeline) GetVersion

func (p *Pipeline) GetVersion() (version string)

GetVersion retrieves a version string for this pipeline

func (p *Pipeline) RemoveLinks()

RemoveLinks from the pipeline object for json marshalling.

func (*Pipeline) SetStage

func (p *Pipeline) SetStage(newStage *Stage)

SetStage replaces a stage if it already exists

func (*Pipeline) SetStages

func (p *Pipeline) SetStages(stages []*Stage)

SetStages overwrites any existing stages

func (*Pipeline) SetVersion

func (p *Pipeline) SetVersion(version string)

SetVersion sets a version string for this pipeline

type PipelineConfigOrigin

type PipelineConfigOrigin struct {
	Type string `json:"type"`
	File string `json:"file"`
}

PipelineConfigOrigin describes where a pipeline config is being loaded from

type PipelineConfigRequest

type PipelineConfigRequest struct {
	Group    string    `json:"group,omitempty"`
	Pipeline *Pipeline `json:"pipeline"`
}

PipelineConfigRequest describes a request object for creating or updating pipelines

func (*PipelineConfigRequest) GetVersion

func (pr *PipelineConfigRequest) GetVersion() (version string)

GetVersion of pipeline config

func (*PipelineConfigRequest) SetVersion

func (pr *PipelineConfigRequest) SetVersion(version string)

SetVersion of pipeline config

type PipelineConfigsService

type PipelineConfigsService service

PipelineConfigsService describes the HAL _link resource for the api response object for a pipelineconfig

func (*PipelineConfigsService) Create

func (pcs *PipelineConfigsService) Create(ctx context.Context, group string, p *Pipeline) (*Pipeline, *APIResponse, error)

Create a pipeline configuration

func (*PipelineConfigsService) Delete

func (pcs *PipelineConfigsService) Delete(ctx context.Context, name string) (string, *APIResponse, error)

Delete a pipeline configuration

func (*PipelineConfigsService) Get

Get a single PipelineTemplate object in the GoCD API.

func (*PipelineConfigsService) Update

Update a pipeline configuration

type PipelineGroup

type PipelineGroup struct {
	Name      string      `json:"name"`
	Pipelines []*Pipeline `json:"pipelines"`
}

PipelineGroup describes a pipeline group API response.

type PipelineGroups

type PipelineGroups []*PipelineGroup

PipelineGroups represents a collection of pipeline groups

func (*PipelineGroups) GetGroupByPipeline

func (pg *PipelineGroups) GetGroupByPipeline(pipeline *Pipeline) *PipelineGroup

GetGroupByPipeline finds the pipeline group for the pipeline supplied

func (*PipelineGroups) GetGroupByPipelineName

func (pg *PipelineGroups) GetGroupByPipelineName(pipelineName string) *PipelineGroup

GetGroupByPipelineName finds the pipeline group for the name of the pipeline supplied

type PipelineGroupsService

type PipelineGroupsService service

PipelineGroupsService describes the HAL _link resource for the api response object for a pipeline group response.

func (*PipelineGroupsService) List

List Pipeline groups

type PipelineHistory

type PipelineHistory struct {
	Pipelines []*PipelineInstance `json:"pipelines"`
}

PipelineHistory describes the history of runs for a pipeline

type PipelineInstance

type PipelineInstance struct {
	BuildCause   BuildCause `json:"build_cause"`
	CanRun       bool       `json:"can_run"`
	Name         string     `json:"name"`
	NaturalOrder int        `json:"natural_order"`
	Comment      string     `json:"comment"`
	Stages       []*Stage   `json:"stages"`
}

PipelineInstance describes a single pipeline run

type PipelineMaterial

type PipelineMaterial struct {
	Name         string `xml:"pipelineName,attr"`
	StageName    string `xml:"stageName,attr"`
	MaterialName string `xml:"materialName,attr"`
}

PipelineMaterial part of cruise-control.xml. @TODO better documentation

type PipelineRequest

type PipelineRequest struct {
	Group    string    `json:"group"`
	Pipeline *Pipeline `json:"pipeline"`
}

PipelineRequest describes a pipeline request object

type PipelineStatus

type PipelineStatus struct {
	Locked      bool `json:"locked"`
	Paused      bool `json:"paused"`
	Schedulable bool `json:"schedulable"`
}

PipelineStatus describes whether a pipeline can be run or scheduled.

type PipelineTemplate

type PipelineTemplate struct {
	Links    *HALLinks                 `json:"_links,omitempty"`
	Name     string                    `json:"name"`
	Embedded *embeddedPipelineTemplate `json:"_embedded,omitempty"`
	Version  string                    `json:"template_version"`
	Stages   []*Stage                  `json:"stages,omitempty"`
}

PipelineTemplate describes a response from the API for a pipeline template object.

func (*PipelineTemplate) AddStage

func (pt *PipelineTemplate) AddStage(stage *Stage)

AddStage appends a stage to this pipeline

func (PipelineTemplate) GetName

func (pt PipelineTemplate) GetName() string

GetName of the pipeline template

func (PipelineTemplate) GetStage

func (pt PipelineTemplate) GetStage(stageName string) *Stage

GetStage from the pipeline template

func (PipelineTemplate) GetStages

func (pt PipelineTemplate) GetStages() []*Stage

GetStages from the pipeline template

func (PipelineTemplate) GetVersion

func (pt PipelineTemplate) GetVersion() (version string)

GetVersion retrieves a version string for this pipeline

func (PipelineTemplate) Pipelines

func (pt PipelineTemplate) Pipelines() []*Pipeline

Pipelines returns a list of Pipelines attached to this PipelineTemplate object.

func (pt *PipelineTemplate) RemoveLinks()

RemoveLinks gets the PipelineTemplate ready to be submitted to the GoCD API.

func (*PipelineTemplate) SetStage

func (pt *PipelineTemplate) SetStage(newStage *Stage)

SetStage replaces a stage if it already exists

func (*PipelineTemplate) SetStages

func (pt *PipelineTemplate) SetStages(stages []*Stage)

SetStages overwrites any existing stages

func (*PipelineTemplate) SetVersion

func (pt *PipelineTemplate) SetVersion(version string)

SetVersion sets a version string for this pipeline

type PipelineTemplateRequest

type PipelineTemplateRequest struct {
	Name    string   `json:"name"`
	Stages  []*Stage `json:"stages"`
	Version string   `json:"version"`
}

PipelineTemplateRequest describes a PipelineTemplate

func (PipelineTemplateRequest) GetVersion

func (pt PipelineTemplateRequest) GetVersion() (version string)

GetVersion retrieves a version string for this pipeline

func (*PipelineTemplateRequest) SetVersion

func (pt *PipelineTemplateRequest) SetVersion(version string)

SetVersion sets a version string for this pipeline

type PipelineTemplateResponse

type PipelineTemplateResponse struct {
	Name     string `json:"name"`
	Embedded *struct {
		Pipelines []*struct {
			Name string `json:"name"`
		}
	} `json:"_embedded,omitempty"`
}

PipelineTemplateResponse describes an api response for a single pipeline templates

type PipelineTemplatesResponse

type PipelineTemplatesResponse struct {
	Links    *HALLinks `json:"_links,omitempty"`
	Embedded *struct {
		Templates []*PipelineTemplate `json:"templates"`
	} `json:"_embedded,omitempty"`
}

PipelineTemplatesResponse describes an api response for multiple pipeline templates

type PipelineTemplatesService

type PipelineTemplatesService service

PipelineTemplatesService describes the HAL _link resource for the api response object for a pipeline configuration objects.

func (*PipelineTemplatesService) Create

Create a new PipelineTemplate object in the GoCD API.

func (*PipelineTemplatesService) Delete

Delete a PipelineTemplate from the GoCD API.

func (*PipelineTemplatesService) Get

Get a single PipelineTemplate object in the GoCD API.

func (*PipelineTemplatesService) List

List all PipelineTemplate objects in the GoCD API.

func (*PipelineTemplatesService) Update

Update an PipelineTemplate object in the GoCD API.

type PipelinesService

type PipelinesService service

PipelinesService describes the HAL _link resource for the api response object for a pipelineconfig

func (*PipelinesService) GetHistory

func (pgs *PipelinesService) GetHistory(ctx context.Context, name string, offset int) (*PipelineHistory, *APIResponse, error)

GetHistory returns a list of pipeline instances describing the pipeline history.

func (*PipelinesService) GetInstance

func (pgs *PipelinesService) GetInstance(ctx context.Context, name string, offset int) (*PipelineInstance, *APIResponse, error)

GetInstance of a pipeline run.

func (*PipelinesService) GetStatus

func (pgs *PipelinesService) GetStatus(ctx context.Context, name string, offset int) (*PipelineStatus, *APIResponse, error)

GetStatus returns a list of pipeline instanves describing the pipeline history.

func (*PipelinesService) Pause

func (pgs *PipelinesService) Pause(ctx context.Context, name string) (bool, *APIResponse, error)

Pause allows a pipeline to handle new build events

func (*PipelinesService) ReleaseLock

func (pgs *PipelinesService) ReleaseLock(ctx context.Context, name string) (bool, *APIResponse, error)

ReleaseLock frees a pipeline to handle new build events

func (*PipelinesService) Unpause

func (pgs *PipelinesService) Unpause(ctx context.Context, name string) (bool, *APIResponse, error)

Unpause allows a pipeline to handle new build events

type PluggableInstanceSettings

type PluggableInstanceSettings struct {
	Configurations []PluginConfiguration `json:"configurations"`
	View           PluginView            `json:"view"`
}

PluggableInstanceSettings describes plugin configuration

type Plugin

type Plugin struct {
	Links                     *HALLinks                 `json:"_links"`
	ID                        string                    `json:"id"`
	Name                      string                    `json:"name"`
	DisplayName               string                    `json:"display_name"`
	Version                   string                    `json:"version"`
	Type                      string                    `json:"type"`
	PluggableInstanceSettings PluggableInstanceSettings `json:"pluggable_instance_settings"`
}

Plugin describes a single plugin resource.

type PluginConfiguration

type PluginConfiguration struct {
	Key      string                      `json:"key"`
	Metadata PluginConfigurationMetadata `json:"metadata"`
}

PluginConfiguration describes how to reference a plugin.

type PluginConfigurationKVPair

type PluginConfigurationKVPair struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

PluginConfigurationKVPair describes a key/value pair of plugin configurations.

type PluginConfigurationMetadata

type PluginConfigurationMetadata struct {
	Secure         bool `json:"secure"`
	Required       bool `json:"required"`
	PartOfIdentity bool `json:"part_of_identity"`
}

PluginConfigurationMetadata describes the schema for a single configuration option for a plugin

type PluginView

type PluginView struct {
	Template string `json:"template"`
}

PluginView describes any view attached to a plugin.

type PluginsResponse

type PluginsResponse struct {
	Links    *HALLinks `json:"_links"`
	Embedded struct {
		PluginInfo []*Plugin `json:"plugin_info"`
	} `json:"_embedded"`
}

PluginsResponse describes the response obejct for a plugin API call.

type PluginsService

type PluginsService service

PluginsService exposes calls for interacting with Plugin objects in the GoCD API.

func (*PluginsService) Get

func (ps *PluginsService) Get(ctx context.Context, name string) (*Plugin, *APIResponse, error)

Get retrieves information about a specific plugin.

func (*PluginsService) List

List retrieves all plugins

type Properties

type Properties struct {
	UnmarshallWithHeader bool
	IsDatum              bool
	Header               []string
	DataFrame            [][]string
}

Properties describes a properties resource in the GoCD API.

func NewPropertiesFrame

func NewPropertiesFrame(frame [][]string) *Properties

NewPropertiesFrame generate a new data frame for properties on a gocd job.

func (*Properties) AddRow

func (pr *Properties) AddRow(r []string)

AddRow to an existing properties data frame

func (Properties) Get

func (pr Properties) Get(row int, column string) string

Get a single parameter value for a given run of the job.

func (*Properties) MarshalJSON

func (pr *Properties) MarshalJSON() ([]byte, error)

MarshalJSON converts the properties structure to a list of maps

func (Properties) MarshallCSV

func (pr Properties) MarshallCSV() (string, error)

MarshallCSV returns the data frame as a string

func (*Properties) SetRow

func (pr *Properties) SetRow(row int, r []string)

SetRow in an existing data frame

func (*Properties) UnmarshallCSV

func (pr *Properties) UnmarshallCSV(raw string) error

UnmarshallCSV returns the data frame from a string

func (*Properties) Write

func (pr *Properties) Write(p []byte) (n int, err error)

Write the data frame to a byte stream as a csv.

type PropertiesService

type PropertiesService service

PropertiesService describes Actions which can be performed on agents

func (*PropertiesService) Create

func (ps *PropertiesService) Create(ctx context.Context, name string, value string, pr *PropertyRequest) (bool, *APIResponse, error)

Create a specific property for the given job/pipeline/stage run.

func (*PropertiesService) Get

Get a specific property for the given job/pipeline/stage run.

func (*PropertiesService) List

List the properties for the given job/pipeline/stage run.

func (*PropertiesService) ListHistorical

func (ps *PropertiesService) ListHistorical(ctx context.Context, pr *PropertyRequest) (*Properties, *APIResponse, error)

ListHistorical properties for a given pipeline, stage, job.

type PropertyCreateResponse

type PropertyCreateResponse struct {
	Name  string
	Value string
}

PropertyCreateResponse handles the parsing of the response when creating a property

type PropertyRequest

type PropertyRequest struct {
	Pipeline        string
	PipelineCounter int
	Stage           string
	StageCounter    int
	Job             string
	LimitPipeline   string
	Limit           int
	Single          bool
}

PropertyRequest describes the parameters to be submitted when calling/creating properties.

type Stage

type Stage struct {
	Name                  string                 `json:"name"`
	FetchMaterials        bool                   `json:"fetch_materials"`
	CleanWorkingDirectory bool                   `json:"clean_working_directory"`
	NeverCleanupArtifacts bool                   `json:"never_cleanup_artifacts"`
	Approval              *Approval              `json:"approval,omitempty"`
	EnvironmentVariables  []*EnvironmentVariable `json:"environment_variables,omitempty"`
	Resources             []string               `json:"resource,omitempty"`
	Jobs                  []*Job                 `json:"jobs,omitempty"`
}

Stage represents a GoCD Stage object.

func (*Stage) Clean

func (s *Stage) Clean()

Clean the approvel step.

func (*Stage) JSONString

func (s *Stage) JSONString() (string, error)

JSONString returns a string of this stage as a JSON object.

func (*Stage) Validate

func (s *Stage) Validate() error

Validate ensures the attributes attached to this structure are ready for submission to the GoCD API.

type StageContainer

type StageContainer interface {
	GetName() string
	SetStage(stage *Stage)
	GetStage(string) *Stage
	SetStages(stages []*Stage)
	GetStages() []*Stage
	AddStage(stage *Stage)
	Versioned
}

StageContainer describes structs which contain stages, eg Pipelines and PipelineTemplates

type StagesService

type StagesService service

StagesService exposes calls for interacting with Stage objects in the GoCD API.

type StringResponse

type StringResponse struct {
	Message string `json:"message"`
}

StringResponse handles the unmarshaling of the single string response from DELETE requests.

type Tab

type Tab struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

Tab description in a gocd job

type Task

type Task struct {
	Type       string         `json:"type"`
	Attributes TaskAttributes `json:"attributes"`
}

Task Describes a Task object in the GoCD api.

func (*Task) Validate

func (t *Task) Validate() error

Validate each of the possible task types.

type TaskAttributes

type TaskAttributes struct {
	RunIf               []string                    `json:"run_if,omitempty"`
	Command             string                      `json:"command,omitempty"`
	WorkingDirectory    string                      `json:"working_directory,omitempty"`
	Arguments           []string                    `json:"arguments,omitempty"`
	BuildFile           string                      `json:"build_file,omitempty"`
	Target              string                      `json:"target,omitempty"`
	NantPath            string                      `json:"nant_path,omitempty"`
	Pipeline            string                      `json:"pipeline,omitempty"`
	Stage               string                      `json:"stage,omitempty"`
	Job                 string                      `json:"job,omitempty"`
	Source              string                      `json:"source,omitempty"`
	IsSourceAFile       bool                        `json:"is_source_a_file,omitempty"`
	Destination         string                      `json:"destination,omitempty"`
	PluginConfiguration *TaskPluginConfiguration    `json:"plugin_configuration,omitempty"`
	Configuration       []PluginConfigurationKVPair `json:"configuration,omitempty"`
}

TaskAttributes describes all the properties for a Task.

func (*TaskAttributes) ValidateAnt

func (t *TaskAttributes) ValidateAnt() error

ValidateAnt checks that the specified values for the Task struct are correct for a an Ant task

func (*TaskAttributes) ValidateExec

func (t *TaskAttributes) ValidateExec() error

ValidateExec checks that the specified values for the Task struct are correct for a cli exec task

type TaskPluginConfiguration

type TaskPluginConfiguration struct {
	ID      string `json:"id"`
	Version string `json:"version"`
}

TaskPluginConfiguration is for specifying options for pluggable task

type Version

type Version struct {
	Links       *HALLinks `json:"_links"`
	Version     string    `json:"version"`
	BuildNumber string    `json:"build_number"`
	GitSHA      string    `json:"git_sha"`
	FullVersion string    `json:"full_version"`
	CommitURL   string    `json:"commit_url"`
}

Version part of cruise-control.xml. @TODO better documentation

type Versioned

type Versioned interface {
	GetVersion() string
	SetVersion(version string)
}

Versioned describes resources which can get and set versions

Jump to

Keyboard shortcuts

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