Documentation ¶
Overview ¶
Package shippable is a library providing access to Shippable API.
Index ¶
- func Stringify(anyStruct interface{}) string
- type Account
- type AccountService
- func (a *AccountService) DeleteAccount(id string) (ok bool, resp *Response, err error)
- func (a *AccountService) GetAccount(id string) (account *Account, resp *Response, err error)
- func (a *AccountService) GetAccountIdentities(id string) (identities *[]string, resp *Response, err error)
- func (a *AccountService) GetAccounts() (accounts *[]string, resp *Response, err error)
- type BaseBuild
- type Build
- type BuildSettings
- type BuildStep
- type BuildSteps
- type Client
- type DeployKey
- type DockerHubCredentials
- type Email
- type GithubUser
- type IRCNotification
- type Identity
- type MatrixResult
- type Notifications
- type Person
- type Project
- type ProjectInput
- type ProjectService
- func (p *ProjectService) GetProject(id string) (project *Project, resp *Response, err error)
- func (p *ProjectService) GetProjects() (projects *[]Project, resp *Response, err error)
- func (p *ProjectService) GetQueuedBuilds(projectID string) (builds *[]Build, resp *Response, err error)
- func (p *ProjectService) GetQueuedBuildsLimit(projectID string, limit int) (builds *[]Build, resp *Response, err error)
- func (p *ProjectService) GetRecentBuilds(projectID string) (builds *[]Build, resp *Response, err error)
- func (p *ProjectService) GetRecentBuildsLimit(projectID string, limit int) (builds *[]Build, resp *Response, err error)
- func (p *ProjectService) GetRunningBuilds(projectID string) (builds *[]Build, resp *Response, err error)
- func (p *ProjectService) GetRunningBuildsLimit(projectID string, limit int) (builds *[]Build, resp *Response, err error)
- type ProjectSettings
- type Report
- type Response
- type TriggerBuildInput
- type TriggerBuildOutput
- type WorkflowService
- func (w *WorkflowService) DisableBuild(p *ProjectInput) (ok bool, resp *Response, err error)
- func (w *WorkflowService) EnableBuild(p *ProjectInput) (project *Project, resp *Response, err error)
- func (w *WorkflowService) TriggerBuild(t *TriggerBuildInput) (build *TriggerBuildOutput, resp *Response, err error)
- func (w *WorkflowService) ValidateDockerHubCredentials(c *DockerHubCredentials) (ok bool, resp *Response, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Stringify ¶
func Stringify(anyStruct interface{}) string
Stringify attempts to create a reasonable string representation of types. It does things like resolve pointers to their values and omits struct fields with nil values. This is taken from Stringify method of go-github. License can be found at https://github.com/google/go-github/blob/master/LICENSE
Types ¶
type Account ¶
type Account struct { AccountAuthorizationLastSyncEndDate *string `json:"accountAuthorizationLastSyncEndDate"` AccountAuthorizationLastSyncStartDate *string `json:"accountAuthorizationLastSyncStartDate"` BraintreeCustomerID *string `json:"braintreeCustomerId"` Created *string `json:"created"` ID *string `json:"id"` Identities *[]Identity `json:"identities"` LastAccountSyncEndDate *string `json:"lastAccountSyncEndDate"` LastAccountSyncStartDate *string `json:"lastAccountSyncStartDate"` LastUsedIdentityID *string `json:"lastUsedIdentityId"` SystemRoles *[]string `json:"systemRoles"` }
Account is the Shippable API user entity.
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService interacts with the /acounts endpoint of Shippable API.
func (*AccountService) DeleteAccount ¶
func (a *AccountService) DeleteAccount(id string) (ok bool, resp *Response, err error)
DeleteAccount deletes the specified Shippable account ID.
func (*AccountService) GetAccount ¶
func (a *AccountService) GetAccount(id string) (account *Account, resp *Response, err error)
GetAccount returns information of a specific Shippable account ID.
func (*AccountService) GetAccountIdentities ¶
func (a *AccountService) GetAccountIdentities(id string) (identities *[]string, resp *Response, err error)
GetAccountIdentities returns a string list of identity ids associated with this account. Your account can have multiple identities. There will always be at least one identity, and that is the identity of your linked github or bitbucket account. Another identity your account could take is the identity of an organization it belongs to.
func (*AccountService) GetAccounts ¶
func (a *AccountService) GetAccounts() (accounts *[]string, resp *Response, err error)
GetAccounts returns a string list of your Shippable account IDs.
type BaseBuild ¶
type BaseBuild struct { BranchCoveragePercent *int `json:"branchCoveragePercent"` BuildNumber *int `json:"buildNumber"` CommitTag *string `json:"commitTag"` ConsoleLogBytes *int `json:"consoleLogBytes"` ConsoleLogLineCount *int `json:"consoleLogLineCount"` DeprovisionStatusDate *string `json:"deprovisionStatusDate"` Duration *int `json:"duration"` EndDate *string `json:"endDate"` Environment *string `json:"environment"` Gemfile *string `json:"gemfile"` ImageCommitStatusDate *string `json:"imageCommitStatusDate"` IsBuildCompleted *bool `json:"isBuildCompleted"` IsCompleted *bool `json:"isCompleted"` IsFailureAllowed *bool `json:"isFailureAllowed"` IsSubscriptionHost *bool `json:"isSubscriptionHost"` Jdk *string `json:"jdk"` MatrixValues *[]MatrixResult `json:"matrixValues"` QueuedDate *string `json:"queuedDate"` SequenceCoveragePercent *int `json:"sequenceCoveragePercent"` Size interface{} `json:"size"` StartDate *string `json:"startDate"` Status *int `json:"status"` Steps *BuildSteps `json:"steps"` TestsFailed *int `json:"testsFailed"` TestsPassed *int `json:"testsPassed"` TestsSkipped *int `json:"testsSkipped"` TotalTests *int `json:"totalTests"` Version *string `json:"version"` // contains filtered or unexported fields }
BaseBuild struct represents a unit of the Build matrix.
type Build ¶
type Build struct { BaseCommitRef *string `json:"baseCommitRef"` BeforeCommitSha *string `json:"beforeCommitSha"` Branch *string `json:"branch"` BranchCoveragePercent float64 `json:"branchCoveragePercent"` BranchHead *string `json:"branchHead"` BuildGroupNumber *int `json:"buildGroupNumber"` BuildItemStepOrder *[]interface{} `json:"buildItemStepOrder"` BuildRunnerVersion *string `json:"buildRunnerVersion"` Builds *[]BaseBuild `json:"builds"` CommitSha *string `json:"commitSha"` CommitURL *string `json:"commitUrl"` Committer Person `json:"committer"` CompareURL *string `json:"compareUrl"` CreatedByAccountID *string `json:"createdByAccountId"` CreatedDate *string `json:"createdDate"` DurationCumulative *string `json:"durationCumulative"` EmailNotifications *[]interface{} `json:"emailNotifications"` EmailOnFailure *string `json:"emailOnFailure"` EmailOnSuccess *string `json:"emailOnSuccess"` ID *string `json:"id"` ImageID *string `json:"imageId"` ImageName *string `json:"imageName"` IsAutoBuild *bool `json:"isAutoBuild"` IsAutoCommit *bool `json:"isAutoCommit"` IsAutoPush *bool `json:"isAutoPush"` IsCompleted *bool `json:"isCompleted"` IsPullRequest *bool `json:"isPullRequest"` IsReRun *bool `json:"isReRun"` Language *string `json:"language"` LastAuthor *Person `json:"lastAuthor"` LastCommitShortDescription *string `json:"lastCommitShortDescription"` Network *string `json:"network"` Notifications *Notifications `json:"notifications"` ParallelizedTest *bool `json:"parallelizedTest"` Privileged *bool `json:"privileged"` ProjectID *string `json:"projectId"` PullRequestNumber *int `json:"pullRequestNumber"` RepositoryFileCount *interface{} `json:"repositoryFileCount"` RepositorySize *interface{} `json:"repositorySize"` RequiresDedicatedHost *bool `json:"requiresDedicatedHost"` RunCommand *string `json:"runCommand"` SequenceCoveragePercent *int `json:"sequenceCoveragePercent"` Settings *BuildSettings `json:"settings"` ShouldArchive *bool `json:"shouldArchive"` ShouldDecryptSecureEnvs *bool `json:"shouldDecryptSecureEnvs"` Status *int `json:"status"` StatusMessage *string `json:"statusMessage"` TestsFailed *int `json:"testsFailed"` TestsPassed *int `json:"testsPassed"` TestsSkipped *int `json:"testsSkipped"` TimeoutMS *int `json:"timeoutMS"` TotalTests *int `json:"totalTests"` TriggeredBy *Person `json:"triggeredBy"` UpdatedDate *string `json:"updatedDate"` }
Build is the base structure of Shippable builds.
type BuildSettings ¶
type BuildSettings struct { ImageID *string `json:"imageId"` ImageOptions *struct { NetworkMode *string `json:"networkMode"` Privileged *bool `json:"privileged"` } `json:"imageOptions"` PullImageName *string `json:"pullImageName"` RequiresDedicatedHost *bool `json:"requiresDedicatedHost"` RunCommand *string `json:"runCommand"` }
BuildSettings describe the attributes of a Build.
type BuildStep ¶
type BuildStep struct { Duration *int `json:"duration"` EndTime *string `json:"endTime"` Report *[]Report `json:"report"` StartTime *string `json:"startTime"` }
BuildStep struct describes a CI step on Shippable.
type BuildSteps ¶
type BuildSteps struct { Pull *BuildStep `json:"pull"` Build *BuildStep `json:"build"` Commit *BuildStep `json:"commit"` Upload *BuildStep `json:"upload"` Report *BuildStep `json:"report"` }
BuildSteps structure holds the CI step sequence of Pull/Build/Commit/Upload/Report.
type Client ¶
type Client struct { // Endpoint for API requests. Defaults to the Live Shippable API // should have a trailing slash Endpoint *url.URL // The client's Shippable API token used for Authentication Token string // User agent used when communicating with the Shippable API. UserAgent string // Routes/entities used for talking to different parts of the Shippable API. Projects *ProjectService Accounts *AccountService Workflow *WorkflowService // contains filtered or unexported fields }
Client holds the client to Shippable API along with an authorization token and pointers to each Shippable API service/endpoint.
func NewClient ¶
NewClient returns a new Shippable API client. An authorization token is needed to interact with the service.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the Endpoint of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type DeployKey ¶
type DeployKey struct {
Public *string `json:"public"`
}
DeployKey is used for Project deployment.
type DockerHubCredentials ¶
DockerHubCredentials is used to authenticated against DockerHub registry
type Email ¶
type Email struct { Email *string `json:"email"` Primary bool `json:"primary"` Verified bool `json:"verified"` }
Email of a Shippable API user.
type GithubUser ¶
type GithubUser struct { AvatarURL *string `json:"avatar_url"` EventsURL *string `json:"events_url"` FollowersURL *string `json:"followers_url"` FollowingURL *string `json:"following_url"` GistsURL *string `json:"gists_url"` GravatarID *string `json:"gravatar_id"` HTMLURL *string `json:"html_url"` ID *int `json:"id"` Login *string `json:"login"` OrganizationsURL *string `json:"organizations_url"` ReceivedEventsURL *string `json:"received_events_url"` ReposURL *string `json:"repos_url"` SiteAdmin *bool `json:"site_admin"` StarredURL *string `json:"starred_url"` SubscriptionsURL *string `json:"subscriptions_url"` Type *string `json:"type"` URL *string `json:"url"` }
GithubUser that generated a Shippable CI event.
type IRCNotification ¶
type IRCNotification struct { Channels []interface{} `json:"channels"` NotifyOnPullRequests bool `json:"notifyOnPullRequests"` }
IRCNotification is used to report the outcome of a build on IRC.
type Identity ¶
type Identity struct { AvatarID *string `json:"avatarId"` AvatarURL *string `json:"avatarUrl"` DisplayName *string `json:"displayName"` Email *string `json:"email"` Emails *[]Email `json:"emails"` EnforceScopes *[]string `json:"enforceScopes"` ID *string `json:"id"` MigratedProviderID bool `json:"migratedProviderId"` Provider *string `json:"provider"` ProviderBlog *string `json:"providerBlog"` ProviderCompany *string `json:"providerCompany"` ProviderFollowerCount int `json:"providerFollowerCount"` ProviderID *string `json:"providerId"` ProviderLocation *string `json:"providerLocation"` ProviderOwnedPrivateRepos int `json:"providerOwnedPrivateRepos"` ProviderPrivateGists int `json:"providerPrivateGists"` ProviderPublicGistCount int `json:"providerPublicGistCount"` ProviderPublicRepoCount int `json:"providerPublicRepoCount"` ProviderTotalPrivateRepos int `json:"providerTotalPrivateRepos"` ProviderType *string `json:"providerType"` Scopes *[]string `json:"scopes"` Username *string `json:"userName"` }
Identity of a Shippable API user with Providers like Github, BitBucket etc.
type MatrixResult ¶
type MatrixResult struct { Name *string `json:"name"` Value *string `json:"value"` // contains filtered or unexported fields }
MatrixResult represents the build results of the Build Matrix.
type Notifications ¶
type Notifications struct {
IRC IRCNotification `json:"irc"`
}
Notifications are used to pingback external services about the outcome of a build.
type Person ¶
type Person struct { AvatarURL *string `json:"avatarUrl"` DisplayName *string `json:"displayName"` Email *string `json:"email"` Login *string `json:"login"` }
Person holds info of a Shippable API user and/or Project contributor.
type Project ¶
type Project struct { AutoBuild *bool `json:"autoBuild"` Branches *[]string `json:"branches"` CacheTag *int `json:"cacheTag"` Created *string `json:"created"` DeployKey *DeployKey `json:"deployKey"` EnabledDate *time.Time `json:"enabledDate"` FullName *string `json:"fullName"` ID *string `json:"id"` IsEnabled *bool `json:"isEnabled"` IsFork *bool `json:"isFork"` IsPrivateRepository *bool `json:"isPrivateRepository"` Language *string `json:"language"` Name *string `json:"name"` OwnerTokenPresent *bool `json:"ownerTokenPresent"` ProjectAuthorizationLastSyncEndDate *string `json:"projectAuthorizationLastSyncEndDate"` ProjectAuthorizationLastSyncStartDate *string `json:"projectAuthorizationLastSyncStartDate"` RepositoryProvider *string `json:"repositoryProvider"` RepositorySSHURL *string `json:"repositorySshUrl"` RepositoryURL *string `json:"repositoryUrl"` Settings *ProjectSettings `json:"settings"` SourceCreated *time.Time `json:"sourceCreated"` SourceDefaultBranch *string `json:"sourceDefaultBranch"` SourceDescription *string `json:"sourceDescription"` SourceForksCount *int `json:"sourceForksCount"` SourceID *string `json:"sourceId"` SourcePushed *string `json:"sourcePushed"` SourceRepoOwner *GithubUser `json:"sourceRepoOwner"` SourceSize *int `json:"sourceSize"` SourceStargazersCount *int `json:"sourceStargazersCount"` SourceUpdated *string `json:"sourceUpdated"` SourceWatchersCount *int `json:"sourceWatchersCount"` SubscriptionID *string `json:"subscriptionId"` UpdatedDate *time.Time `json:"updatedDate"` }
Project used on Shippable API.
type ProjectInput ¶
type ProjectInput struct {
ProjectID *string
}
ProjectInput is passwd to WorkflowService to perform operations like enabling/disabling automatic Builds
type ProjectService ¶
type ProjectService struct {
// contains filtered or unexported fields
}
ProjectService interacts with the /projects endpoint of Shippable API.
func (*ProjectService) GetProject ¶
func (p *ProjectService) GetProject(id string) (project *Project, resp *Response, err error)
GetProject returns a more in-depth information about a specific
func (*ProjectService) GetProjects ¶
func (p *ProjectService) GetProjects() (projects *[]Project, resp *Response, err error)
GetProjects returns a list of projects, and some info about them
func (*ProjectService) GetQueuedBuilds ¶
func (p *ProjectService) GetQueuedBuilds(projectID string) (builds *[]Build, resp *Response, err error)
GetQueuedBuilds returns a list of a project's currently queued builds
func (*ProjectService) GetQueuedBuildsLimit ¶
func (p *ProjectService) GetQueuedBuildsLimit(projectID string, limit int) (builds *[]Build, resp *Response, err error)
GetQueuedBuildsLimit returns a list of a project's currently queued builds up to a limit
func (*ProjectService) GetRecentBuilds ¶
func (p *ProjectService) GetRecentBuilds(projectID string) (builds *[]Build, resp *Response, err error)
GetRecentBuilds returns a list of a project's currently recent builds
func (*ProjectService) GetRecentBuildsLimit ¶
func (p *ProjectService) GetRecentBuildsLimit(projectID string, limit int) (builds *[]Build, resp *Response, err error)
GetRecentBuildsLimit returns a list of a project's currently recent builds up to a limit
func (*ProjectService) GetRunningBuilds ¶
func (p *ProjectService) GetRunningBuilds(projectID string) (builds *[]Build, resp *Response, err error)
GetRunningBuilds returns a list of a project's currently running builds
func (*ProjectService) GetRunningBuildsLimit ¶
func (p *ProjectService) GetRunningBuildsLimit(projectID string, limit int) (builds *[]Build, resp *Response, err error)
GetRunningBuildsLimit returns a list of a project's currently running builds up to a limit
type ProjectSettings ¶
type ProjectSettings struct { EnvironmentVariables *[]string `json:"environmentVariables"` ImageOptions *imageOptions }
ProjectSettings are the settings for a Project's Build.
type Response ¶
Response is a Shippable API response. This wraps the standard http.Response returned from Shippable.
type TriggerBuildInput ¶
TriggerBuildInput is passed to WorkflowService in order to trigger a build for a project. Omit branch to build the project's default branch.
type TriggerBuildOutput ¶
type TriggerBuildOutput struct {
BuildID *string
}
TriggerBuildOutput is returned after successfully triggered a build via Shippable API.
type WorkflowService ¶
type WorkflowService struct {
// contains filtered or unexported fields
}
WorkflowService interacts with the /workflow endpoint of Shippable API.
func (*WorkflowService) DisableBuild ¶
func (w *WorkflowService) DisableBuild(p *ProjectInput) (ok bool, resp *Response, err error)
DisableBuild disables builds for a given project. This will delete project's history and its associated builds from Shippable.
func (*WorkflowService) EnableBuild ¶
func (w *WorkflowService) EnableBuild(p *ProjectInput) (project *Project, resp *Response, err error)
EnableBuild enable automatic builds for a given project.
func (*WorkflowService) TriggerBuild ¶
func (w *WorkflowService) TriggerBuild(t *TriggerBuildInput) (build *TriggerBuildOutput, resp *Response, err error)
TriggerBuild triggers a build from a given project and branch. If no branch is specified the default branch configured for the project in Github or Bitbucket will be built.
func (*WorkflowService) ValidateDockerHubCredentials ¶
func (w *WorkflowService) ValidateDockerHubCredentials(c *DockerHubCredentials) (ok bool, resp *Response, err error)
ValidateDockerHubCredentials verifies a DockerHub account for the authenticated Shippable API user.