teamcity

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//StepExecuteModeDefault executes the step only if all previous steps finished successfully.
	StepExecuteModeDefault = "default"
	//StepExecuteModeOnlyIfBuildIsSuccessful executes the step only if the whole build is successful.
	StepExecuteModeOnlyIfBuildIsSuccessful = "execute_if_success"
	//StepExecuteModeEvenWhenFailed executes the step even if previous steps failed.
	StepExecuteModeEvenWhenFailed = "execute_if_failed"
	//StepExecuteAlways executes even if build stop command was issued.
	StepExecuteAlways = "execute_always"
)
View Source
const (
	//BuildTriggerVcs trigger type
	BuildTriggerVcs triggerType = "vcsTrigger"
	//BuildTriggerBuildFinish build trigger type
	BuildTriggerBuildFinish triggerType = "buildDependencyTrigger"
	//BuildTriggerSchedule build trigger tyope
	BuildTriggerSchedule triggerType = "schedulingTrigger"
)
View Source
const DefaultBuildConfigurationType = "REGULAR"

DefaultBuildConfigurationType is default build configuration type setting for build configurations. Other possible values for this setting would be "DEPLOYMENT" or "COMPOSITE"

View Source
const DefaultBuildNumberFormat = "%build.counter%"

DefaultBuildNumberFormat is TC's default build number format setting for build configurations

View Source
const (
	//Git vcs type
	Git vcsName = "jetbrains.git"
)

Variables

View Source
var ConditionStrings = []string{
	"exists",
	"equals",
	"does-not-equal",
	"more-than",
	"no-more-than",
	"less-than",
	"no-less-than",
	"starts-with",
	"contains",
	"does-not-contain",
	"ends-with",
	"matches",
	"does-not-match",
	"ver-more-than",
	"ver-no-more-than",
	"ver-less-than",
	"ver-no-less-than",
}

ConditionStrings - All possible condition strings. Do not change the values.

View Source
var Conditions = struct {
	Exists            string
	Equals            string
	DoesNotEqual      string
	MoreThan          string
	NoMoreThan        string
	LessThan          string
	NoLessThan        string
	StartsWith        string
	Contains          string
	DoesNotContain    string
	EndsWith          string
	Matches           string
	DoesNotMatch      string
	VersionMoreThan   string
	VersionNoMoreThan string
	VersionLessThan   string
	VersionNoLessThan string
}{
	Exists:            ConditionStrings[0],
	Equals:            ConditionStrings[1],
	DoesNotEqual:      ConditionStrings[2],
	MoreThan:          ConditionStrings[3],
	NoMoreThan:        ConditionStrings[4],
	LessThan:          ConditionStrings[5],
	NoLessThan:        ConditionStrings[6],
	StartsWith:        ConditionStrings[7],
	Contains:          ConditionStrings[8],
	DoesNotContain:    ConditionStrings[9],
	EndsWith:          ConditionStrings[10],
	Matches:           ConditionStrings[11],
	DoesNotMatch:      ConditionStrings[12],
	VersionMoreThan:   ConditionStrings[13],
	VersionNoMoreThan: ConditionStrings[14],
	VersionLessThan:   ConditionStrings[15],
	VersionNoLessThan: ConditionStrings[16],
}

Conditions - Possible conditions for requirements. Do not change the values.

View Source
var DebugRequests = false

DebugRequests toggle to enable tracing requests to stdout

View Source
var DebugResponses = false

DebugResponses toggle to enable tracing responses to stdout

View Source
var DefaultSnapshotDependencyOptions = &SnapshotDependencyOptions{
	OnFailedDependency:                  "RUN_ADD_PROBLEM",
	OnFailedToStartOrCanceledDependency: "MAKE_FAILED_TO_START",
	RunSameAgent:                        false,
	TakeSuccessfulBuildsOnly:            true,
	DoNotRunNewBuildIfThereIsASuitable:  true,
}

DefaultSnapshotDependencyOptions are the same options presented by default on Teamcity UI. Do not change this.

View Source
var ParameterTypes = struct {
	Configuration       paramType
	System              paramType
	EnvironmentVariable paramType
}{
	Configuration:       configParamType,
	System:              systemParamType,
	EnvironmentVariable: envVarParamType,
}

ParameterTypes represent the possible parameter types

View Source
var TriggerTypes = struct {
	Vcs         triggerType
	BuildFinish triggerType
	Schedule    triggerType
}{
	Vcs:         BuildTriggerVcs,
	BuildFinish: BuildTriggerBuildFinish,
	Schedule:    BuildTriggerSchedule,
}

TriggerTypes represents possible types for build triggers

View Source
var VcsNames = struct {
	Git vcsName
}{
	Git: Git,
}

VcsNames represents possible vcsNames for VCS Roots

Functions

func NewBool

func NewBool(b bool) *bool

NewBool is a helper function to return a *bool to the specified value

func NewFalse

func NewFalse() *bool

NewFalse is a helper function to return a *bool to true

func NewTrue

func NewTrue() *bool

NewTrue is a helper function to return a *bool to true

Types

type AgentRequirement

type AgentRequirement struct {
	// build type id
	BuildTypeID string `json:"-"`

	// id
	ID string `json:"id,omitempty" xml:"id"`

	// inherited
	Inherited *bool `json:"inherited,omitempty" xml:"inherited"`

	// inherited
	Disabled *bool `json:"disabled,omitempty" xml:"disabled"`

	// type
	Condition string `json:"type,omitempty"`

	// Do not use this directly, build this struct via NewAgentRequirement
	Properties *Properties `json:"properties,omitempty"`
}

AgentRequirement is a condition evaluated per agent to see if a build type is compatible or not

func NewAgentRequirement

func NewAgentRequirement(condition string, paramName string, paramValue string) (*AgentRequirement, error)

NewAgentRequirement creates AgentRequirement structure with correct representation. Use this instead of creating the struct manually.

func (*AgentRequirement) Name

func (a *AgentRequirement) Name() string

Name - Getter for "property-name" field of the requirement

func (*AgentRequirement) Value

func (a *AgentRequirement) Value() string

Value - Getter for "property-value" field of the requirement

type AgentRequirementService

type AgentRequirementService struct {
	BuildTypeID string
	// contains filtered or unexported fields
}

AgentRequirementService provides operations for managing agent requirements for a build type

func (*AgentRequirementService) Create

Create a new agent requirement for build type

func (*AgentRequirementService) Delete

func (s *AgentRequirementService) Delete(id string) error

Delete removes an agent requirement from the build configuration by its id

func (*AgentRequirementService) GetAll

GetAll returns all agent requirements for a given build configuration

func (*AgentRequirementService) GetByID

GetByID returns an agent requirement by its id

type ArtifactDependency

type ArtifactDependency struct {
	SourceBuildTypeID string

	Options *ArtifactDependencyOptions
	// contains filtered or unexported fields
}

ArtifactDependency represents a single artifact dependency for a build type

func NewArtifactDependency

func NewArtifactDependency(sourceBuildTypeID string, opt *ArtifactDependencyOptions) (*ArtifactDependency, error)

NewArtifactDependency creates a ArtifactDependency with specified options

func (*ArtifactDependency) BuildTypeID

func (s *ArtifactDependency) BuildTypeID() string

BuildTypeID gets the build type identifier

func (*ArtifactDependency) Disabled

func (s *ArtifactDependency) Disabled() bool

Disabled gets the disabled status for this dependency

func (*ArtifactDependency) ID

func (s *ArtifactDependency) ID() string

ID for this entity

func (*ArtifactDependency) MarshalJSON

func (s *ArtifactDependency) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON serialization for ArtifactDependency

func (*ArtifactDependency) SetBuildTypeID

func (s *ArtifactDependency) SetBuildTypeID(id string)

SetBuildTypeID sets the build type identifier

func (*ArtifactDependency) SetDisabled

func (s *ArtifactDependency) SetDisabled(disabled bool)

SetDisabled controls whether this dependency is disabled or not

func (*ArtifactDependency) Type

func (s *ArtifactDependency) Type() string

Type for this entity

func (*ArtifactDependency) UnmarshalJSON

func (s *ArtifactDependency) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON deserialization for ArtifactDependency

type ArtifactDependencyOptions

type ArtifactDependencyOptions struct {
	//ArtifactRevisionType maps to the TeamCity UI's "Get artifacts from", indicating which build should be used as artifact source.
	ArtifactRevisionType ArtifactDependencyRevision `prop:"revisionName"`

	//PathRules is a list of rules to match files that will have to be dowloaded from the source build that output artifacts.
	PathRules []string `prop:"pathRules"`

	//CleanDestination
	CleanDestination bool `prop:"cleanDestinationDirectory"`

	//RevisionNumber is used in conjunction with `BuildWithSpecifiedNumber` (as the build number value) or `LastBuildFinishedWithTag` (as the tag value to look for)
	RevisionNumber string
}

ArtifactDependencyOptions represents options when creating an artifact dependency for a build configuration. For more information see: https://confluence.jetbrains.com/display/TCD10/Artifact+Dependencies

func NewArtifactDependencyOptions

func NewArtifactDependencyOptions(pathRules []string, revisionType ArtifactDependencyRevision, cleanDestination bool, revisionValue string) (*ArtifactDependencyOptions, error)

NewArtifactDependencyOptions creates an instance of ArtifactDependencyOptions with default values.

(required) pathRules - list of rules to match files that will have to be dowloaded from the source build that output artifacts. They can be specified in the format [+:|-:]SourcePath[!ArchivePath][=>DestinationPath]

(required) revisionType - Which kind of revision type the artifact dependency will be based upon. See ArtifactDependencyRevision enum for options.

(optional) revisionValue - Required if using `BuildWithSpecifiedNumber` or `LastBuildFinishedWithTag`

type ArtifactDependencyRevision

type ArtifactDependencyRevision string

ArtifactDependencyRevision has some allowed values listed per constants.

const (
	// LatestSuccessfulBuild grabs the artifacts produced by the last sucessful build for the source build configuration.
	LatestSuccessfulBuild ArtifactDependencyRevision = "lastSuccessful"

	// LatestPinnedBuild grabs the artifacts produced by the last pinned build for the source build configuration.
	LatestPinnedBuild ArtifactDependencyRevision = "lastPinned"

	// LatestFinishedBuild grabs the artifacts produced by the last finished build, sucessful or not, for the source build configuration.
	LatestFinishedBuild ArtifactDependencyRevision = "lastFinished"

	// BuildFromSameChain grabs the artifacts produced by the source build triggered within the same build chain.
	BuildFromSameChain ArtifactDependencyRevision = "sameChainOrLastFinished"

	// BuildWithSpecifiedNumber grabs the artifacts produced by the source build that has a specific build number.
	BuildWithSpecifiedNumber ArtifactDependencyRevision = "buildNumber"

	// LastBuildFinishedWithTag grabs the artifacts produced by the source build that have a specific VCS tag
	LastBuildFinishedWithTag ArtifactDependencyRevision = "buildTag"
)

type BuildFeature

type BuildFeature interface {
	ID() string
	SetID(value string)
	Type() string
	VcsRootID() string
	SetVcsRootID(value string)
	Properties() *Properties
	BuildTypeID() string
	SetBuildTypeID(value string)
	Disabled() bool
	SetDisabled(value bool)
	MarshalJSON() ([]byte, error)
	UnmarshalJSON(data []byte) error
}

BuildFeature is an interface representing different types of build features that can be added to a build type.

type BuildFeatureService

type BuildFeatureService struct {
	BuildTypeID string
	// contains filtered or unexported fields
}

BuildFeatureService provides operations for managing build features for a buildType

func (*BuildFeatureService) Create

Create adds a new build feature to build type

func (*BuildFeatureService) Delete

func (s *BuildFeatureService) Delete(id string) error

Delete removes a build feature from the build configuration by its id.

func (*BuildFeatureService) GetByID

func (s *BuildFeatureService) GetByID(id string) (BuildFeature, error)

GetByID returns a build feature by its id

type BuildStepType

type BuildStepType = string

BuildStepType represents most common step types for build steps

const (
	//StepTypePowershell step type
	StepTypePowershell BuildStepType = "jetbrains_powershell"
	//StepTypeDotnetCli step type
	StepTypeDotnetCli BuildStepType = "dotnet.cli"
	//StepTypeCommandLine (shell/cmd) step type
	StepTypeCommandLine BuildStepType = "simpleRunner"
)

type BuildType

type BuildType struct {
	ProjectID   string
	ID          string
	Name        string
	Description string
	Options     *BuildTypeOptions
	Disabled    bool

	VcsRootEntries []*VcsRootEntry
	Parameters     *Parameters
	// contains filtered or unexported fields
}

BuildType represents a build configuration or a build configuration template

func NewBuildType

func NewBuildType(projectID string, name string) (*BuildType, error)

NewBuildType returns a build configuration with default options

func (*BuildType) MarshalJSON

func (b *BuildType) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON serialization for BuildType

func (*BuildType) Reference

func (b *BuildType) Reference() *BuildTypeReference

Reference converts a BuildType entity to a BuildType reference

func (*BuildType) UnmarshalJSON

func (b *BuildType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON deserialization for TriggerSchedule

type BuildTypeOptions

type BuildTypeOptions struct {
	AllowPersonalBuildTriggering bool     `prop:"allowPersonalBuildTriggering"`
	ArtifactRules                []string `prop:"artifactRules" separator:"\n"`
	EnableHangingBuildsDetection bool     `prop:"enableHangingBuildsDetection" force:""`
	EnableStatusWidget           bool     `prop:"allowExternalStatus"`
	BuildCounter                 int      `prop:"buildNumberCounter"`
	BuildNumberFormat            string   `prop:"buildNumberPattern"`
	BuildConfigurationType       string   `prop:"buildConfigurationType"`
	MaxSimultaneousBuilds        int      `prop:"maximumNumberOfBuilds"`

	BuildTypeID int
}

BuildTypeOptions represents settings for a Build Configuration

func NewBuildTypeOptionsWithDefaults

func NewBuildTypeOptionsWithDefaults() *BuildTypeOptions

NewBuildTypeOptionsWithDefaults returns a new instance of default settings, the same as presented in the TeamCity UI when a new build configuration is created.

type BuildTypeReference

type BuildTypeReference struct {

	// id
	ID string `json:"id,omitempty" xml:"id"`

	// name
	Name string `json:"name,omitempty" xml:"name"`

	// project Id
	ProjectID string `json:"projectId,omitempty" xml:"projectId"`
}

BuildTypeReference represents a subset detail of a Build Type

type BuildTypeService

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

BuildTypeService has operations for handling build configurations and templates

func (*BuildTypeService) AddStep

func (s *BuildTypeService) AddStep(id string, step Step) (Step, error)

AddStep creates a new build step for the build configuration with given id.

func (*BuildTypeService) AttachVcsRoot

func (s *BuildTypeService) AttachVcsRoot(id string, vcsRoot *VcsRootReference) error

AttachVcsRoot adds the VcsRoot reference to this build type

func (*BuildTypeService) AttachVcsRootEntry

func (s *BuildTypeService) AttachVcsRootEntry(id string, entry *VcsRootEntry) error

AttachVcsRootEntry adds the VcsRootEntry to this build type

func (*BuildTypeService) Create

func (s *BuildTypeService) Create(projectID string, buildType *BuildType) (*BuildTypeReference, error)

Create Creates a new build type under a project

func (*BuildTypeService) Delete

func (s *BuildTypeService) Delete(id string) error

Delete a build type resource

func (*BuildTypeService) DeleteStep

func (s *BuildTypeService) DeleteStep(id string, stepID string) error

DeleteStep removes a build step from this build type by its id

func (*BuildTypeService) GetByID

func (s *BuildTypeService) GetByID(id string) (*BuildType, error)

GetByID Retrieves a build type resource by ID

func (*BuildTypeService) GetSteps

func (s *BuildTypeService) GetSteps(id string) ([]Step, error)

GetSteps return the list of steps for a Build configuration with given id.

func (*BuildTypeService) Update

func (s *BuildTypeService) Update(buildType *BuildType) (*BuildType, error)

Update changes the resource in-place for this build configuration. TeamCity API does not support "PUT" on the whole Build Configuration resource, so the only updateable field is "Description". Other field updates will be ignored. This method also updates Settings and Parameters, but this is not an atomic operation. If an error occurs, it will be returned to caller what was updated or not.

func (*BuildTypeService) UpdateSettings

func (s *BuildTypeService) UpdateSettings(id string, settings *Properties) error

UpdateSettings will do a remote call for each setting being updated. Operation is not atomic, and the list of settings is processed in the order sent. Will return the error of the first failure and not process the rest

type Client

type Client struct {
	HTTPClient   *http.Client
	RetryTimeout time.Duration

	Projects   *ProjectService
	BuildTypes *BuildTypeService
	Server     *ServerService
	VcsRoots   *VcsRootService
	// contains filtered or unexported fields
}

Client represents the base for connecting to TeamCity

func New

func New(userName, password string, httpClient *http.Client) (*Client, error)

New creates a new client for server address specified at TEAMCITY_ADDR environment variable

func NewWithAddress

func NewWithAddress(userName, password, address string, httpClient *http.Client) (*Client, error)

NewWithAddress creates a new client by using the explicit server address from the parameter

func (*Client) AgentRequirementService

func (c *Client) AgentRequirementService(id string) *AgentRequirementService

AgentRequirementService returns a service to manage agent requirements for a build configuration with given id

func (*Client) BuildFeatureService

func (c *Client) BuildFeatureService(id string) *BuildFeatureService

BuildFeatureService returns a service to manage agent requirements for a build configuration with given id

func (*Client) DependencyService

func (c *Client) DependencyService(id string) *DependencyService

DependencyService returns a service to manage snapshot and artifact dependencies for a build configuration with given id

func (*Client) TriggerService

func (c *Client) TriggerService(buildTypeID string) *TriggerService

TriggerService returns a service to manage build triggers for a build configuration with given id

func (*Client) Validate

func (c *Client) Validate() (bool, error)

Validate tests if the client is properly configured and can be used

type Dependency

type Dependency interface {
	ID() string
	Type() string
	SetBuildTypeID(string)
	BuildTypeID() string
}

Dependency is an interface representing a Build dependency, for creating build chains

type DependencyService

type DependencyService struct {
	BuildTypeID string
	// contains filtered or unexported fields
}

DependencyService provides operations for managing dependencies for a buildType

func NewDependencyService

func NewDependencyService(buildTypeID string, c *http.Client, base *sling.Sling) *DependencyService

NewDependencyService constructs and instance of DependencyService scoped to a given buildTypeId

func (*DependencyService) AddArtifactDependency

func (s *DependencyService) AddArtifactDependency(dep *ArtifactDependency) (*ArtifactDependency, error)

AddArtifactDependency adds a new artifact dependency to build type

func (*DependencyService) AddSnapshotDependency

func (s *DependencyService) AddSnapshotDependency(dep *SnapshotDependency) (*SnapshotDependency, error)

AddSnapshotDependency adds a new snapshot dependency to build type

func (*DependencyService) DeleteArtifact

func (s *DependencyService) DeleteArtifact(depID string) error

DeleteArtifact removes an artifact dependency from the build configuration by its id

func (*DependencyService) DeleteSnapshot

func (s *DependencyService) DeleteSnapshot(depID string) error

DeleteSnapshot removes a snapshot dependency from the build configuration by its id

func (*DependencyService) GetArtifactByID

func (s *DependencyService) GetArtifactByID(depID string) (*ArtifactDependency, error)

GetArtifactByID returns an artifact dependency by its id

func (*DependencyService) GetSnapshotByID

func (s *DependencyService) GetSnapshotByID(depID string) (*SnapshotDependency, error)

GetSnapshotByID returns a snapshot dependency by its id

type FeatureCommitStatusPublisher

type FeatureCommitStatusPublisher struct {
	Options FeatureCommitStatusPublisherOptions
	// contains filtered or unexported fields
}

FeatureCommitStatusPublisher represents a commit status publisher build feature. Implements BuildFeature interface

func NewFeatureCommitStatusPublisherGithub

func NewFeatureCommitStatusPublisherGithub(opt StatusPublisherGithubOptions) (*FeatureCommitStatusPublisher, error)

NewFeatureCommitStatusPublisherGithub creates a Build Feature Commit status Publisher to Github with the given options and validates the required properties

func (*FeatureCommitStatusPublisher) BuildTypeID

func (f *FeatureCommitStatusPublisher) BuildTypeID() string

BuildTypeID is a getter for the Build Type ID associated with this build feature.

func (*FeatureCommitStatusPublisher) Disabled

func (f *FeatureCommitStatusPublisher) Disabled() bool

Disabled returns whether this build feature is disabled or not.

func (*FeatureCommitStatusPublisher) ID

ID returns the ID for this instance.

func (*FeatureCommitStatusPublisher) MarshalJSON

func (f *FeatureCommitStatusPublisher) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON serialization for FeatureCommitStatusPublisher

func (*FeatureCommitStatusPublisher) Properties

func (f *FeatureCommitStatusPublisher) Properties() *Properties

Properties returns a *Properties instance representing a serializable collection to be used.

func (*FeatureCommitStatusPublisher) SetBuildTypeID

func (f *FeatureCommitStatusPublisher) SetBuildTypeID(value string)

SetBuildTypeID is a setter for the Build Type ID associated with this build feature.

func (*FeatureCommitStatusPublisher) SetDisabled

func (f *FeatureCommitStatusPublisher) SetDisabled(value bool)

SetDisabled sets whether this build feature is disabled or not.

func (*FeatureCommitStatusPublisher) SetID

func (f *FeatureCommitStatusPublisher) SetID(value string)

SetID sets the ID for this instance.

func (*FeatureCommitStatusPublisher) SetVcsRootID

func (f *FeatureCommitStatusPublisher) SetVcsRootID(value string)

SetVcsRootID sets the ID that this build feature is associated with.

func (*FeatureCommitStatusPublisher) Type

Type returns the "commit-status-publisher", the keyed-type for this build feature instance

func (*FeatureCommitStatusPublisher) UnmarshalJSON

func (f *FeatureCommitStatusPublisher) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON deserialization for FeatureCommitStatusPublisher

func (*FeatureCommitStatusPublisher) VcsRootID

func (f *FeatureCommitStatusPublisher) VcsRootID() string

VcsRootID returns the ID that this build feature is associated with.

type FeatureCommitStatusPublisherOptions

type FeatureCommitStatusPublisherOptions interface {
	Properties() *Properties
}

FeatureCommitStatusPublisherOptions represents options needed to create a commit status publisher build feature

type Features

type Features struct {

	// count
	Count int32 `json:"count,omitempty" xml:"count"`

	// href
	Href string `json:"href,omitempty" xml:"href"`

	// property
	Items []buildFeatureJSON `json:"feature"`
}

Features is a collection of BuildFeature

type GitAgentCleanFilesPolicy

type GitAgentCleanFilesPolicy string

GitAgentCleanFilesPolicy enum specifies which files will be removed when "git clean" command is run on agent.

const (

	//CleanFilesPolicyAllUntracked will clean all untracked files
	CleanFilesPolicyAllUntracked GitAgentCleanFilesPolicy = "ALL_UNTRACKED"

	//CleanFilesPolicyIgnoredOnly will clean all ignored files
	CleanFilesPolicyIgnoredOnly GitAgentCleanFilesPolicy = "IGNORED_ONLY"

	//CleanFilesPolicyIgnoredUntracked will clean all non-ignored untracked files
	CleanFilesPolicyIgnoredUntracked GitAgentCleanFilesPolicy = "NON_IGNORED_ONLY"
)

type GitAgentCleanPolicy

type GitAgentCleanPolicy string

GitAgentCleanPolicy enum specifies when the "git clean" should be run on the agent.

const (
	//CleanPolicyBranchChange run clean whenever a branch change is detected
	CleanPolicyBranchChange GitAgentCleanPolicy = "ON_BRANCH_CHANGE"

	//CleanPolicyAlways always run 'git clean'
	CleanPolicyAlways GitAgentCleanPolicy = "ALWAYS"

	//CleanPolicyNever never run 'git clean'
	CleanPolicyNever GitAgentCleanPolicy = "NEVER"
)

type GitAgentSettings

type GitAgentSettings struct {

	//GitPath is the path to a git executable on the agent. If blank, the location set up in TEAMCITY_GIT_PATH environment variable is used.
	GitPath string `prop:"agentGitPath"`

	//CleanPolicy specifies when the "git clean" command is run on the agent. Defaults to 'CleanPolicyBranchChange'
	CleanPolicy GitAgentCleanPolicy `prop:"agentCleanPolicy"`

	//CleanFilesPolicy specifies which files will be removed when "git clean" command is run on agent.
	CleanFilesPolicy GitAgentCleanFilesPolicy `prop:"agentCleanFilesPolicy"`

	//UseMirrors when enabled, TeamCity creates a separate clone of the repository on each agent and uses it in the checkout directory via git alternates.
	UseMirrors bool `prop:"useAlternates"`
}

GitAgentSettings are agent-specific settings that are used in case of agent checkout

type GitAuthMethod

type GitAuthMethod string

GitAuthMethod enum is to specify the authentication method when connecting to Git VCS.

const (
	//GitAuthMethodAnonymous is used for anonymously connecting to Git VCS.
	GitAuthMethodAnonymous GitAuthMethod = "ANONYMOUS"

	//GitAuthMethodPassword is used for connecting using username/password to Git VCS.
	GitAuthMethodPassword GitAuthMethod = "PASSWORD"

	//GitAuthSSHUploadedKey is used for connecting using SSH with a Private Key uploaded to TeamCity
	GitAuthSSHUploadedKey GitAuthMethod = "TEAMCITY_SSH_KEY"

	//GitAuthSSHDefaultKey is used for connecting using SSH and uses mapping specified in the file /root/.ssh/config if that file exists.
	GitAuthSSHDefaultKey GitAuthMethod = "PRIVATE_KEY_DEFAULT"

	//GitAuthSSHCustomKey is used for connecting using SSH with a custom private key in the given path.
	GitAuthSSHCustomKey GitAuthMethod = "PRIVATE_KEY_FILE"
)

type GitVcsRoot

type GitVcsRoot struct {
	Options *GitVcsRootOptions

	// id
	ID string `json:"id,omitempty" xml:"id"`

	// ModificationCheckInterval value in seconds to override the global server setting.
	ModificationCheckInterval int32 `json:"modificationCheckInterval,omitempty" xml:"modificationCheckInterval"`

	// name
	Name string `json:"name,omitempty" xml:"name"`

	// project
	Project *ProjectReference `json:"project,omitempty"`
	// contains filtered or unexported fields
}

GitVcsRoot is a VCS Root of type Git, strongly-typed model.

func NewGitVcsRoot

func NewGitVcsRoot(projectID string, name string, opts *GitVcsRootOptions) (*GitVcsRoot, error)

NewGitVcsRoot returns a VCS Root instance that connects to Git VCS.

func (*GitVcsRoot) GetID

func (d *GitVcsRoot) GetID() string

GetID returns the ID of this VCS Root.

func (*GitVcsRoot) MarshalJSON

func (d *GitVcsRoot) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON serialization for GitVcsRoot

func (*GitVcsRoot) Properties

func (d *GitVcsRoot) Properties() *Properties

Properties returns the properties for this VCS Root

func (*GitVcsRoot) UnmarshalJSON

func (d *GitVcsRoot) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON deserialization for GitVcsRoot

func (*GitVcsRoot) VcsName

func (d *GitVcsRoot) VcsName() string

VcsName returns the type of VCS Root. See VcsNames

type GitVcsRootOptions

type GitVcsRootOptions struct {
	//DefaultBranch indicates which main branch or tag to be monitored by the VCS Root. Requied.
	DefaultBranch string `prop:"branch"`

	//BrancSpec are monitor besides the default one as a newline-delimited set of rules in the form of +|-:branch name (with the optional * placeholder)
	//Set separately, outside constructor.
	BranchSpec []string `prop:"teamcity:branchSpec" separator:"\\n"`

	//FetchURL is used for fetching data from the repository. Required.
	FetchURL string `prop:"url"`

	//PushURL is used for pushing tags to the remote repository. If blank, the fetch url is used.
	PushURL string `prop:"push_url"`

	//EnableTagsInBranchSpec enable/disable use tags in branch specification. Defaults to false. Set separately, outside constructor.
	EnableTagsInBranchSpec bool `prop:"reportTagRevisions"`

	//AuthMethod controls how the TeamCity server will authenticate against the VCS Git provider. Required.
	AuthMethod GitAuthMethod `prop:"authMethod"`

	//Username is used for methods other than "GitAuthMethodAnonymous". For SSH, it overrides the username used in the Fetch/Push URLs.
	Username string `prop:"username"`

	//Password represents the user password when "GitAuthMethodPassword" auth method is used.
	//Password is the key passphrase when "GitAuthSSHUploadedKey" or "GitAuthSSHCustomKey" with auth methods are used.
	Password string `prop:"secure:password"`

	//PrivateKeySource is used for "GitAuthSSHCustomKey" as the key path on disk.
	//PrivateKeySource is used for "GitAuthSSHUploadedKey" as the name of the SSH Key uploaded for the project in "SSH Keys"
	PrivateKeySource string `prop:"secure:passphrase"`

	//AgentSettings control agent-specific settings that are used in case of agent checkout
	AgentSettings *GitAgentSettings

	//SubModuleCheckout specifies whether checkout Git submodules or ignore.
	//Possible values are 'CHECKOUT' or 'IGNORE'. Defaults to 'CHECKOUT'. Set separately, outside constructor.
	SubModuleCheckout string `prop:"submoduleCheckout"`

	// UsernameStyle defines a way TeamCity binds VCS changes to the user.
	// Defaults to 'GitVcsUsernameStyleUserID'. Set separately, outside constructor.
	UsernameStyle GitVcsUsernameStyle `prop:"usernameStyle"`
}

GitVcsRootOptions represents parameters used when manipulating VCS Roots of type "Git"

func NewGitVcsRootOptions

func NewGitVcsRootOptions(defaultBranch string, fetchURL string, pushURL string, auth GitAuthMethod, username string, password string) (*GitVcsRootOptions, error)

NewGitVcsRootOptions returns a new instance of GitVcsRootOptions with default GitAgentSettings

func NewGitVcsRootOptionsDefaults

func NewGitVcsRootOptionsDefaults(defaultBranch string, fetchURL string) (*GitVcsRootOptions, error)

NewGitVcsRootOptionsDefaults returns a new instance of GitVcsRootOptions with default values Anonymous auth method Default AgentSettings

func NewGitVcsRootOptionsWithAgentSettings

func NewGitVcsRootOptionsWithAgentSettings(defaultBranch string, fetchURL string, pushURL string, auth GitAuthMethod, username string, password string, agentSettings *GitAgentSettings) (*GitVcsRootOptions, error)

NewGitVcsRootOptionsWithAgentSettings returns a new instance of GitVcsRootOptions with specified GitAgentSettings

type GitVcsUsernameStyle

type GitVcsUsernameStyle string

GitVcsUsernameStyle defines a way TeamCity binds VCS changes to the user. With selected style and the following content of ~/.gitconfig: [user] name = Joe Coder email = joe.coder@acme.com

const (
	//GitVcsUsernameStyleUserID should configure 'joe.coder' in the VCS profile for the User.
	GitVcsUsernameStyleUserID GitVcsUsernameStyle = "USERID"
	//GitVcsUsernameStyleAuthorName should configure 'Joe Coder' in the VCS profile for the User.
	GitVcsUsernameStyleAuthorName GitVcsUsernameStyle = "NAME"
	//GitVcsUsernameStyleAuthorEmail should configure 'joe.coder@acme.com' in the VCS profile for the User.
	GitVcsUsernameStyleAuthorEmail GitVcsUsernameStyle = "EMAIL"
	//GitVcsUsernameStyleAuthorNameAndEmail should configure 'Joe Coder <joe.coder@acme.com>' in the VCS profile for the User.
	GitVcsUsernameStyleAuthorNameAndEmail GitVcsUsernameStyle = "FULL"
)

type Locator

type Locator string

Locator represents a arbitraty locator to be used when querying resources, such as id: or type: These are used in GET requests within the URL so must be properly escaped

func LocatorID

func LocatorID(id string) Locator

LocatorID creates a locator for a Project by Id

func (Locator) String

func (l Locator) String() string

type Parameter

type Parameter struct {
	Inherited *bool `json:"inherited,omitempty" xml:"inherited"`

	Name string `json:"name,omitempty" xml:"name"`

	Value string `json:"value" xml:"value"`

	Type string `json:"-"`
}

Parameter represents a project or build configuration parameter that may be defined as "configuration", "system" or "environment variable"

func NewParameter

func NewParameter(t string, name string, value string) (*Parameter, error)

NewParameter creates a new instance of a parameter with the given type

func (*Parameter) MarshalJSON

func (p *Parameter) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON serialization for Parameter

func (*Parameter) Property

func (p *Parameter) Property() *Property

Property converts a Parameter instance to a Property

func (*Parameter) UnmarshalJSON

func (p *Parameter) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON deserialization for Parameter

type Parameters

type Parameters struct {
	Count int32        `json:"count,omitempty" xml:"count"`
	Href  string       `json:"href,omitempty" xml:"href"`
	Items []*Parameter `json:"property,omitempty"`
}

Parameters is a strongly-typed collection of "Parameter" suitable for serialization

func NewParameters

func NewParameters(items ...*Parameter) *Parameters

NewParameters returns an instance of Parameters collection with the given parameters slice

func NewParametersEmpty

func NewParametersEmpty() *Parameters

NewParametersEmpty returns an empty collection of Parameters

func (*Parameters) Add

func (p *Parameters) Add(param *Parameter)

Add a new parameter to this collection

func (*Parameters) AddOrReplaceParameter

func (p *Parameters) AddOrReplaceParameter(param *Parameter)

AddOrReplaceParameter will update a parameter value if another parameter with the same name exists. It won't replace the Parameter struct within the Parameters collection.

func (*Parameters) AddOrReplaceValue

func (p *Parameters) AddOrReplaceValue(t string, n string, v string)

AddOrReplaceValue will update a parameter value if it exists, or add if it doesnt

func (*Parameters) Concat

func (p *Parameters) Concat(source *Parameters) *Parameters

Concat appends the source Parameters collection to this collection and returns the appended collection

func (*Parameters) Properties

func (p *Parameters) Properties() *Properties

Properties convert a Parameters collection to a Properties collection

func (*Parameters) Remove

func (p *Parameters) Remove(t string, n string)

Remove a parameter if it exists in the collection

type Project

type Project struct {
	Archived        *bool             `json:"archived,omitempty" xml:"archived"`
	Description     string            `json:"description,omitempty" xml:"description"`
	Href            string            `json:"href,omitempty" xml:"href"`
	ID              string            `json:"id,omitempty" xml:"id"`
	Name            string            `json:"name,omitempty" xml:"name"`
	Parameters      *Parameters       `json:"parameters,omitempty"`
	ParentProject   *ProjectReference `json:"parentProject,omitempty"`
	ParentProjectID string            `json:"parentProjectId,omitempty" xml:"parentProjectId"`
	WebURL          string            `json:"webUrl,omitempty" xml:"webUrl"`
}

Project is the model for project entities in TeamCity

func NewProject

func NewProject(name string, description string, parentProjectID string) (*Project, error)

NewProject returns an instance of a Project. A non-empty name is required. Description can be an empty string and will be omitted. For creating a top-level project, pass empty to parentProjectId.

func (*Project) ProjectReference

func (p *Project) ProjectReference() *ProjectReference

ProjectReference converts a project instance to a ProjectReference

func (*Project) SetParentProject

func (p *Project) SetParentProject(parentID string)

SetParentProject changes this Project instance's parent project

type ProjectReference

type ProjectReference struct {
	ID          string `json:"id,omitempty" xml:"id"`
	Name        string `json:"name,omitempty" xml:"name"`
	Description string `json:"description,omitempty" xml:"description"`
	Href        string `json:"href,omitempty" xml:"href"`
	WebURL      string `json:"webUrl,omitempty" xml:"webUrl"`
}

ProjectReference contains basic information, usually enough to use as a type for relationships. In addition to that, TeamCity does not return the full detailed representation when creating objects, thus the need for a reference.

type ProjectService

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

ProjectService has operations for handling projects

func (*ProjectService) Create

func (s *ProjectService) Create(project *Project) (*Project, error)

Create creates a new project at root project level

func (*ProjectService) Delete

func (s *ProjectService) Delete(id string) error

Delete - Deletes a project

func (*ProjectService) GetByID

func (s *ProjectService) GetByID(id string) (*Project, error)

GetByID Retrieves a project resource by ID

func (*ProjectService) Update

func (s *ProjectService) Update(project *Project) (*Project, error)

Update changes the resource in-place for this project. TeamCity API does not support "PUT" on the whole project resource, so the only updateable field is "Description". Other field updates will be ignored. This method also updates Settings and Parameters, but this is not an atomic operation. If an error occurs, it will be returned to caller what was updated or not.

type Properties

type Properties struct {

	// count
	Count int32 `json:"count,omitempty" xml:"count"`

	// href
	Href string `json:"href,omitempty" xml:"href"`

	// property
	Items []*Property `json:"property"`
}

Properties represents a collection of key/value properties for a resource

func NewProperties

func NewProperties(items ...*Property) *Properties

NewProperties returns an instance of Properties collection

func NewPropertiesEmpty

func NewPropertiesEmpty() *Properties

NewPropertiesEmpty returns an instance of Properties collection with no properties

func (*Properties) Add

func (p *Properties) Add(prop *Property)

Add a new property to this collection

func (*Properties) AddOrReplaceProperty

func (p *Properties) AddOrReplaceProperty(prop *Property)

AddOrReplaceProperty will update a property value if another property with the same name exists. It won't replace the Property struct within the Properties collection.

func (*Properties) AddOrReplaceValue

func (p *Properties) AddOrReplaceValue(n string, v string)

AddOrReplaceValue will update a property value if it exists, or add if it doesnt

func (*Properties) Concat

func (p *Properties) Concat(source *Properties) *Properties

Concat appends the source Properties collection to this collection and returns the appended collection

func (*Properties) GetOk

func (p *Properties) GetOk(key string) (string, bool)

GetOk returns the value of the propery and true if found, otherwise ""/false

func (*Properties) Map

func (p *Properties) Map() map[string]string

Map converts Properties to a key/value dictionary as map[string]string

func (*Properties) Remove

func (p *Properties) Remove(n string)

Remove a property if it exists in the collection

type Property

type Property struct {

	// inherited
	Inherited *bool `json:"inherited,omitempty" xml:"inherited"`

	// name
	Name string `json:"name,omitempty" xml:"name"`

	// type
	Type *Type `json:"type,omitempty"`

	// value
	Value string `json:"value" xml:"value"`
}

Property represents a key/value/type structure used by several resources to extend their representation

func NewProperty

func NewProperty(name string, value string) *Property

NewProperty returns an instance of Property

func (*Property) String

func (p *Property) String() string

type PropertyAssertions

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

PropertyAssertions is a helper for tests that are defined in teamcity package. Not sure how to factor these out in a proper place.

type Server

type Server struct {

	// build date
	BuildDate string `json:"buildDate,omitempty" xml:"buildDate"`

	// build number
	BuildNumber string `json:"buildNumber,omitempty" xml:"buildNumber"`

	// current time
	CurrentTime string `json:"currentTime,omitempty" xml:"currentTime"`

	// internal Id
	InternalID string `json:"internalId,omitempty" xml:"internalId"`

	// version
	Version string `json:"version,omitempty" xml:"version"`

	// version major
	VersionMajor int32 `json:"versionMajor,omitempty" xml:"versionMajor"`

	// version minor
	VersionMinor int32 `json:"versionMinor,omitempty" xml:"versionMinor"`

	// web Url
	WebURL string `json:"webUrl,omitempty" xml:"webUrl"`
}

Server holds information about the TeamCity server

type ServerService

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

ServerService allows retrieving information about the server

func (*ServerService) Get

func (s *ServerService) Get() (*Server, error)

Get returns a struct with server information

type SnapshotDependencies

type SnapshotDependencies struct {
	// count
	Count int32 `json:"count,omitempty" xml:"count"`

	// property
	Items []*SnapshotDependency `json:"snapshot-dependency"`
}

SnapshotDependencies represents a collection of SnapshotDependency

type SnapshotDependency

type SnapshotDependency struct {

	// disabled - Read Only, no effect on post
	Disabled *bool `json:"disabled,omitempty" xml:"disabled"`

	// href
	Href string `json:"href,omitempty" xml:"href"`

	// id
	ID string `json:"id,omitempty" xml:"id"`

	// inherited
	Inherited *bool `json:"inherited,omitempty" xml:"inherited"`

	// Properties are serializable options for this snapshot dependency. Do not change this field directly, use the NewSnapshotDependency... constructors
	Properties *Properties `json:"properties,omitempty"`

	// source build type
	SourceBuildType *BuildTypeReference `json:"source-buildType,omitempty"`

	// Build type id this dependency belongs to
	BuildTypeID string `json:"-"`

	// type
	Type string `json:"type,omitempty" xml:"type"`
}

SnapshotDependency represents a single snapshot dependency for a build type

func NewSnapshotDependency

func NewSnapshotDependency(sourceBuildTypeID string) *SnapshotDependency

NewSnapshotDependency created a SnapshotDependency struct with default SnapshotDependencyOptions

func NewSnapshotDependencyWithOptions

func NewSnapshotDependencyWithOptions(sourceBuildTypeID string, opt *SnapshotDependencyOptions) *SnapshotDependency

NewSnapshotDependencyWithOptions creates a SnapshotDependency struct with the provided options

type SnapshotDependencyOptions

type SnapshotDependencyOptions struct {
	OnFailedDependency                  string
	OnFailedToStartOrCanceledDependency string
	RunSameAgent                        bool
	TakeSuccessfulBuildsOnly            bool
	DoNotRunNewBuildIfThereIsASuitable  bool
}

SnapshotDependencyOptions represents possible options for when creating a snapshot dependency

type StatusPublisherGithubOptions

type StatusPublisherGithubOptions struct {
	//AuthenticationType can be 'password' or 'token'
	AuthenticationType string
	//Host is the Github URL, for instance "https://api.github.com" or "https://hostname/api/v3/" for Github Enterprise
	Host string
	//Username is required if AuthenticationType is 'password'
	Username string
	//Password is required if AuthenticationType is 'password'
	Password string
	//AccessToken is required if AuthenticationType is 'token'
	AccessToken string
}

StatusPublisherGithubOptions represents parameters used to create Github Commit Status Publisher Feature

func CommitStatusPublisherGithubOptionsFromProperties

func CommitStatusPublisherGithubOptionsFromProperties(p *Properties) (*StatusPublisherGithubOptions, error)

CommitStatusPublisherGithubOptionsFromProperties grabs a Properties collection and transforms back to a StatusPublisherGithubOptions

func NewCommitStatusPublisherGithubOptionsPassword

func NewCommitStatusPublisherGithubOptionsPassword(host string, username string, password string) StatusPublisherGithubOptions

NewCommitStatusPublisherGithubOptionsPassword returns options created for AuthenticationType = 'password'. No validation is performed, parameters indicate mandatory fields.

func NewCommitStatusPublisherGithubOptionsToken

func NewCommitStatusPublisherGithubOptionsToken(host string, accessToken string) StatusPublisherGithubOptions

NewCommitStatusPublisherGithubOptionsToken returns options created for AuthenticationType = 'token'. No validation is performed, parameters indicate mandatory fields.

func (StatusPublisherGithubOptions) Properties

func (s StatusPublisherGithubOptions) Properties() *Properties

Properties returns a *Properties collection with properties filled related to this commit publisher parameters to be used in build features

type Step

type Step interface {
	GetID() string
	GetName() string
	Type() string
}

Step interface represents a a build configuration/template build step. To interact with concrete step types, see the Step* types.

type StepCommandLine

type StepCommandLine struct {
	ID   string
	Name string

	//CustomScript contains code for platform specific script, like .cmd on windows or shell script on Unix-like environments.
	CustomScript string
	//CommandExecutable is the executable program to be called from this step.
	CommandExecutable string
	//CommandParameters are additional parameters to be passed on to the CommandExecutable.
	CommandParameters string
	//ExecuteMode is the execute mode for the step. See StepExecuteMode for details.
	ExecuteMode StepExecuteMode
	// contains filtered or unexported fields
}

StepCommandLine represents a a build step of type "CommandLine"

func NewStepCommandLineExecutable

func NewStepCommandLineExecutable(name string, executable string, args string) (*StepCommandLine, error)

NewStepCommandLineExecutable creates a command line that invokes an external executable.

func NewStepCommandLineScript

func NewStepCommandLineScript(name string, script string) (*StepCommandLine, error)

NewStepCommandLineScript creates a command line build step that runs an inline platform-specific script.

func (*StepCommandLine) GetID

func (s *StepCommandLine) GetID() string

GetID is a wrapper implementation for ID field, to comply with Step interface

func (*StepCommandLine) GetName

func (s *StepCommandLine) GetName() string

GetName is a wrapper implementation for Name field, to comply with Step interface

func (*StepCommandLine) MarshalJSON

func (s *StepCommandLine) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON serialization for StepCommandLine

func (*StepCommandLine) Type

func (s *StepCommandLine) Type() BuildStepType

Type returns the step type, in this case "StepTypePowershell".

func (*StepCommandLine) UnmarshalJSON

func (s *StepCommandLine) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON deserialization for StepCommandLine

type StepExecuteMode

type StepExecuteMode = string

StepExecuteMode represents how a build configuration step will execute regarding others.

type StepPowershell

type StepPowershell struct {
	ID   string
	Name string

	//ScriptFile holds the name of script to run for this step.
	ScriptFile string
	//Code is the inline powershell code to be ran for this step.
	Code string
	//ScriptArgs are the arguments that will be passed when using "ScriptFile"
	ScriptArgs string
	//ExecuteMode is the execute mode for the step. See StepExecuteMode for details.
	ExecuteMode StepExecuteMode
	// contains filtered or unexported fields
}

StepPowershell represents a a build step of type "Powershell"

func NewStepPowershellCode

func NewStepPowershellCode(name string, code string) (*StepPowershell, error)

NewStepPowershellCode creates a powershell build step that runs the inline code.

func NewStepPowershellScriptFile

func NewStepPowershellScriptFile(name string, scriptFile string, scriptArgs string) (*StepPowershell, error)

NewStepPowershellScriptFile creates a powershell build step that runs a script file instead of inline code.

func (*StepPowershell) GetID

func (s *StepPowershell) GetID() string

GetID is a wrapper implementation for ID field, to comply with Step interface

func (*StepPowershell) GetName

func (s *StepPowershell) GetName() string

GetName is a wrapper implementation for Name field, to comply with Step interface

func (*StepPowershell) MarshalJSON

func (s *StepPowershell) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON serialization for StepPowershell

func (*StepPowershell) Type

func (s *StepPowershell) Type() BuildStepType

Type returns the step type, in this case "StepTypePowershell".

func (*StepPowershell) UnmarshalJSON

func (s *StepPowershell) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON deserialization for StepPowershell

type Trigger

type Trigger interface {
	ID() string
	Type() string
	Disabled() bool
	SetBuildTypeID(buildTypeID string)
	BuildTypeID() string
}

Trigger represents a build trigger to be associated with a build configuration. Use the constructor methods to create new instances.

type TriggerBuildFinish

type TriggerBuildFinish struct {
	SourceBuildID string
	Options       *TriggerBuildFinishOptions
	// contains filtered or unexported fields
}

TriggerBuildFinish represents a build trigger that fires when the given build ID to is finished

func NewTriggerBuildFinish

func NewTriggerBuildFinish(sourceBuildID string, opt *TriggerBuildFinishOptions) (*TriggerBuildFinish, error)

NewTriggerBuildFinish returns a finish build trigger type with TriggerVcsOptions.

func (*TriggerBuildFinish) BuildTypeID

func (t *TriggerBuildFinish) BuildTypeID() string

BuildTypeID gets the build type identifier

func (*TriggerBuildFinish) Disabled

func (t *TriggerBuildFinish) Disabled() bool

Disabled gets the disabled status for this trigger

func (*TriggerBuildFinish) ID

func (t *TriggerBuildFinish) ID() string

ID for this entity

func (*TriggerBuildFinish) MarshalJSON

func (t *TriggerBuildFinish) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON serialization for TriggerVcs

func (*TriggerBuildFinish) SetBuildTypeID

func (t *TriggerBuildFinish) SetBuildTypeID(id string)

SetBuildTypeID sets the build type identifier

func (*TriggerBuildFinish) SetDisabled

func (t *TriggerBuildFinish) SetDisabled(disabled bool)

SetDisabled controls whether this trigger is disabled or not

func (*TriggerBuildFinish) Type

func (t *TriggerBuildFinish) Type() string

Type returns TriggerTypes.BuildFinish ("buildDependencyTrigger")

func (*TriggerBuildFinish) UnmarshalJSON

func (t *TriggerBuildFinish) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON deserialization for TriggerBuildFinish

type TriggerBuildFinishOptions

type TriggerBuildFinishOptions struct {
	AfterSuccessfulBuildOnly bool     `prop:"afterSucessfulBuildOnly"`
	BranchFilter             []string `prop:"branchFilter" separator:"\n"`
}

TriggerBuildFinishOptions represents optional settings for a 'Finish Build' Trigger type.

func NewTriggerBuildFinishOptions

func NewTriggerBuildFinishOptions(afterSuccessfulBuildOnly bool, branchFilter []string) *TriggerBuildFinishOptions

NewTriggerBuildFinishOptions initialize a NewTriggerBuildFinishOptions branchFilter can be passed as "nil" to not filter on any specific branches

type TriggerSchedule

type TriggerSchedule struct {
	SchedulingPolicy TriggerSchedulingPolicy `prop:"schedulingPolicy"`
	Rules            []string                `prop:"triggerRules" separator:"\n"`
	Timezone         string                  `prop:"timezone"`
	Hour             uint                    `prop:"hour"`
	Minute           uint                    `prop:"minute"`
	Weekday          time.Weekday
	Options          *TriggerScheduleOptions
	// contains filtered or unexported fields
}

TriggerSchedule represents a build trigger that fires on a time-bound schedule

func NewTriggerSchedule

func NewTriggerSchedule(schedulingPolicy TriggerSchedulingPolicy, sourceBuildID string, weekday time.Weekday, hour uint, minute uint, timezone string, rules []string, opt *TriggerScheduleOptions) (*TriggerSchedule, error)

NewTriggerSchedule returns a TriggerSchedule with the scheduling policy and options specified

func NewTriggerScheduleDaily

func NewTriggerScheduleDaily(sourceBuildID string, hour uint, minute uint, timezone string, rules []string) (*TriggerSchedule, error)

NewTriggerScheduleDaily returns a TriggerSchedule that fires daily on the hour/minute specified

func NewTriggerScheduleWeekly

func NewTriggerScheduleWeekly(sourceBuildID string, weekday time.Weekday, hour uint, minute uint, timezone string, rules []string) (*TriggerSchedule, error)

NewTriggerScheduleWeekly returns a TriggerSchedule that fires weekly on the weekday and hour/minute specified

func (*TriggerSchedule) BuildTypeID

func (t *TriggerSchedule) BuildTypeID() string

BuildTypeID gets the build type identifier

func (*TriggerSchedule) Disabled

func (t *TriggerSchedule) Disabled() bool

Disabled gets the disabled status for this trigger

func (*TriggerSchedule) ID

func (t *TriggerSchedule) ID() string

ID for this entity

func (*TriggerSchedule) MarshalJSON

func (t *TriggerSchedule) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON serialization for TriggerSchedule

func (*TriggerSchedule) SetBuildTypeID

func (t *TriggerSchedule) SetBuildTypeID(id string)

SetBuildTypeID sets the build type identifier

func (*TriggerSchedule) SetDisabled

func (t *TriggerSchedule) SetDisabled(disabled bool)

SetDisabled controls whether this trigger is disabled or not

func (*TriggerSchedule) Type

func (t *TriggerSchedule) Type() string

Type returns TriggerTypes.Schedule ("schedulingTrigger")

func (*TriggerSchedule) UnmarshalJSON

func (t *TriggerSchedule) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON deserialization for TriggerSchedule

type TriggerScheduleOptions

type TriggerScheduleOptions struct {
	QueueOptimization                   bool                       `prop:"enableQueueOptimization" force:""`
	PromoteWatchedBuild                 bool                       `prop:"promoteWatchedBuild" force:""`
	BuildWithPendingChangesOnly         bool                       `prop:"triggerBuildWithPendingChangesOnly" force:""`
	TriggerIfWatchedBuildChanges        bool                       `prop:"triggerBuildIfWatchedBuildChanges"`
	BuildOnAllCompatibleAgents          bool                       `prop:"triggerBuildOnAllCompatibleAgents"`
	RevisionRuleSourceBuildID           string                     `prop:"revisionRuleDependsOn"`
	RevisionRule                        ArtifactDependencyRevision `prop:"revisionRule"`
	RevisionRuleBuildBranch             string                     `prop:"revisionRuleBuildBranch"`
	EnforceCleanCheckout                bool                       `prop:"enforceCleanCheckout"`
	EnforceCleanCheckoutForDependencies bool                       `prop:"enforceCleanCheckoutForDependencies"`
}

TriggerScheduleOptions represent options for configuring a scheduled build trigger

func NewTriggerScheduleOptions

func NewTriggerScheduleOptions() *TriggerScheduleOptions

NewTriggerScheduleOptions returns a TriggerScheduleOptions with default values

type TriggerSchedulingPolicy

type TriggerSchedulingPolicy = string

TriggerSchedulingPolicy represents the shceduling policy for a scheduled trigger. Can be 'daily', 'weekly' or 'cron'

const (
	//TriggerSchedulingDaily triggers every day
	TriggerSchedulingDaily TriggerSchedulingPolicy = "daily"
	//TriggerSchedulingWeekly triggers at specified day + time of the week, once per week
	TriggerSchedulingWeekly TriggerSchedulingPolicy = "weekly"
	//TriggerSchedulingCron triggers by matching a cron expression
	TriggerSchedulingCron TriggerSchedulingPolicy = "cron"
)

type TriggerService

type TriggerService struct {
	BuildTypeID string
	// contains filtered or unexported fields
}

TriggerService provides operations for managing build triggers for a buildType

func (*TriggerService) AddTrigger

func (s *TriggerService) AddTrigger(t Trigger) (Trigger, error)

AddTrigger adds a new build trigger to a build type

func (*TriggerService) Delete

func (s *TriggerService) Delete(id string) error

Delete removes a build trigger from the build configuration by its id

func (*TriggerService) GetByID

func (s *TriggerService) GetByID(id string) (Trigger, error)

GetByID returns a build trigger by its id

type TriggerVcs

type TriggerVcs struct {
	BranchFilter string
	Rules        string
	Options      *TriggerVcsOptions
	// contains filtered or unexported fields
}

TriggerVcs represents a build trigger on VCS changes

func NewTriggerVcs

func NewTriggerVcs(triggerRules string, branchFilter string) (*TriggerVcs, error)

NewTriggerVcs returns a VCS trigger type with the triggerRules specified. triggerRules is required, but branchFilter can be optional if the VCS root uses multiple branches.

func NewTriggerVcsWithOptions

func NewTriggerVcsWithOptions(triggerRules string, branchFilter string, opt *TriggerVcsOptions) (*TriggerVcs, error)

NewTriggerVcsWithOptions returns a VCS trigger type with TriggerVcsOptions. See also NewTriggerVcs for other parameters.

func (*TriggerVcs) BuildTypeID

func (t *TriggerVcs) BuildTypeID() string

BuildTypeID gets the build type identifier

func (*TriggerVcs) Disabled

func (t *TriggerVcs) Disabled() bool

Disabled gets the disabled status for this trigger

func (*TriggerVcs) ID

func (t *TriggerVcs) ID() string

ID for this entity

func (*TriggerVcs) MarshalJSON

func (t *TriggerVcs) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON serialization for TriggerVcs

func (*TriggerVcs) SetBuildTypeID

func (t *TriggerVcs) SetBuildTypeID(id string)

SetBuildTypeID sets the build type identifier

func (*TriggerVcs) SetDisabled

func (t *TriggerVcs) SetDisabled(disabled bool)

SetDisabled controls whether this trigger is disabled or not

func (*TriggerVcs) Type

func (t *TriggerVcs) Type() string

Type returns TriggerTypes.Vcs ("vcsTrigger")

func (*TriggerVcs) UnmarshalJSON

func (t *TriggerVcs) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON deserialization for TriggerVcs

type TriggerVcsOptions

type TriggerVcsOptions struct {
	GroupUserCheckins    bool
	QuietPeriodMode      VcsTriggerQuietPeriodMode
	QuietPeriodInSeconds int
	// contains filtered or unexported fields
}

TriggerVcsOptions represents optional settings for a VCS Trigger type.

func NewTriggerVcsOptions

func NewTriggerVcsOptions(mode VcsTriggerQuietPeriodMode, seconds int) (*TriggerVcsOptions, error)

NewTriggerVcsOptions initialize a TriggerVcsOptions instance with same defaults as TeamCity UI

Defaults:

  • GroupCheckins = false
  • EnableQueueOptimization = false

func (*TriggerVcsOptions) PerCheckinTriggering

func (o *TriggerVcsOptions) PerCheckinTriggering() bool

PerCheckinTriggering gets the value of perCheckinTriggering property

func (*TriggerVcsOptions) QueueOptimization

func (o *TriggerVcsOptions) QueueOptimization() bool

QueueOptimization gets the value of enableQueueOptimization property

func (*TriggerVcsOptions) SetPerCheckinTriggering

func (o *TriggerVcsOptions) SetPerCheckinTriggering(enable bool)

SetPerCheckinTriggering specifies if VCS Trigger will fire a different build per checkin or commit for different committers. If set to true, enableQueueOptimization will be disabled.

func (*TriggerVcsOptions) SetQueueOptimization

func (o *TriggerVcsOptions) SetQueueOptimization(enable bool)

SetQueueOptimization toggles allowing the server to replace an already started build or a more recently queued one if new changes are detected. If set to true, PerCheckinTriggering will be disabled.

type Triggers

type Triggers struct {
	// count
	Count int32 `json:"count,omitempty" xml:"count"`

	// property
	Items []*Trigger `json:"trigger"`
}

Triggers represents a typed, serializable collection of Trigger

type Type

type Type struct {
	// raw value
	RawValue string `json:"rawValue,omitempty" xml:"rawValue"`
}

Type represents a parameter type . The rawValue is the parameter specification as defined in the UI.

type VcsRoot

type VcsRoot interface {
	//GetID returns the ID of this VCS Root
	GetID() string

	//VcsName returns the type of VCS Root. See VcsNames for possible values returned.
	//In addition, this can be used to type assert to the appropriate concrete VCS Root type.
	VcsName() string

	//Properties returns the Properties collection for this VCS Root. This should be used for querying only.
	Properties() *Properties
}

VcsRoot interface represents a base type of VCSRoot

type VcsRootEntries

type VcsRootEntries struct {
	// count
	Count int32 `json:"count,omitempty" xml:"count"`

	// href
	Href string `json:"href,omitempty" xml:"href"`

	// property
	Items []*VcsRootEntry `json:"vcs-root-entry"`
}

VcsRootEntries represents a collection of VCS Roots attached to a resource

func NewVcsRootEntries

func NewVcsRootEntries(items ...*VcsRootReference) *VcsRootEntries

NewVcsRootEntries returns an instance of VcsRootEntries collection

type VcsRootEntry

type VcsRootEntry struct {
	// id
	ID string `json:"id,omitempty" xmld:"id"`

	// inherited
	Inherited *bool `json:"inherited,omitempty" xml:"inherited"`

	// checkout rules
	CheckoutRules string `json:"checkout-rules,omitempty"`

	// vcs root
	VcsRoot *VcsRootReference `json:"vcs-root,omitempty"`
}

VcsRootEntry represents a single VCS Root attached to a resource

func NewVcsRootEntry

func NewVcsRootEntry(vcsRef *VcsRootReference) *VcsRootEntry

NewVcsRootEntry is a convenience function for attaching a VcsRootReference to a Build configuration, represented as a VcsRootEntry in Teamcity API

func NewVcsRootEntryWithRules

func NewVcsRootEntryWithRules(vcsRef *VcsRootReference, checkoutRules string) *VcsRootEntry

NewVcsRootEntryWithRules is a convenience function for attaching a VcsRootReference to a Build configuration, represented as a VcsRootEntry in Teamcity API

type VcsRootReference

type VcsRootReference struct {

	// href
	Href string `json:"href,omitempty" xml:"href"`

	// id
	ID string `json:"id,omitempty" xml:"id"`

	// name
	Name string `json:"name,omitempty" xml:"name"`

	// project Id
	Project *ProjectReference `json:"project,omitempty" xml:"project"`
}

VcsRootReference represents a subset detail of a VCS Root

type VcsRootService

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

VcsRootService has operations for handling vcs roots

func (*VcsRootService) Create

func (s *VcsRootService) Create(projectID string, vcsRoot VcsRoot) (*VcsRootReference, error)

Create creates a new vcs root

func (*VcsRootService) Delete

func (s *VcsRootService) Delete(id string) error

Delete a VCS Root resource using id: locator

func (*VcsRootService) GetByID

func (s *VcsRootService) GetByID(id string) (VcsRoot, error)

GetByID Retrieves a vcs root by id using the id: locator

type VcsTriggerQuietPeriodMode

type VcsTriggerQuietPeriodMode int

VcsTriggerQuietPeriodMode specifies if the VCS Trigger will delay the start of a build after detecting a VCS change, used by TriggerVcsOptions.

const (
	// QuietPeriodDoNotUse disables QuietPeriod on VCS Trigger
	QuietPeriodDoNotUse VcsTriggerQuietPeriodMode = 0
	// QuietPeriodUseDefault instructs the VCS Trigger to respect the server-wide quiet period
	QuietPeriodUseDefault VcsTriggerQuietPeriodMode = 1
	// QuietPeriodCustom allows specifying a period in seconds via TriggerVcsOptions.QuietPeriodInSeconds. When using Custom, TriggerVcsOptions.QuietPeriodInSeconds is mandatory.
	QuietPeriodCustom VcsTriggerQuietPeriodMode = 2
)

Jump to

Keyboard shortcuts

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