Skip to content

Commit 6634e79

Browse files
Refresh submit status after opportunistic drain
Co-authored-by: Andrew <andrewxhill@gmail.com>
1 parent c04054f commit 6634e79

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

internal/app/submit.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,20 @@ Flags:
297297
}
298298
if drainErr != nil {
299299
result.Error = drainErr.Error()
300+
} else {
301+
submission, loadErr := queued.Store.GetIntegrationSubmission(context.Background(), queued.Submission.ID)
302+
if loadErr == nil {
303+
result.SubmissionStatus = submission.Status
304+
if submission.Status == "succeeded" {
305+
info, infoErr := resolveSubmissionPublishInfo(context.Background(), queued.Store, queued.RepoRecord.ID, submission)
306+
if infoErr == nil {
307+
result.Outcome = info.Outcome
308+
}
309+
if result.Outcome == "" {
310+
result.Outcome = submissionOutcomeIntegrated
311+
}
312+
}
313+
}
300314
}
301315
}
302316
if asJSON {

internal/app/submit_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ func TestSubmitOpportunisticallyDrainsQueuedWork(t *testing.T) {
144144
if !result.DrainAttempted {
145145
t.Fatalf("expected drain attempt, got %+v", result)
146146
}
147+
if result.SubmissionStatus != "succeeded" || result.Outcome != submissionOutcomeLanded {
148+
t.Fatalf("expected submit json to reflect landed outcome after drain, got %+v", result)
149+
}
147150

148151
layout, err := git.DiscoverRepositoryLayout(repoRoot)
149152
if err != nil {

0 commit comments

Comments
 (0)