diff --git a/.bazelignore b/.bazelignore index a53f3c835178..e135ef18dfcb 100644 --- a/.bazelignore +++ b/.bazelignore @@ -1,4 +1,6 @@ node_modules +schema/node_modules + client/branded/node_modules client/browser/node_modules client/build-config/node_modules @@ -17,8 +19,20 @@ client/storybook/node_modules client/template-parser/node_modules client/testing/node_modules client/web/node_modules +client/web-sveltekit/node_modules client/wildcard/node_modules client/vscode/node_modules dev/release/node_modules +client/plugin-backstage/node_modules +client/backstage-common/node_modules +client/backstage-backend/node_modules +client/backstage-frontend/node_modules cmd/symbols/squirrel/test_repos/starlark + +# generated and hosted in GCS bucket +cmd/sitemap +docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/ + +# temporary ignores +internal/cmd/progress-bot diff --git a/.bazelversion b/.bazelversion index adfd8609ed01..09b254e90c61 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.0.0rc3 +6.0.0 diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 7d571be51365..e3e97c70d64e 100755 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -27,14 +27,17 @@ mkdir -p ./annotations/ # asdf setup # ---------- -echo "~~~ Preparing asdf dependencies" - -if [[ "$BUILDKITE_STEP_KEY" == "pipeline-gen" ]]; then - echo "pipeline-gen step: running go install only" - asdf install golang -elif [[ "$BUILDKITE_STEP_KEY" == "pipeline-upload" ]]; then - echo "pipeline-upload step: skipping asdf install" -else - echo "running normal install" - ./dev/ci/asdf-install.sh + +if [[ "$BUILDKITE_AGENT_META_DATA_QUEUE" != "bazel" ]]; then + echo "~~~ Preparing asdf dependencies" + + if [[ "$BUILDKITE_STEP_KEY" == "pipeline-gen" ]]; then + echo "pipeline-gen step: running go install only" + asdf install golang + elif [[ "$BUILDKITE_STEP_KEY" == "pipeline-upload" ]]; then + echo "pipeline-upload step: skipping asdf install" + else + echo "running normal install" + ./dev/ci/asdf-install.sh + fi fi diff --git a/.eslintignore b/.eslintignore index f496c06e0d6e..53dae7ba10a4 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,3 +3,6 @@ src/schema/* src/graphql-operations.ts GH2SG.bookmarklet.js **/vendor/*.js +svelte.config.js +vite.config.ts +playwright.config.ts diff --git a/.eslintrc.js b/.eslintrc.js index da90a3fee6c2..211a76dc851a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -207,6 +207,11 @@ See https://handbook.sourcegraph.com/community/faq#is-all-of-sourcegraph-open-so message: "Spreading props can be unsafe. Prefer destructuring the props object, or continue only if you're sure.", }, + { + selector: 'ImportDeclaration[source.value="react-router"]', + message: + 'Use `react-router-dom-v5-compat` instead. We are in the process of migrating from react-router v5 to v6. More info https://github.com/sourcegraph/sourcegraph/issues/33834', + }, ], // https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#eslint 'react/jsx-uses-react': 'off', diff --git a/.github/test.CODEOWNERS b/.github/test.CODEOWNERS new file mode 100644 index 000000000000..7be5d62a8174 --- /dev/null +++ b/.github/test.CODEOWNERS @@ -0,0 +1,261 @@ +# Sourcegraph uses CODENOTIFY to make individuals or groups aware of changes that are happening in code they care about, +# without explicitly requiring those engineers to "own" the code. +# This is a test CODEOWNERS file generated from all the CODENOTIFY files in this repository. It is not intended as a +# move to use CODEOWNERS again, but rather to dogfood our Own product within Sourcegraph (hence the `.test` naming) + +.github/workflows/codenotify.yml @unknwon +.github/workflows/licenses-check.yml @bobheadxi +.github/workflows/licenses-update.yml @bobheadxi +.github/workflows/renovate-downstream.yml @bobheadxi +.github/workflows/renovate-downstream.json @bobheadxi + +client/branded/src/search-ui/components/** @limitedmage @fkling + +client/jetbrains/** @vdavid @philipp-spiess + +client/shared/src/search/**/* @fkling + +client/shared/src/search/query/**/* @fkling + +client/web/src/enterprise/batches/**/* @eseliger +client/web/src/enterprise/batches/**/* @courier-new +client/web/src/enterprise/batches/**/* @BolajiOlajide + +client/web/src/enterprise/code-monitoring/**/* @limitedmage + +client/web/src/enterprise/codeintel/**/* @efritz + +client/web/src/enterprise/executors/**/* @efritz +client/web/src/enterprise/executors/**/* @eseliger + +client/web/src/integration/batches* @eseliger +client/web/src/integration/batches* @courier-new +client/web/src/integration/batches* @BolajiOlajide +client/web/src/integration/search* @limitedmage +client/web/src/integration/code-monitoring* @limitedmage + +client/web/src/search/**/* @limitedmage @fkling + +cmd/blobstore/**/* @slimsag + +cmd/frontend/graphqlbackend/observability.go @bobheadxi +cmd/frontend/graphqlbackend/site_monitoring.go @bobheadxi +cmd/frontend/graphqlbackend/*search*.go @keegancsmith +cmd/frontend/graphqlbackend/*zoekt*.go @keegancsmith +cmd/frontend/graphqlbackend/batches.go @eseliger +cmd/frontend/graphqlbackend/batches.go @courier-new +cmd/frontend/graphqlbackend/insights.go @sourcegraph/code-insights-backend +cmd/frontend/graphqlbackend/codeintel.go @efritz +cmd/frontend/graphqlbackend/oobmigrations.go @efritz + +cmd/frontend/internal/search/** @keegancsmith +cmd/frontend/internal/search/**/* @camdencheek + +cmd/gitserver/server/* @indradhanush +cmd/gitserver/server/* @sashaostrikov + +cmd/repo-updater/* @indradhanush +cmd/repo-updater/* @sashaostrikov + +cmd/searcher/**/* @keegancsmith + +cmd/server/internal/goreman/** @keegancsmith + +cmd/server/internal/goremancmd/** @keegancsmith + +cmd/symbols/** @keegancsmith + +cmd/worker/**/* @efritz + +dev/authtest/**/* @unknwon + +dev/codeintel-qa/**/* @efritz + +dev/depgraph/**/* @efritz + +dev/gqltest/**/* @unknwon + +doc/**/admin/** @sourcegraph/delivery +doc/dev/background-information/adding_ping_data.md @ebrodymoore @dadlerj + +doc/batch_changes/**/* @eseliger +doc/batch_changes/**/* @courier-new + +doc/code_navigation/**/* @efritz + +doc/code_search/**/* @rvantonder + +doc/dev/adr/**/* @unknwon + +doc/dev/background-information/codeintel/**/* @efritz + +docker-images/cadvisor/**/* @bobheadxi + +docker-images/grafana/**/* @bobheadxi + +docker-images/postgres-12-alpine/**/* @sourcegraph/delivery + +docker-images/prometheus/**/* @bobheadxi + +enterprise/cmd/executor/**/* @efritz + +enterprise/cmd/frontend/internal/auth/**/* @unknwon + +enterprise/cmd/frontend/internal/authz/**/* @unknwon + +enterprise/cmd/frontend/internal/codeintel/**/* @efritz + +enterprise/cmd/frontend/internal/executorqueue/**/* @efritz +enterprise/cmd/frontend/internal/executorqueue/**/* @eseliger + +enterprise/cmd/frontend/internal/licensing/**/* @unknwon + +enterprise/cmd/migrator/**/* @efritz + +enterprise/cmd/precise-code-intel-worker/**/* @efritz + +enterprise/cmd/repo-updater/**/* @indradhanush + +enterprise/cmd/repo-updater/internal/authz/**/* @unknwon + +enterprise/cmd/worker/**/* @efritz + +enterprise/cmd/worker/internal/batches/**/* @eseliger + +enterprise/cmd/worker/internal/executorqueue/**/* @efritz +enterprise/cmd/worker/internal/executorqueue/**/* @eseliger + +enterprise/cmd/worker/internal/executors/**/* @efritz + +enterprise/dev/ci/**/* @bobheadxi + +enterprise/internal/authz/**/* @unknwon + +enterprise/internal/batches/**/* @eseliger + +enterprise/internal/cloud/**/* @unknwon @michaellzc + +enterprise/internal/codeintel/**/* @efritz +enterprise/internal/codeintel/**/* @Strum355 + +enterprise/internal/database/external_services* @unknwon +enterprise/internal/database/perms_store* @unknwon + +enterprise/internal/executor/**/* @efritz + +enterprise/internal/insights/**/* @sourcegraph/code-insights-backend + +enterprise/internal/license/**/* @unknwon + +enterprise/internal/licensing/**/* @unknwon + +internal/authz/**/* @unknwon + +internal/codeintel/**/* @efritz + +internal/codeintel/dependencies/**/* @mrnugget + +internal/database/external* @eseliger +internal/database/namespaces* @eseliger +internal/database/repos* @eseliger +internal/database/permissions* @BolajiOlajide +internal/database/user_roles* @BolajiOlajide +internal/database/roles* @BolajiOlajide +internal/database/role_permissions* @BolajiOlajide + +internal/database/basestore/**/* @efritz + +internal/database/batch/**/* @efritz + +internal/database/connections/**/* @efritz + +internal/database/dbconn/**/* @efritz + +internal/database/dbtest/**/* @efritz + +internal/database/dbutil/**/* @efritz + +internal/database/locker/**/* @efritz + +internal/database/migration/**/* @efritz + +internal/database/postgresdsn/**/* @efritz + +internal/debugserver/** @keegancsmith + +internal/diskcache/** @keegancsmith + +internal/endpoint/** @keegancsmith + +internal/env/baseconfig.go @efritz + +internal/extsvc/**/* @eseliger + +internal/extsvc/auth/**/* @unknwon + +internal/gitserver/* @indradhanush +internal/gitserver/* @sashaostrikov + +internal/goroutine/**/* @efritz + +internal/gqltestutil/**/* @unknwon + +internal/honey/** @keegancsmith + +internal/httpcli/** @keegancsmith + +internal/lazyregexp/** @keegancsmith + +internal/luasandbox/**/* @efritz + +internal/mutablelimiter/** @keegancsmith + +internal/observation/**/* @sourcegraph/dev-experience + +internal/oobmigration/**/* @efritz + +internal/rcache/** @keegancsmith + +internal/redispool/** @keegancsmith + +internal/repos/* @indradhanush +internal/repos/* @sashaostrikov + +internal/search/**/* @keegancsmith +internal/search/**/* @camdencheek + +internal/src-cli/**/* @eseliger +internal/src-cli/**/* @BolajiOlajide +internal/src-cli/**/* @courier-new + +internal/symbols/** @keegancsmith + +internal/sysreq/** @keegancsmith + +internal/trace/** @keegancsmith +internal/trace/**/* @sourcegraph/dev-experience + +internal/tracer/** @keegancsmith +internal/tracer/**/* @sourcegraph/dev-experience + +internal/usagestats/batches.go @eseliger +internal/usagestats/batches_test.go @eseliger +internal/usagestats/*codeintel*.go @efritz + +internal/vcs/** @keegancsmith + +internal/workerutil/**/* @efritz + +lib/codeintel/**/* @efritz + +lib/errors/**/* @sourcegraph/dev-experience + +lib/servicecatalog/**/* @sourcegraph/cloud +lib/servicecatalog/**/* @sourcegraph/security + +monitoring/**/* @bobheadxi +monitoring/**/* @slimsag +monitoring/**/* @sourcegraph/delivery +monitoring/frontend.go @efritz +monitoring/precise_code_intel_* @efritz +monitoring/precise_code_intel_* @sourcegraph/code-intelligence \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4e4e8e8708f3..73684663a2fd 100644 --- a/.gitignore +++ b/.gitignore @@ -184,3 +184,8 @@ go.work.sum # SCIP index.scip + +# Buildkite helper and cache files +/an +/tr +/cache-*.tar diff --git a/.golangci-warn.yml b/.golangci-warn.yml index b568af2fb4fb..ae9cf4d9f630 100644 --- a/.golangci-warn.yml +++ b/.golangci-warn.yml @@ -47,10 +47,3 @@ run: - main.go # In ./internal/cmd/progress-bot - main.go - # In ./internal/cmd/resources-report - - aws.go - - gcp.go - - main.go - - resource.go - - sheets.go - - slack.go diff --git a/.golangci.yml b/.golangci.yml index d47a0c127f9e..905de8f44b06 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -97,10 +97,3 @@ run: - main.go # In ./internal/cmd/progress-bot - main.go - # In ./internal/cmd/resources-report - - aws.go - - gcp.go - - main.go - - resource.go - - sheets.go - - slack.go diff --git a/.npmrc b/.npmrc index 46e09f733a8a..1eaf028a47d0 100644 --- a/.npmrc +++ b/.npmrc @@ -15,8 +15,4 @@ public-hoist-pattern[]=global # We have to hoist eslint packages to use them in the `.eslintrc` config. public-hoist-pattern[]=*eslint* -# npm_translate_lock with the yarn.lock file will complain about missing/incorrect peer dependencies. -# Temporarily ignore warnings until we switch to pnpm and can user pnpm.packageExtensions to fix them. -# https://pnpm.io/package_json#pnpmpackageextensions auto-install-peers=true -strict-peer-dependencies=false diff --git a/.prettierignore b/.prettierignore index feb34b90d54d..9d15cbd90aaf 100644 --- a/.prettierignore +++ b/.prettierignore @@ -16,6 +16,7 @@ vendor/ .nyc_output/ out/ dist/ +dist-types/ client/shared/src/schema/*.d.ts ts-node-* testdata @@ -37,7 +38,10 @@ cmd/symbols/squirrel/language-file-extensions.json client/jetbrains/build client/jetbrains/.idea client/jetbrains/.gradle +client/backstage-common/node_modules .browserslistrc code-intel-extensions.json .direnv pnpm-lock.yaml +node_modules/ +client/web-sveltekit/.svelte-kit diff --git a/.stylelintignore b/.stylelintignore index bb4bb19c8b66..5f53a866febf 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -5,3 +5,4 @@ **/*.svg node_modules/ __mocks__/ +client/backstage-common diff --git a/.tool-versions b/.tool-versions index b9c11e3671db..d26994cf848f 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,6 +1,6 @@ golang 1.19.3 nodejs 16.18.1 -fd 7.4.0 +fd 8.6.0 shfmt 3.5.0 shellcheck 0.7.1 kubectl 1.21.7 diff --git a/.vscode/settings.json b/.vscode/settings.json index d7ba725dbe28..52b51d5b3b1a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -37,7 +37,7 @@ "build.allowImplicitNetworkAccess": true, "local": "github.com/sourcegraph/sourcegraph" }, - "jest.jestCommandLine": "pnpm test", + "jest.jestCommandLine": "pnpm run test", "jest.showCoverageOnLoad": false, "gulp.autoDetect": "off", "npm.packageManager": "pnpm", @@ -71,5 +71,6 @@ }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" - } + }, + "cody.codebase": "github.com/sourcegraph/sourcegraph" } diff --git a/BUILD.bazel b/BUILD.bazel index 4cc292ef4390..7d71ec8bfa27 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,3 +1,4 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@npm//:defs.bzl", "npm_link_all_packages") load("@aspect_rules_js//js:defs.bzl", "js_library") load("@aspect_rules_ts//ts:defs.bzl", "ts_config") @@ -6,7 +7,6 @@ load("@aspect_rules_ts//ts:defs.bzl", "ts_config") # # gazelle:prefix github.com/sourcegraph/sourcegraph # gazelle:build_file_name BUILD.bazel - # Disable some by default, only include configured BUILDs # # gazelle:aspect_js disabled @@ -29,6 +29,84 @@ ts_config( visibility = ["//visibility:public"], deps = [ "//:node_modules/@sourcegraph/tsconfig", - "//:tsconfig.json", + "//:tsconfig.base.json", + ], +) + +load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary") + +gazelle_binary( + name = "gazelle-buf", + languages = [ + # Loads the native proto extension + "@bazel_gazelle//language/proto:go_default_library", + # Gazelle-buf does not include the Go plugin by default, so we have to add it + # ourselves. + "@bazel_gazelle//language/go:go_default_library", + # Loads the Buf extension + "@rules_buf//gazelle/buf:buf", + # NOTE: This needs to be loaded after the proto language + ], +) + +# Tell gazelle what is our main module +# gazelle:prefix github.com/sourcegraph/sourcegraph + +# Specify which protoc compilers we want when we detect GRPC service definitions. +# gazelle:go_grpc_compilers //:gen-go-grpc,@io_bazel_rules_go//proto:go_proto + +gazelle( + name = "gazelle", + gazelle = ":gazelle-buf", +) + +go_library( + name = "sourcegraph", + srcs = [ + "doc.go", + "gen.go", ], + importpath = "github.com/sourcegraph/sourcegraph", ) + +gazelle( + name = "gazelle-update-repos", + args = [ + "-from_file=go.mod", + "-to_macro=deps.bzl%go_dependencies", + "-prune", + "-build_file_proto_mode=disable_global", + ], + command = "update-repos", +) + +load("@io_bazel_rules_go//proto/wkt:well_known_types.bzl", "WELL_KNOWN_TYPES_APIV2") +load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler") + +# Because the current implementation of rules_go uses the old protoc grpc compiler, we have to declare our own, and declare it manually in the build files. +# See https://github.com/bazelbuild/rules_go/issues/3022 +go_proto_compiler( + name = "gen-go-grpc", + plugin = "@org_golang_google_grpc_cmd_protoc_gen_go_grpc//:protoc-gen-go-grpc", + suffix = "_grpc.pb.go", + valid_archive = False, + visibility = ["//visibility:public"], + deps = WELL_KNOWN_TYPES_APIV2 + [ + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + ], +) + +js_library( + name = "postcss_config_js", + srcs = ["postcss.config.js"], + deps = [ + "//:node_modules/autoprefixer", + "//:node_modules/postcss-custom-media", + "//:node_modules/postcss-focus-visible", + "//:node_modules/postcss-inset", + ], +) + +exports_files(["go.mod"]) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2df95c35009..409d9083a1bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,72 @@ All notable changes to Sourcegraph are documented in this file. - Connection checks for code host connections have been changed to talk to code host APIs directly via HTTP instead of doing DNS lookup and TCP dial. That makes them more resistant in environments where proxies are used. [#46918](https://github.com/sourcegraph/sourcegraph/pull/46918) - The search query input overflow behavior on search home page has been fixed. [#46922](https://github.com/sourcegraph/sourcegraph/pull/46922) +## 4.5.0 + +### Added + +- Endpoint environment variables (`SEARCHER_URL`, `SYMBOLS_URL`, `INDEXED_SEARCH_SERVERS`, `SRC_GIT_SERVERS`) now can be set to replica count values in Kubernetes, Kustomize, Helm and Docker Compose environments. This avoids the need to use service discovery or generating the respective list of addresses in those environments. [#45862](https://github.com/sourcegraph/sourcegraph/pull/45862) +- The default author and email for changesets will now be pulled from user account details when possible. [#46385](https://github.com/sourcegraph/sourcegraph/pull/46385) +- Code Insights has a new display option: "Max number of series points to display". This setting controls the number of data points you see per series on an insight. [#46653](https://github.com/sourcegraph/sourcegraph/pull/46653) +- Added out-of-band migration that will migrate all existing data from LSIF to SCIP (see additional [migration documentation](https://docs.sourcegraph.com/admin/how-to/lsif_scip_migration)). [#45106](https://github.com/sourcegraph/sourcegraph/pull/45106) +- Code Insights has a new search-powered repositories field that allows you to select repositories with Sourcegraph search syntax. [#45687](https://github.com/sourcegraph/sourcegraph/pull/45687) +- You can now export all data for a Code Insight from the card menu or the standalone page. [#46795](https://github.com/sourcegraph/sourcegraph/pull/46795), [#46694](https://github.com/sourcegraph/sourcegraph/pull/46694) +- Added Gerrit as an officially supported code host with permissions syncing. [#46763](https://github.com/sourcegraph/sourcegraph/pull/46763) +- Markdown files now support `` and `