-
Notifications
You must be signed in to change notification settings - Fork 64
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
Validate: add ability to expand src validate
commands for future health check functionality
#921
Conversation
To support expansion of the validate command, the current validate functionality will need to be moved to a new subcommand. * Use existing internal api package for graphql requests * Remove create first admin features * Refactor configuration structs to support multiple code hosts in future * Add cool emoji to output * Add insight test cleanup
Github access token is needed for new validate command. Add token to config.
* Move 'src validate' functionality into 'srv validate install' commmand to allow for more validate subcommands.
Update YAML and JSON configuration specifications to reflect changes in [#921](sourcegraph/src-cli#921)
* An auth token is required for code hosts when using `src validate install`, warn user and exit if not set.
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.
I like how nice the output looks!
Idea: In addition to the current output, I think it'd be nice to show the services each task are related to, so that if one of test fails, the user will know what to look into?
internal/validate/install.go
Outdated
// DefaultConfig returns a default configuration to be used for testing. | ||
func DefaultConfig() *ValidationSpec { | ||
return &ValidationSpec{ | ||
SearchQuery: []string{"repo:^github\\.com/gorilla/mux$ Router", "repo:^github\\.com/gorilla/mux$@v1.8.0 Router"}, |
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 great! On top of performing an indexed search and unindexed search, do you think it'd be helpful to add a default symbol search (confirm connection to the symbol service)?
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.
Yeah, thats a good idea!
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.
Just added a symbol search to the defaults, should be gtg.
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.
I just noticed https://github.com/gorilla/mux has been archive so the search queries will no longer work. We might want to use another repo for default
* Change default queries to use sourcegraph/src-cli repo instead of gorilla/mux
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.
yay thanks for the quick update! LGTM!
…command (#46397) * Update YAML and JSON config specs Update YAML and JSON configuration specifications to reflect changes in [#921](sourcegraph/src-cli#921) * Update examples with new `src validate` command * Fix formatting issues * Fix spelling
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.
Late to the party but this looks great!
…alth check functionality (#921) * Refactor validate functionality into pkg To support expansion of the validate command, the current validate functionality will need to be moved to a new subcommand. * Use existing internal api package for graphql requests * Remove create first admin features * Refactor configuration structs to support multiple code hosts in future * Add cool emoji to output * Add insight test cleanup * Add env vars for Github access token Github access token is needed for new validate command. Add token to config. * Add 'src validate install' command * Move 'src validate' functionality into 'srv validate install' commmand to allow for more validate subcommands. * Change validation API to be more specific * Change SRC_GITHUB_TOKEN to only be read if needed for command * Update CHANGELOG.md * Add warning if SRC_GITHUB_TOKEN isn't set * An auth token is required for code hosts when using `src validate install`, warn user and exit if not set. * Remove unused deps * Separate tasks being performed * Add symbol search to default queries * Change default queries to use sourcegraph/src-cli repo instead of gorilla/mux
To support expansion of the
src validate
command with new health check features, the validate command needs to be broken down into subcommands.This PR moves the current
src validate
command tosrc validate install
as this command validates a Sourcegraph installation is setup and working correctly. Additional changes and features are listed below:internal/api
package for GraphQL queriessrc validate
currently only supports GitHub, but adding additional code hosts such as GitLab is now much easier.TODO:
Test plan
Locally tested changes using latest Sourcegraph Helm install. Tested default configuration if no YAML is provided, YAML configuration provided, and JSON configuration provided.
go test ./...
- all tests passingstaticcheck ./...
- no issues found in new codeExample YAML file used:
Example JSON file used: