-
Notifications
You must be signed in to change notification settings - Fork 68
batches: support new version field #1100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if digest, err = inspectDigest(); errors.HasType(err, &fastCommandTimeoutError{}) { | ||
if digest, err = inspectDigest(); errors.HasType[*fastCommandTimeoutError](err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors.HasType
was changed in Sourcegraph so I had to update the call here. (See https://github.com/sourcegraph/sourcegraph/pull/63024)
internal/batches/service/service.go
Outdated
const exampleSpecTmpl = `name: NAME-OF-YOUR-BATCH-CHANGE | ||
const exampleSpecTmpl = `# "version" determines how the batch spec is interpreted. | ||
version: 2 | ||
name: NAME-OF-YOUR-BATCH-CHANGE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is returned by src batch new -f <file>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny comment, as a user I would find # "version" determines how the batch spec is interpreted
to be a bit mysterious. Maybe we could say
version: 2 # Use the latest schema version
name: ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
internal/batches/service/service.go
Outdated
const exampleSpecTmpl = `name: NAME-OF-YOUR-BATCH-CHANGE | ||
const exampleSpecTmpl = `# "version" determines how the batch spec is interpreted. | ||
version: 2 | ||
name: NAME-OF-YOUR-BATCH-CHANGE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny comment, as a user I would find # "version" determines how the batch spec is interpreted
to be a bit mysterious. Maybe we could say
version: 2 # Use the latest schema version
name: ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This bumps sourcegraph/sourcegraph/lib to pull in the latest changes from https://github.com/sourcegraph/sourcegraph/pull/63613 to support the new
version
field for batch specs.Notes:
resolveWorkspacesForBatchSpec
, which takes the serialized spec. This means all the logic to resolve repos is outsourced to Sourcegraph. This is great news for this PR because we don't have to worry howon.RepositoriesMatchingQuery
is interpreted. The code path in which src-cli itself resolves the workspaces was removed in Remove src-cli workspace resolution #819.Test plan
src batch new -f test.spec.yaml
(-> spec containsversion: 2
)src batch apply -f test.spec.yaml
(-> validation passes, batch spec shows up in Sourcegraph db)src batch validate -f test.spec.yaml
(-> validation passes or fails if I change the version to an unsupported value)src batch repos -f test.spec.yaml
(-> checked that returned repos match with expected pattern type)Closes SPLF-126