diff --git a/internal/task/tagx.go b/internal/task/tagx.go index 87c91631..d6e63a5a 100644 --- a/internal/task/tagx.go +++ b/internal/task/tagx.go @@ -471,6 +471,18 @@ func (x *TagXReposTasks) findGreen(ctx *wf.TaskContext, repo TagRepo, commit str } } + foundCommit := false + for _, rev := range repoStatus.Revisions { + if rev.Revision == commit { + foundCommit = true + break + } + } + if !foundCommit { + ctx.Printf("commit %v not found on first page of results; too old or too new?", commit) + return "", false, nil + } + // x/ repo statuses are: // // diff --git a/internal/task/tagx_test.go b/internal/task/tagx_test.go index f1a287ef..0ac3916c 100644 --- a/internal/task/tagx_test.go +++ b/internal/task/tagx_test.go @@ -199,6 +199,26 @@ func TestIsGreen(t *testing.T) { }, wantGreenRev: "tools-1", }, + { + name: "not green yet", + rev: "tools-1", + lines: []revLine{ + {"master", 3, 1, true}, + {"release-branch.go1.19", 1, 1, false}, + {"release-branch.go1.18", 1, 1, true}, + }, + wantGreenRev: "", + }, + { + name: "commit not registered on dashboard", + rev: "tools-2", + lines: []revLine{ + {"master", 1, 1, true}, + {"release-branch.go1.19", 1, 1, true}, + {"release-branch.go1.18", 1, 1, true}, + }, + wantGreenRev: "", + }, } for _, tt := range tests {