Skip to content

Commit 96902d1

Browse files
committed
fix(stovepipe): reverse BuildRunner.Trigger arg order, trim README
1 parent 4cbbc6e commit 96902d1

5 files changed

Lines changed: 19 additions & 29 deletions

File tree

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
# BuildRunner
22

3-
Vendor-agnostic interface through which Stovepipe triggers and polls builds against an external build system. Shaped the same as SubmitQueue's own `buildrunner` extension — same `Trigger`/`Status`/`Cancel` verbs, same async contract, same id model — but a separate interface rather than a shared one: Stovepipe validates a single commit against a baseline (or from scratch), not a stack of dependency batches, so `Trigger` takes URI identity instead of batch identity. See [doc/rfc/stovepipe/steps/build.md](../../../doc/rfc/stovepipe/steps/build.md#why-separate-contracts) for the full rationale, and its ["Carries over vs. new"](../../../doc/rfc/stovepipe/steps/build.md#carries-over-vs-new) section for what is shaped the same as SubmitQueue's versus what is Stovepipe-specific.
3+
Vendor-agnostic interface through which Stovepipe triggers and polls builds against an external build system.
44

5-
Per the repository's extension rules, this package holds the `BuildRunner` interface, its `Config`, and the `Factory` *interface* only — concrete `Factory` implementations and the per-queue routing that picks a backend for a `Config.QueueName` live in the wiring layer.
6-
7-
## Behavior
8-
9-
- **Trigger** starts a new build against `headURI` (optionally relative to an incremental `baseURI`) and returns the runner-minted build id. There is no caller-supplied dedup input — every call starts a fresh build, and downstream idempotency absorbs any duplicate from a redelivery. Trigger must return promptly; the build itself runs asynchronously.
5+
- **Trigger** starts a new build against `headURI`, optionally relative to an incremental `baseURI`, and returns the runner-minted build id. There is no caller-supplied dedup input — every call starts a fresh build; downstream idempotency absorbs any duplicate from a redelivery. Trigger must return promptly; the build itself runs asynchronously.
106
- **Status** polls the current status and any provider metadata for a build id `Trigger` returned. Unlike `Trigger`, it may round-trip to the backend and block.
11-
- **Cancel** requests cancellation for a build id, returning once the request reaches the runner rather than once the build actually stops. No controller calls it today — it exists for contract parity with SubmitQueue and for future use.
12-
13-
## Errors
14-
15-
Implementations return plain, unclassified errors — the calling controller decides user-vs-infra and retryable-vs-not, per `platform/errs`. There is no package error sentinel yet; a domain sentinel (e.g. for "unknown build") is deferred until a concrete need for it lands.
16-
17-
## Implementations
7+
- **Cancel** requests cancellation for a build id, returning once the request reaches the runner rather than once the build actually stops. Unused today; kept for contract parity with SubmitQueue.
188

19-
- **fake** — a stateless backend that succeeds by default and honors failure-injection markers embedded in `headURI`, for examples and tests.
9+
Implementations return plain, unclassified errors — the calling controller decides retryable-vs-not and user-vs-infra, per `platform/errs`.
2010

21-
To add a backend, create `buildrunner/{backend}/`, implement the `BuildRunner` interface, and return it from a `New(...)` constructor.
11+
See [doc/rfc/stovepipe/steps/build.md](../../../doc/rfc/stovepipe/steps/build.md#why-separate-contracts) for why this is a separate contract from SubmitQueue's own `buildrunner` rather than a shared one. To add a backend, create `buildrunner/{backend}/`, implement `BuildRunner`, and return it from a `New(...)` constructor.

stovepipe/extension/buildrunner/buildrunner.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ import (
4343
// platform/errs.
4444
type BuildRunner interface {
4545
// Trigger starts a new build every call and mints the build's identity —
46-
// there is no caller-supplied dedup input. headURI is the commit under
47-
// validation; baseURI is the incremental baseline, empty for a full
48-
// build; both are opaque tokens owned by SourceControl. metadata is
46+
// there is no caller-supplied dedup input. baseURI is the incremental
47+
// baseline, empty for a full build; headURI is the commit under
48+
// validation; both are opaque tokens owned by SourceControl. metadata is
4949
// caller-supplied annotation the runner may echo back via Status but must
5050
// not depend on. Trigger is async: it must return promptly with the
5151
// runner-assigned id, not an outcome — callers learn progress via Status.
52-
Trigger(ctx context.Context, headURI, baseURI string, metadata entity.BuildMetadata) (entity.BuildID, error)
52+
Trigger(ctx context.Context, baseURI, headURI string, metadata entity.BuildMetadata) (entity.BuildID, error)
5353

5454
// Status returns the build's current status and any provider metadata for
5555
// the id Trigger returned. Unlike Trigger, Status may round-trip to the

stovepipe/extension/buildrunner/fake/fake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func New() buildrunner.BuildRunner {
7171
// returns a unique BuildID that encodes the terminal outcome the build should
7272
// report at Status time (decided from the headURI marker). baseURI and metadata
7373
// are ignored.
74-
func (r runner) Trigger(_ context.Context, headURI, _ string, _ entity.BuildMetadata) (entity.BuildID, error) {
74+
func (r runner) Trigger(_ context.Context, _, headURI string, _ entity.BuildMetadata) (entity.BuildID, error) {
7575
outcome := outcomeOK
7676
switch marker(headURI) {
7777
case tokenTriggerError:

stovepipe/extension/buildrunner/fake/fake_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestTrigger(t *testing.T) {
4242
}
4343
for _, tt := range tests {
4444
t.Run(tt.name, func(t *testing.T) {
45-
id, err := New().Trigger(context.Background(), tt.headURI, "", nil)
45+
id, err := New().Trigger(context.Background(), "", tt.headURI, nil)
4646
if tt.wantErr {
4747
require.Error(t, err)
4848
assert.Empty(t, id.ID)
@@ -55,9 +55,9 @@ func TestTrigger(t *testing.T) {
5555
}
5656

5757
func TestTrigger_UniqueIDs(t *testing.T) {
58-
a, err := New().Trigger(context.Background(), "git://repo/ref/deadbeef", "", nil)
58+
a, err := New().Trigger(context.Background(), "", "git://repo/ref/deadbeef", nil)
5959
require.NoError(t, err)
60-
b, err := New().Trigger(context.Background(), "git://repo/ref/deadbeef", "", nil)
60+
b, err := New().Trigger(context.Background(), "", "git://repo/ref/deadbeef", nil)
6161
require.NoError(t, err)
6262
assert.NotEqual(t, a.ID, b.ID)
6363
}
@@ -75,7 +75,7 @@ func TestStatus(t *testing.T) {
7575
}
7676
for _, tt := range tests {
7777
t.Run(tt.name, func(t *testing.T) {
78-
id, err := New().Trigger(context.Background(), tt.headURI, "", nil)
78+
id, err := New().Trigger(context.Background(), "", tt.headURI, nil)
7979
require.NoError(t, err)
8080

8181
status, metadata, err := New().Status(context.Background(), id)
@@ -98,7 +98,7 @@ func TestStatus_UnrecognizedIDSucceeds(t *testing.T) {
9898
}
9999

100100
func TestStatus_StatelessAcrossInstances(t *testing.T) {
101-
id, err := New().Trigger(context.Background(), "git://repo/ref/deadbeef?buildrunner-fake=build-fail", "", nil)
101+
id, err := New().Trigger(context.Background(), "", "git://repo/ref/deadbeef?buildrunner-fake=build-fail", nil)
102102
require.NoError(t, err)
103103

104104
status, _, err := New().Status(context.Background(), id)

stovepipe/extension/buildrunner/mock/buildrunner_mock.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)