You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug: only require CI=true and AccessToken when making API requests (#1278)
* check when inCI and whether we required Access Token
* fast fail in APIClient when CI=true and no Access Token
* use apiClient constructor in search_jobs
* fail fast in login / auth token when CI=true and AccessToken not set
* add comment
* review feedback
- rename `RequireAccessToken` to `checkIfCIAccessTokenRequired`
- provide more context in error on why it happened
* use sentinel error
* use lib errors
(cherry picked from commit 0e5e006)
fmt.Fprintf(p.out, "⚠️ Warning: Configuring src with a JSON file is deprecated. Please migrate to using the env vars SRC_ENDPOINT, SRC_ACCESS_TOKEN, and SRC_PROXY instead, and then remove %s. See https://github.com/sourcegraph/src-cli#readme for more information.\n", p.cfg.ConfigFilePath)
Copy file name to clipboardExpand all lines: cmd/src/main.go
+25-12Lines changed: 25 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,7 @@ var (
83
83
84
84
errConfigMerge=errors.New("when using a configuration file, zero or all environment variables must be set")
85
85
errConfigAuthorizationConflict=errors.New("when passing an 'Authorization' additional headers, SRC_ACCESS_TOKEN must never be set")
86
-
errCIAccessTokenRequired=errors.New("SRC_ACCESS_TOKEN must be set in CI")
86
+
errCIAccessTokenRequired=errors.New("CI is true and SRC_ACCESS_TOKEN is not set or empty. When running in CI OAuth tokens cannot be used, only SRC_ACCESS_TOKEN. Either set CI=false or define a SRC_ACCESS_TOKEN")
0 commit comments