Documentation
¶
Overview ¶
Package publish is aicoded publish and aicoded status: it checks a commit of an app, sends it to the platform's delivery pipeline as a git bundle, and reads the outcome. git runs only with constant arguments, and revisions go on its standard input.
Index ¶
- Variables
- func Outcome(p platform.Publish) error
- func Releasing(p platform.Publish) bool
- func Replaced(r platform.Release) string
- func Settle(ctx context.Context, c *platform.Client, dir string, p platform.Publish) (string, error)
- func SettlePending(ctx context.Context, c *platform.Client, dir string) (string, error)
- func Wait(ctx context.Context, c *platform.Client, id string, every, limit time.Duration, ...) (platform.Publish, error)
- func WaitRelease(ctx context.Context, c *platform.Client, id string, every, limit time.Duration, ...) (platform.Publish, error)
- func WriteText(w io.Writer, p platform.Publish) error
- type CheckError
- type Commit
- type Options
- type Sent
Constants ¶
This section is empty.
Variables ¶
var ErrTimeout = errors.New("the publish has not ended in time")
ErrTimeout is the error of Wait when the publish has not ended in time.
Functions ¶
func Outcome ¶
Outcome returns the error of a publish whose commit the platform could not read, E-PUB-014, or whose delivery pipeline could not finish, E-PUB-011, and otherwise nil.
func Releasing ¶ added in v0.13.0
Releasing reports whether the release of p is on its way to production: due, or released and not live yet.
func Replaced ¶ added in v0.13.0
Replaced says which older publish the release r replaced, and what became of it, or "" when it replaced none. While r is held, it says how to get a new approval card or go live.
func Settle ¶
func Settle(ctx context.Context, c *platform.Client, dir string, p platform.Publish) (string, error)
Settle clears the draft of the app in dir once p, a publish that carried it, has passed, as migrations.Settle does, and returns a line for the builder about the draft, or "". It does nothing while p runs.
func SettlePending ¶
SettlePending settles, as Settle does, the publish that last carried the draft of the app in dir, once it has ended. While that publish runs and the app has a draft, it refuses with E-MIG-001, since a publish now would send the draft a second time. A publish the platform does not know is forgotten. When the platform cannot say, it leaves it for later.
func Wait ¶
func Wait(ctx context.Context, c *platform.Client, id string, every, limit time.Duration, progress io.Writer) (platform.Publish, error)
Wait asks the platform for the publish id every every, until it ends, ctx ends or limit has passed, which is ErrTimeout. It writes each status before the end to progress, and returns the last answer. A request that fails in a way that may pass, such as one with no answer, is made again at the next turn, and the fifth such failure in a row ends the wait.
func WaitRelease ¶ added in v0.13.0
func WaitRelease(ctx context.Context, c *platform.Client, id string, every, limit time.Duration, w io.Writer) (platform.Publish, error)
WaitRelease waits, as Wait does, until the release of the publish id, whose release was asked for, has gone live, waits for an approver, or ended otherwise. It writes each state of the release before then to w, such as going live.
func WriteText ¶
WriteText writes the publish as aicoded publish and aicoded status print it: what was published, each step with its outcome, the problems as aicoded check prints them, each note after "note: ", which checks ran, the change record, the decision on releasing it, an approver's decline, and a last line with the status, which counts the problems of a failed publish.
Types ¶
type CheckError ¶
CheckError is E-PUB-004, with the report of aicoded check, which found problems.
func (*CheckError) Error ¶
func (e *CheckError) Error() string
func (*CheckError) Unwrap ¶
func (e *CheckError) Unwrap() error
type Commit ¶
type Commit struct {
// Dir is the app's folder, the top level of its git repository.
Dir string
App string
SHA string
Summary string
// Migration is the app's draft, .aicoded/migration.sql, which the publish carries, or "".
Migration string
// Release is Options.Release.
Release bool
}
Commit is a commit of an app that Prepare checked.
func Prepare ¶
Prepare checks the commit HEAD of the app in dir, before any of it leaves the computer: dir holds aicoded.yaml and is the top level of a git repository with a commit (E-PUB-001); git is 2.31 or later (E-PUB-012); neither the commit nor the index holds the draft (E-MIG-001); nothing is left uncommitted but the draft and the cache of the published migrations (E-PUB-002); opts.App, when set, is the app's name (E-PUB-003); and aicoded check --frozen --no-tests finds no problem, with no replace line allowed (E-PUB-004, a *CheckError). The commit carries the draft that aicoded check checked.
type Options ¶
type Options struct {
// App, when set, must be the name of the app in the folder.
App string
// Summary says what changed, for the change record; "" takes the subject of the commit.
Summary string
// Release asks for the release at once, once the publish passed, skipping its owner's
// preview, for which the platform otherwise holds it.
Release bool
}
Options are the choices of a publish.
type Sent ¶
type Sent struct {
ID string
App string
SHA string
// CreatedApp is set when the publish created the app, which the builder now owns.
CreatedApp bool
}
Sent is a publish the platform took.
func Send ¶
Send sends the commit to the platform's delivery pipeline: the history since the app's base, which it asks the platform for, or all of it, and the draft. An archived app is E-PUB-006, and a commit the app has published already E-PUB-007, whose fix, when that publish is held for its owner's preview, is to release it. When another publish changes the base meanwhile, it asks again and sends once more. The cache of the published migrations then keeps the publish that carried the draft, so that Settle can clear the draft once it passed.