Documentation
¶
Overview ¶
Package rerun is what `devctl pr rerun` and `devctl release rerun` share: given the CircleCI pipeline of a pull request's head or of a tag, every finished workflow of it that failed is rerun from failed -- its failed jobs and the jobs that depend on them, the passed ones kept -- with the CircleCI login of `devctl auth login`. The rerun is started, not waited for: `devctl pr wait` and `devctl release wait` wait for it.
Index ¶
- Constants
- func FromFailed(ctx context.Context, client *circleciclient.Client, org, repo string, ...) error
- func NewCircleCI(ctx context.Context, require func(context.Context) (authstore.Token, error), ...) (*circleciclient.Client, error)
- func NoPipeline(what string) error
- type Document
- type Pipeline
- type Result
- type Workflow
Constants ¶
const ( CommandPR = "pr rerun" CommandRelease = "release rerun" )
The commands, as their documents name them.
const ( // OutcomeRerun: the workflow failed and its rerun from failed started. OutcomeRerun = "rerun" // OutcomeRunning: the workflow has not finished; CircleCI reruns a // finished workflow only. OutcomeRunning = "running" // OutcomeNoFailedJob: the workflow was canceled (or unauthorized) // without a failed job to rerun. OutcomeNoFailedJob = "no_failed_job" // OutcomeNothing: the workflow did not fail. OutcomeNothing = "nothing_to_rerun" // OutcomeRefused: CircleCI refused the rerun; the reason says why. OutcomeRefused = "refused" )
The outcomes of one workflow.
Variables ¶
This section is empty.
Functions ¶
func FromFailed ¶
func FromFailed(ctx context.Context, client *circleciclient.Client, org, repo string, pipeline *circleciclient.Pipeline, result *Result, warn func(string)) error
FromFailed reruns the failed workflows of pipeline of org/repo from failed, recording each workflow in result as it goes. It returns nil when at least one rerun started (a warning names a workflow that is still running), exit 5 refused when nothing failed yet but a workflow is still running, and exit 3 not applicable when no workflow failed. A rerun CircleCI refuses with 403 is exit 8, naming the login that grants write access.
func NewCircleCI ¶
func NewCircleCI(ctx context.Context, require func(context.Context) (authstore.Token, error), endpoints agentcli.Endpoints, transport http.RoundTripper, warn func(string)) (*circleciclient.Client, error)
NewCircleCI is the CircleCI client on the keychain login require returns, its expiry warning passed to warn. Reads go through transport, which retries them; the rerun itself, a POST, is sent once.
func NoPipeline ¶
NoPipeline is exit 3 for a head or tag CircleCI has not built.
Types ¶
type Document ¶
Document is the commands' JSON: the envelope and the result.
func NewDocument ¶
NewDocument starts the document of command for repository.
type Result ¶
type Result struct {
Repository string `json:"repository"`
// Number is the pull request of `pr rerun`.
Number int `json:"number,omitempty"`
// Tag is the tag of `release rerun`, as CircleCI built it.
Tag string `json:"tag,omitempty"`
// HeadSHA is the revision the pipeline built.
HeadSHA string `json:"headSha,omitempty"`
// Pipeline is absent when CircleCI has no pipeline for the head or tag.
Pipeline *Pipeline `json:"pipeline,omitempty"`
Workflows []Workflow `json:"workflows"`
}
Result is the commands' part of the document.
type Workflow ¶
type Workflow struct {
Name string `json:"name"`
ID string `json:"id"`
Status string `json:"status"`
URL string `json:"url"`
// FailedJobs are the failed jobs as CircleCI lists them, by name; the
// listing can lag behind the workflow's status.
FailedJobs []string `json:"failedJobs"`
// Outcome is one of rerun, running, no_failed_job, nothing_to_rerun,
// refused.
Outcome string `json:"outcome"`
// RerunID and RerunURL are the new workflow of a rerun.
RerunID string `json:"rerunId,omitempty"`
RerunURL string `json:"rerunUrl,omitempty"`
}
Workflow is the newest run of one workflow name of the pipeline and what the command did with it.