teamcity

package module
v0.0.0-...-e241104 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2017 License: MIT Imports: 9 Imported by: 97

README

TeamCity API bindings

This is a simple wrapper around the TeamCity API.

GoDoc

Sample usage:

client := teamcity.New("myinstance.example.com", "username", "password")

b, err := client.QueueBuild("Project_build_task", "master", nil)
if err != nil {
	fmt.Printf("You're outta luck: %s\n", err)
	return
}

fmt.Printf("Build: %#v\n", b)

Documentation

Index

Constants

View Source
const (
	Unknown = State(iota)
	Queued
	Started
	Finished
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
	ID          int64
	BuildTypeID string
	BuildType   struct {
		ID          string
		Name        string
		Description string
		ProjectName string
		ProjectID   string
		HREF        string
		WebURL      string
	}
	Triggered struct {
		Type string
		Date JSONTime
		User struct {
			Username string
		}
	}
	Changes struct {
		Change []Change
	}

	QueuedDate    JSONTime
	StartDate     JSONTime
	FinishDate    JSONTime
	Number        string
	Status        string
	StatusText    string
	State         string
	BranchName    string
	Personal      bool
	Running       bool
	Pinned        bool
	DefaultBranch bool
	HREF          string
	WebURL        string
	Agent         struct {
		ID     int64
		Name   string
		TypeID int64
		HREF   string
	}

	ProblemOccurrences struct {
		ProblemOccurrence []ProblemOccurrence
	}

	TestOccurrences struct {
		TestOccurrence []TestOccurrence
	}

	// As received from the API
	TagsInput struct {
		Tag []struct {
			Name string
		}
	} `json:"tags"`

	// Useable, filled before sending to `IncomingBuilds`
	Tags []string `json:"-"`

	// As received from the API
	PropertiesInput struct {
		Property []oneProperty `json:"property"`
	} `json:"properties"`

	// Useable, filled before sending to `IncomingBuilds`
	Properties map[string]string `json:"-"`
}

Build represents a TeamCity build, along with its metadata.

func (*Build) ComputedState

func (b *Build) ComputedState() State

func (*Build) String

func (b *Build) String() string

type Change

type Change struct {
	Username string
	ID       int
	Date     string
	HREF     string
	Version  string
	WebURL   string
}

type Changes

type Changes []Change

type Client

type Client struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client to access a TeamCity API

func New

func New(host, username, password string) *Client

func (*Client) CancelBuild

func (c *Client) CancelBuild(buildID int64, comment string) error

func (*Client) GetBuild

func (c *Client) GetBuild(buildID string) (*Build, error)

func (*Client) GetBuildID

func (c *Client) GetBuildID(buildTypeID, branchName, buildNumber string) (string, error)

func (*Client) GetBuildLog

func (c *Client) GetBuildLog(buildID string) (string, error)

func (*Client) GetBuildProperties

func (c *Client) GetBuildProperties(buildID string) (map[string]string, error)

func (*Client) GetChanges

func (c *Client) GetChanges(path string) ([]Change, error)

func (*Client) GetProblems

func (c *Client) GetProblems(path string, count int64) ([]ProblemOccurrence, error)

func (*Client) GetTests

func (c *Client) GetTests(path string, count int64, failingOnly bool, ignoreMuted bool) ([]TestOccurrence, error)

func (*Client) QueueBuild

func (c *Client) QueueBuild(buildTypeID string, branchName string, properties map[string]string) (*Build, error)

func (*Client) SearchBuild

func (c *Client) SearchBuild(locator string) ([]*Build, error)

type JSONTime

type JSONTime string

JSONTime is just a string wrapper for Team City's date format.

func (JSONTime) Empty

func (t JSONTime) Empty() bool

Empty checks if the JSONTime was specified at all

func (JSONTime) IsZero

func (t JSONTime) IsZero() bool

IsZero returns whether the date is zero.

func (JSONTime) Time

func (t JSONTime) Time() time.Time

Time parses the string to extract a time.Time object.

type ProblemOccurrence

type ProblemOccurrence struct {
	ID       string
	Type     string
	Identity string
	HREF     string
	Details  string
}

type State

type State int

type TestOccurrence

type TestOccurrence struct {
	ID                    string
	Name                  string
	Status                string
	Muted                 bool
	Duration              int64
	CurrentlyMuted        bool
	CurrentlyInvestigated bool
	HREF                  string
	Details               string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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