Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/runway/messagequeue/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ func TestMergeRequestRoundTrip(t *testing.T) {
Steps: []*MergeStep{
{
StepId: "queue-a/1",
Changes: []*changepb.Change{{Uris: []string{"github://github.example.com/uber/repo/pull/1/0123456789abcdef0123456789abcdef01234567"}}},
Change: &changepb.Change{Uris: []string{"github://github.example.com/uber/repo/pull/1/0123456789abcdef0123456789abcdef01234567"}},
Strategy: strategypb.Strategy_REBASE,
},
{
StepId: "queue-a/2",
Changes: []*changepb.Change{{Uris: []string{"github://github.example.com/uber/repo/pull/2/89abcdef0123456789abcdef0123456789abcdef"}}},
Change: &changepb.Change{Uris: []string{"github://github.example.com/uber/repo/pull/2/89abcdef0123456789abcdef0123456789abcdef"}},
Strategy: strategypb.Strategy_MERGE,
},
},
Expand Down
16 changes: 9 additions & 7 deletions api/runway/messagequeue/proto/merge.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@ option java_multiple_files = true;
option java_outer_classname = "MergeProto";
option java_package = "com.uber.submitqueue.runway.messagequeue";

// MergeStep is one step of an ordered merge: a single set of change(s) applied
// with a strategy. Runway applies the steps of a request in order on top of the
// merge target; the ordering encodes the base-layering (earlier steps are the
// in-flight base, the last step is the candidate).
// MergeStep is one step of an ordered merge: a single change applied with a
// strategy. Runway applies the steps of a request in order on top of the merge
// target; the ordering encodes the base-layering (earlier steps are the
// in-flight base, the last step is the candidate). A change may contain
// multiple URIs (e.g. stacked PRs that land together).
message MergeStep {
// step_id is an opaque, caller-assigned identifier for this step. Runway
// treats it as an attribution token only -- it echoes it back per-step in
// StepResult so a multi-step result is attributable -- and never interprets
// its contents.
string step_id = 1;
// changes are the code change(s) to apply for this step.
repeated uber.base.change.Change changes = 2;
// strategy is how this step's changes are integrated into the merge target.
// change is the code change to apply for this step. A change may carry
// multiple URIs when the step represents stacked or grouped changes.
uber.base.change.Change change = 2;
// strategy is how this step's change is integrated into the merge target.
uber.base.mergestrategy.Strategy strategy = 3;
}

Expand Down
28 changes: 15 additions & 13 deletions api/runway/messagequeue/protopb/merge.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions runway/extension/merger/noop/noop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ func testRequest() *runwaymq.MergeRequest {
Steps: []*runwaymq.MergeStep{
{
StepId: "queue-a/1",
Changes: []*changepb.Change{{Uris: []string{"github://github.example.com/uber/repo/pull/1/abcdef0123456789abcdef0123456789abcdef01"}}},
Change: &changepb.Change{Uris: []string{"github://github.example.com/uber/repo/pull/1/abcdef0123456789abcdef0123456789abcdef01"}},
Strategy: strategypb.Strategy_REBASE,
},
{
StepId: "queue-a/2",
Changes: []*changepb.Change{{Uris: []string{"github://github.example.com/uber/repo/pull/2/89abcdef0123456789abcdef0123456789abcdef"}}},
Change: &changepb.Change{Uris: []string{"github://github.example.com/uber/repo/pull/2/89abcdef0123456789abcdef0123456789abcdef"}},
Strategy: strategypb.Strategy_MERGE,
},
},
Expand Down
2 changes: 1 addition & 1 deletion submitqueue/orchestrator/controller/merge/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (c *Controller) buildMergeRequest(ctx context.Context, batch entity.Batch)
}
steps = append(steps, &runwaymq.MergeStep{
StepId: request.ID,
Changes: []*changepb.Change{{Uris: request.Change.URIs}},
Change: &changepb.Change{Uris: request.Change.URIs},
Strategy: toProtoStrategy(request.LandStrategy),
})
}
Expand Down
8 changes: 4 additions & 4 deletions submitqueue/orchestrator/controller/merge/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ func TestProcess_PublishesFullPayloadToRunway(t *testing.T) {
require.Len(t, got.Steps, 2)
// One step per member request, in Contains order, attributed by request id.
assert.Equal(t, req1.ID, got.Steps[0].StepId)
require.Len(t, got.Steps[0].Changes, 1)
assert.Equal(t, req1.Change.URIs, got.Steps[0].Changes[0].Uris)
require.NotNil(t, got.Steps[0].Change)
assert.Equal(t, req1.Change.URIs, got.Steps[0].Change.Uris)
assert.Equal(t, strategypb.Strategy_SQUASH_REBASE, got.Steps[0].Strategy)
assert.Equal(t, req2.ID, got.Steps[1].StepId)
require.Len(t, got.Steps[1].Changes, 1)
assert.Equal(t, req2.Change.URIs, got.Steps[1].Changes[0].Uris)
require.NotNil(t, got.Steps[1].Change)
assert.Equal(t, req2.Change.URIs, got.Steps[1].Change.Uris)
assert.Equal(t, strategypb.Strategy_REBASE, got.Steps[1].Strategy)
}

Expand Down
2 changes: 1 addition & 1 deletion submitqueue/orchestrator/controller/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (c *Controller) Process(ctx context.Context, delivery consumer.Delivery) er
Steps: []*runwaymq.MergeStep{
{
StepId: request.ID,
Changes: []*changepb.Change{{Uris: request.Change.URIs}},
Change: &changepb.Change{Uris: request.Change.URIs},
Strategy: toProtoStrategy(request.LandStrategy),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ func TestController_Process_PublishesCheckToRunway(t *testing.T) {
assert.Equal(t, request.Queue, got.QueueName)
require.Len(t, got.Steps, 1)
assert.Equal(t, request.ID, got.Steps[0].StepId)
require.Len(t, got.Steps[0].Changes, 1)
assert.Equal(t, request.Change.URIs, got.Steps[0].Changes[0].Uris)
require.NotNil(t, got.Steps[0].Change)
assert.Equal(t, request.Change.URIs, got.Steps[0].Change.Uris)
assert.Equal(t, strategypb.Strategy_REBASE, got.Steps[0].Strategy)
}

Expand Down
Loading