Move embeddings service out of enterprise (#57291)

Mechanical code move to get another service out of enterprise.
This commit is contained in:
Erik Seliger 2023-10-04 00:47:10 +02:00 committed by GitHub
parent 21b99c7e0d
commit c3e9750ff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 21 additions and 21 deletions

View File

@ -404,7 +404,7 @@ load("//dev:oci_deps.bzl", "oci_deps")
oci_deps()
load("//enterprise/cmd/embeddings/shared:assets.bzl", "embbedings_assets_deps")
load("//cmd/embeddings/shared:assets.bzl", "embbedings_assets_deps")
embbedings_assets_deps()

View File

@ -7,10 +7,10 @@ load("//dev:oci_defs.bzl", "image_repository")
go_library(
name = "embeddings_lib",
srcs = ["main.go"],
importpath = "github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings",
importpath = "github.com/sourcegraph/sourcegraph/cmd/embeddings",
visibility = ["//visibility:private"],
deps = [
"//enterprise/cmd/embeddings/shared",
"//cmd/embeddings/shared",
"//internal/sanitycheck",
"//internal/service/svcmain",
],

View File

@ -1,7 +1,7 @@
package main
import (
"github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings/shared"
"github.com/sourcegraph/sourcegraph/cmd/embeddings/shared"
"github.com/sourcegraph/sourcegraph/internal/sanitycheck"
"github.com/sourcegraph/sourcegraph/internal/service/svcmain"
)

View File

@ -4,7 +4,7 @@ go_library(
name = "qa",
srcs = ["eval.go"],
embedsrcs = ["context_data.tsv"],
importpath = "github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings/qa",
importpath = "github.com/sourcegraph/sourcegraph/cmd/embeddings/qa",
visibility = ["//visibility:public"],
deps = [
"//internal/api",

View File

@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "embed_queries_lib",
srcs = ["main.go"],
importpath = "github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings/qa/embed_queries",
importpath = "github.com/sourcegraph/sourcegraph/cmd/embeddings/qa/embed_queries",
visibility = ["//visibility:private"],
deps = [
"//internal/conf",

View File

@ -11,7 +11,7 @@ go_library(
"search.go",
"service.go",
],
importpath = "github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings/shared",
importpath = "github.com/sourcegraph/sourcegraph/cmd/embeddings/shared",
visibility = ["//visibility:public"],
deps = [
"//cmd/frontend/globals",
@ -50,7 +50,7 @@ go_library(
)
# The filename specified by the out field needs to include the sha for the test to find it.
# See //enterprise/cmd/embeddings/shared:assets.bzl for the macro fetching those external dependencies.
# See //cmd/embeddings/shared:assets.bzl for the macro fetching those external dependencies.
copy_file(
name = "ln_test_data_embeddings_index",
src = "@github_com_sourcegraph_sourcegraph_embeddingindex//file:downloaded",
@ -58,7 +58,7 @@ copy_file(
allow_symlink = True,
)
# See //enterprise/cmd/embeddings/shared:assets.bzl for the macro fetching those external dependencies.
# See //cmd/embeddings/shared:assets.bzl for the macro fetching those external dependencies.
copy_file(
name = "ln_test_data_query_embeddings_gob",
src = "@query_embeddings_gob//file:downloaded",
@ -81,7 +81,7 @@ go_test(
":ln_test_data_query_embeddings_gob",
], # keep
deps = [
"//enterprise/cmd/embeddings/qa",
"//cmd/embeddings/qa",
"//internal/api",
"//internal/database/dbmocks",
"//internal/embeddings",

View File

@ -13,7 +13,7 @@ import (
"path/filepath"
"testing"
"github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings/qa"
"github.com/sourcegraph/sourcegraph/cmd/embeddings/qa"
"github.com/sourcegraph/sourcegraph/internal/api"
"github.com/sourcegraph/sourcegraph/internal/embeddings"
uploadstoremocks "github.com/sourcegraph/sourcegraph/internal/uploadstore/mocks"
@ -21,7 +21,7 @@ import (
)
// This embed is handled by Bazel, and using the traditional go test command will fail.
// See //enterprise/cmd/embeddings/shared:assets.bzl
// See //cmd/embeddings/shared:assets.bzl
//
//go:embed testdata/*
var fs embed.FS

View File

@ -92,7 +92,7 @@ pkg_tar(
DEPS = [
"//cmd/precise-code-intel-worker",
"//cmd/searcher",
"//enterprise/cmd/embeddings",
"//cmd/embeddings",
"//cmd/frontend",
"//cmd/gitserver",
"//enterprise/cmd/migrator",

View File

@ -7,6 +7,7 @@ go_library(
visibility = ["//visibility:private"],
deps = [
"//cmd/blobstore/shared",
"//cmd/embeddings/shared",
"//cmd/executor/singlebinary",
"//cmd/frontend/shared",
"//cmd/gitserver/shared",
@ -15,7 +16,6 @@ go_library(
"//cmd/searcher/shared",
"//cmd/sourcegraph/osscmd",
"//cmd/worker/shared",
"//enterprise/cmd/embeddings/shared",
"//enterprise/cmd/symbols/shared",
"//internal/sanitycheck",
"//internal/service",

View File

@ -10,6 +10,7 @@ import (
"github.com/sourcegraph/sourcegraph/internal/service/servegit"
blobstore_shared "github.com/sourcegraph/sourcegraph/cmd/blobstore/shared"
embeddings_shared "github.com/sourcegraph/sourcegraph/cmd/embeddings/shared"
executor_singlebinary "github.com/sourcegraph/sourcegraph/cmd/executor/singlebinary"
frontend_shared "github.com/sourcegraph/sourcegraph/cmd/frontend/shared"
gitserver_shared "github.com/sourcegraph/sourcegraph/cmd/gitserver/shared"
@ -17,7 +18,6 @@ import (
repoupdater_shared "github.com/sourcegraph/sourcegraph/cmd/repo-updater/shared"
searcher_shared "github.com/sourcegraph/sourcegraph/cmd/searcher/shared"
worker_shared "github.com/sourcegraph/sourcegraph/cmd/worker/shared"
embeddings_shared "github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings/shared"
symbols_shared "github.com/sourcegraph/sourcegraph/enterprise/cmd/symbols/shared"
"github.com/sourcegraph/sourcegraph/ui/assets"

View File

@ -19,7 +19,7 @@ allowed_prefix=(
github.com/sourcegraph/sourcegraph/enterprise/cmd/migrator
github.com/sourcegraph/sourcegraph/cmd/precise-code-intel-worker
github.com/sourcegraph/sourcegraph/enterprise/cmd/symbols
github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings
github.com/sourcegraph/sourcegraph/cmd/embeddings
# Doesn't connect but uses db internals for use with sqlite
github.com/sourcegraph/sourcegraph/cmd/symbols
# Transitively depends on zoekt package which imports but does not use DB

View File

@ -48,6 +48,7 @@ go_library(
importpath = "github.com/sourcegraph/sourcegraph/dev/sg",
visibility = ["//visibility:private"],
deps = [
"//cmd/embeddings/qa",
"//dev/sg/adr",
"//dev/sg/buf",
"//dev/sg/ci",
@ -78,7 +79,6 @@ go_library(
"//dev/sg/msp",
"//dev/sg/root",
"//dev/team",
"//enterprise/cmd/embeddings/qa",
"//internal/database",
"//internal/database/basestore",
"//internal/database/connections/live",

View File

@ -3,8 +3,8 @@ package main
import (
"github.com/urfave/cli/v2"
"github.com/sourcegraph/sourcegraph/cmd/embeddings/qa"
"github.com/sourcegraph/sourcegraph/dev/sg/internal/category"
"github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings/qa"
"github.com/sourcegraph/sourcegraph/lib/errors"
)

View File

@ -154,7 +154,7 @@ func bazelTest(targets ...string) func(*bk.Pipeline) {
bk.AllowDependencyFailure(),
bk.Agent("queue", "bazel"),
bk.Key("bazel-tests"),
bk.ArtifactPaths("./bazel-testlogs/enterprise/cmd/embeddings/shared/shared_test/*.log", "./command.profile.gz"),
bk.ArtifactPaths("./bazel-testlogs/cmd/embeddings/shared/shared_test/*.log", "./command.profile.gz"),
bk.AutomaticRetry(1), // TODO @jhchabran flaky stuff are breaking builds
}

View File

@ -254,12 +254,12 @@ commands:
export GCFLAGS='all=-N -l'
fi
go build -gcflags="$GCFLAGS" -o .bin/embeddings github.com/sourcegraph/sourcegraph/enterprise/cmd/embeddings
go build -gcflags="$GCFLAGS" -o .bin/embeddings github.com/sourcegraph/sourcegraph/cmd/embeddings
checkBinary: .bin/embeddings
watch:
- lib
- internal
- enterprise/cmd/embeddings
- cmd/embeddings
- internal/embeddings
qdrant:
cmd: |