Sitelet https://github.com/GoogleCloudPlatform/testgrid/pull/1274
Skip to content

Add ability to query a single job from Prow in ResultStore. - #1274

Merged
google-oss-prow[bot] merged 1 commit into
GoogleCloudPlatform:mainfrom
michelle192837:query
Mar 5, 2024
Merged

google-oss-prow[bot] merged 1 commit into
GoogleCloudPlatform:mainfrom
michelle192837:query

Conversation

@michelle192837

Copy link
Copy Markdown
Collaborator

Our ResultStore implementation at the moment is limited to Prow results from ResultStore (e.g. has "label:prow"). This is fine for our current assumptions, but if results for multiple Prow jobs are uploaded to the same project (a common use case), then all the results get processed in TestGrid on the same tab, which we want to avoid for users and development.

Instead, allow a very simple query (only target:"<job name>"), so it's possible to specify a particular job for a tab instead of the results for everything uploaded from Prow.

@michelle192837

Copy link
Copy Markdown
Collaborator Author

/retest

Comment thread pkg/updater/resultstore/query.go Outdated
}

var (
queryRe = regexp.MustCompile(`target:"?.*"?`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this regexp permits patterns like
target:"foo
target:foo"
target:"foo", "bar"
etc.

Do you need it to be more defensive? What is the source of these strings?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't have to be, but for now it probably should be. The source of these is either user-defined (so someone can misconfigure it, we just want to discourage it), or automatically-generated TestGrid groups (like groups created from Prow annotations or the like; in this case, for auto-generation when we know a Prow job is using a ResultStore source).

Tightened up the regular expression, thanks for catching this!

return "", nil
}
// For now, we expect a query with a single atom, with the exact form `target:"<target>"`
if !queryRe.MatchString(simpleQuery) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MatchString matches a substring--"target:" could appear anywhere. Should anchor if that is the intent.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reminder! Updated, and added a test case to catch it.

Our ResultStore implementation at the moment is limited to Prow results
from ResultStore (e.g. has "label:prow"). This is fine for our current
assumptions, but if results for multiple Prow jobs are uploaded to the
same project (a common use case), then all the results get processed in
TestGrid on the same tab, which we want to avoid for users and
development.

Instead, allow a very simple query (only `target:"<job name>"`), so it's
possible to specify a particular job for a tab instead of the results
for everything uploaded from Prow.
@google-oss-prow google-oss-prow Bot added the lgtm label Mar 5, 2024
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: airbornepony, michelle192837

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
google-oss-prow Bot merged commit 9e39b10 into GoogleCloudPlatform:main Mar 5, 2024
@michelle192837
michelle192837 deleted the query branch March 5, 2024 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants