mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 20:31:48 +00:00
See [RFC 885 Sourcegraph Enterprise Portal (go/enterprise-portal)](https://docs.google.com/document/d/1tiaW1IVKm_YSSYhH-z7Q8sv4HSO_YJ_Uu6eYDjX7uU4/edit#heading=h.tdaxc5h34u7q) - closes CORE-6. The only files requiring in-depth review are the `.proto` files, as everything else is generated: - `lib/enterpriseportal/subscriptions/v1/subscriptions.proto` - `lib/enterpriseportal/codyaccess/v1/codyaccess.proto` This PR only introduces API definitions - implementation will come as subsequent PRs, tracked in the ["Launch Enterprise Portal" Linear project](https://linear.app/sourcegraph/project/launch-sourcegraph-enterprise-portal-ee5d9ea105c2). Before reviewing the diffs, **please review this PR description in depth**. ### Design goals This initial schema aims to help achieve CORE-97 by adding our initial "get subscription Cody access", as well our general Stage 1 goal of providing read-only access to our existing enterprise subscription mechanisms. In doing so, we can start to reshape the API in a way that accommodates future growth and addresses some debt we have accumulated over time, before the Stage 2 goal of having the new Enterprise Portal be the source-of-truth for all things subscriptions. I am also aiming for a conservative approach with the Cody Gateway access related RPCs, to ease migration risks and allow for Cody teams to follow up quickly with more drastic changes in a V2 of the service after a Core-Services-driven migration to use the new service: https://github.com/sourcegraph/sourcegraph/pull/62263#issuecomment-2101874114 ### Design overview - **Multiple services**: Enterprise Portal aims to be the home of most Enterprise-related subscription and access management, but each component should be defined as a separate service to maintain clear boundaries between "core" capabilities and future extensions. One problem we see in the `dotcom { productSubscriptions }` is the embedding of additional concepts like Cody Gateway access makes the API surface unwieldy and brittle, and encourages an internal design that bundles everything together (the `product_subscriptions` table has 10 `cody_gateway_*` columns today). More concretely, this PR designs 2 services that Enterprise Portal will implement: - `EnterprisePortalSubscriptionsService` (`subscriptions.proto`): subscriptions and licenses CRUD - `EnterprisePortalCodyGatewayService` (`codygateway.proto`): Enterprise Cody Gateway access - **Multiple protocols**: We use [ConnectRPC](https://connectrpc.com/) to generate traditional gRPC handlers for service-to-service use, but also a plain HTTP/1 "REST"-ish protocol (the ["Connect Protocol"](https://connectrpc.com/docs/protocol)) that works for web clients and simple integrations. Go bindings for the Connect protocol are generated into the `v1connect` subpackages. - **Future licensing model/mechanism changes**: The _Subscription_ model is designed to remain static, but _Licenses_ are designed to accommodate future changes -`EnterpriseSubscriptionLicenseType` and `EnterpriseSubscriptionLicense` in this PR describe only the current type of license, referred to as "classic licenses", but we can extend this in the future for e.g. new models (refreshable licenses?) or new products (Cody-only? PLG enterprise?), or existing problems (test instance licenses?) - **Granular history**: Instead of a `createdAt`, `isArchived`, `revokedAt` and and so on, the new API defines Kubernetes-style `conditions` for licenses and subscriptions to describe creation, archival, and revocation events respectively, and can be more flexibly extended for future events and a lightweight audit log of major changes to a subscription or license. In particular, `revokedAt` already has a `revokedReason` - this allows us to extend these important events with additional metadata in a flexible manner. - **Pagination**: I couldn't find a shared internal or off-the-shelf representation of pagination attributes, but each `List*` RPC describes `page_size`, `page_token`, and `next_page_token` - **Querying/filtering**: I couldn't find a strong standard for this either, but in general: - `Get*` accepts `query` that is a `oneof`, with the goal of providing exact matches only. - `List*` accepts `repeated filter`, where each `filter` is a `oneof` a set of strategies relevant to a particular `List*` RPC. Multiple filters are treated as `AND`-concatenated. Some major changes from the existing model: - **Downgrade the concept of "subscription access token"**: this was built for Cody Gateway but I am not sure it has aged well, as the mechanism is still tied to individual licenses, did not find new non-Cody-Gateway use cases (except for license checks, though those do not require an "access token" model either), and today are still not "true" access tokens as they cannot be expired/managed properly. This PR relegates the concept to remain Cody-specific as it effectively is today so that we might be able to introduce a better subscription-wide model if the use case arises. Over time, we may want to make this even more opaque, relying entirely on zero-config instead (generating from license keys). - **Subscriptions are no longer attached to a single dotcom user**: Most of these users today are not real users anyway, as our license creation process asks that you create a fake user account (["User account: [...] We create a company-level account for this."](https://handbook.sourcegraph.com/departments/technical-success/ce/process/license_keys/#license-key-mechanics)). The new API removes the concept entirely, in favour of a true user access management system in CORE-102. - **Database/GraphQL IDs** are no longer exposed - we use external, prefixed UUIDs for representing entities over APIs in a universal manner. - **Per-subscription Cody Gateway access no longer exposes `allowed models`**: I suggested this to @rafax in light of recent problems with propagating new models to Enterprise customers. He agreed that the general product direction is "model options as a selling point" - it no longer makes sense to configure these at a per-subscription level. Instead, the Cody Gateway service should configure globally allowed models directly, and each Sourcegraph instance can determine what models they trust. If we really need this back we can add it later, but for now I think this removal is the right direction. ### Direct translations `cmd/cody-gateway/internal/dotcom/operations.graphql` defines our key dependencies for achieving CORE-97. The concepts referred in `operations.graphql` translate to this new API as follows: - `dotcom { productSubscriptionByAccessToken(accessToken) }`: `codygateway.v1.GetCodyGatewayAccess({ access_token })` - `dotcom { productSubscriptions }`: `codygateway.v1.ListCodyGatewayAccess()` - `fragment ProductSubscriptionState`: - `id`: **n/a** - `uuid`: `subscriptions.v1.EnterpriseSubscription.id` - `account { username }`: `subscriptions.v1.EnterpriseSubscription.display_name` - `isArchived`: `subscriptions.v1.EnterpriseSubscription.conditions` - `codyGatewayAccess { ... }`: **separate RPC to `codygateway.v1.GetCodyGatewayAccess`** - `activeLicense { ... }`: **separate RPC to `subscriptions.v1.ListEnterpriseSubscriptionLicenses`** ### Why `lib/enterpriseportal`? We recently had to move another Telemetry Gateway to `lib`: #62061. Inevitably, there will be services that live outside the monorepo that want to integrate with Enterprise Portal (one is on our roadmap: Cody Analytics in https://github.com/sourcegraph/cody-analytics). This allows us to share generated bindings and some useful helpers, while keeping things in the monorepo. ### Implications for Cody Clients For now (and in the future), nothing is likely to change. Here's how I imagine things playing out: ```mermaid graph TD cc["Cody Clients"] -- unified API --> cg[services like Cody Gateway] cg -- PLG users --> ssc[Self-Serve Cody] cg -- Enterprise users --> ep[Enterprise Portal] ``` ## Test plan CI passes, the schemas can be generated by hand: ``` sg gen buf \ lib/enterpriseportal/subscriptions/v1/buf.gen.yaml \ lib/enterpriseportal/codyaccess/v1/buf.gen.yaml ``` --------- Co-authored-by: Joe Chen <joe@sourcegraph.com> Co-authored-by: Chris Smith <chrsmith@users.noreply.github.com>
539 lines
18 KiB
Python
539 lines
18 KiB
Python
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
|
|
http_archive(
|
|
name = "platforms",
|
|
sha256 = "5eda539c841265031c2f82d8ae7a3a6490bd62176e0c038fc469eabf91f6149b",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.9/platforms-0.0.9.tar.gz",
|
|
"https://github.com/bazelbuild/platforms/releases/download/0.0.9/platforms-0.0.9.tar.gz",
|
|
],
|
|
)
|
|
|
|
load("@platforms//host:extension.bzl", "host_platform_repo")
|
|
|
|
host_platform_repo(name = "host_platform")
|
|
|
|
http_archive(
|
|
name = "bazel_skylib",
|
|
sha256 = "66ffd9315665bfaafc96b52278f57c7e2dd09f5ede279ea6d39b2be471e7e3aa",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
|
|
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
|
|
],
|
|
)
|
|
|
|
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
|
|
|
bazel_skylib_workspace()
|
|
|
|
http_archive(
|
|
name = "aspect_bazel_lib",
|
|
sha256 = "f2c1f91cc0a55f7a44c94b8a79974f21349b844075740c01045acaa49e731307",
|
|
strip_prefix = "bazel-lib-1.40.3",
|
|
url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.40.3/bazel-lib-v1.40.3.tar.gz",
|
|
)
|
|
|
|
# rules_js defines an older rules_nodejs, so we override it here
|
|
http_archive(
|
|
name = "rules_nodejs",
|
|
sha256 = "162f4adfd719ba42b8a6f16030a20f434dc110c65dc608660ef7b3411c9873f9",
|
|
strip_prefix = "rules_nodejs-6.0.2",
|
|
url = "https://github.com/bazelbuild/rules_nodejs/releases/download/v6.0.2/rules_nodejs-v6.0.2.tar.gz",
|
|
)
|
|
|
|
http_archive(
|
|
name = "aspect_rules_js",
|
|
sha256 = "76a04ef2120ee00231d85d1ff012ede23963733339ad8db81f590791a031f643",
|
|
strip_prefix = "rules_js-1.34.1",
|
|
url = "https://github.com/aspect-build/rules_js/releases/download/v1.34.1/rules_js-v1.34.1.tar.gz",
|
|
)
|
|
|
|
http_archive(
|
|
name = "aspect_rules_ts",
|
|
sha256 = "c77f0dfa78c407893806491223c1264c289074feefbf706721743a3556fa7cea",
|
|
strip_prefix = "rules_ts-2.2.0",
|
|
url = "https://github.com/aspect-build/rules_ts/releases/download/v2.2.0/rules_ts-v2.2.0.tar.gz",
|
|
)
|
|
|
|
http_archive(
|
|
name = "aspect_rules_swc",
|
|
sha256 = "8eb9e42ed166f20cacedfdb22d8d5b31156352eac190fc3347db55603745a2d8",
|
|
strip_prefix = "rules_swc-1.1.0",
|
|
url = "https://github.com/aspect-build/rules_swc/releases/download/v1.1.0/rules_swc-v1.1.0.tar.gz",
|
|
)
|
|
|
|
http_archive(
|
|
name = "io_bazel_rules_go",
|
|
sha256 = "af47f30e9cbd70ae34e49866e201b3f77069abb111183f2c0297e7e74ba6bbc0",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.47.0/rules_go-v0.47.0.zip",
|
|
"https://github.com/bazelbuild/rules_go/releases/download/v0.47.0/rules_go-v0.47.0.zip",
|
|
],
|
|
)
|
|
|
|
http_archive(
|
|
name = "rules_proto",
|
|
sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd",
|
|
strip_prefix = "rules_proto-5.3.0-21.7",
|
|
urls = [
|
|
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz",
|
|
],
|
|
)
|
|
|
|
http_archive(
|
|
name = "rules_proto_grpc",
|
|
sha256 = "9ba7299c5eb6ec45b6b9a0ceb9916d0ab96789ac8218269322f0124c0c0d24e2",
|
|
strip_prefix = "rules_proto_grpc-4.5.0",
|
|
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/releases/download/4.5.0/rules_proto_grpc-4.5.0.tar.gz"],
|
|
)
|
|
|
|
http_archive(
|
|
name = "rules_buf",
|
|
sha256 = "bc2488ee497c3fbf2efee19ce21dceed89310a08b5a9366cc133dd0eb2118498",
|
|
strip_prefix = "rules_buf-0.2.0",
|
|
urls = [
|
|
"https://github.com/bufbuild/rules_buf/archive/refs/tags/v0.2.0.zip",
|
|
],
|
|
)
|
|
|
|
http_archive(
|
|
name = "bazel_gazelle",
|
|
integrity = "sha256-MpOL2hbmcABjA1R5Bj2dJMYO2o15/Uc5Vj9Q0zHLMgk=",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
|
|
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
|
|
],
|
|
)
|
|
|
|
http_archive(
|
|
name = "rules_rust",
|
|
integrity = "sha256-ZQGWDD5NoySV0eEAfe0HaaU0yxlcMN6jaqVPnYo/A2E=",
|
|
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.38.0/rules_rust-v0.38.0.tar.gz"],
|
|
)
|
|
|
|
# Container rules
|
|
http_archive(
|
|
name = "rules_oci",
|
|
patch_args = ["-p1"],
|
|
patches = [
|
|
"//third_party/rules_oci:no_xattr.patch",
|
|
],
|
|
sha256 = "d41d0ba7855f029ad0e5ee35025f882cbe45b0d5d570842c52704f7a47ba8668",
|
|
strip_prefix = "rules_oci-1.4.3",
|
|
url = "https://github.com/bazel-contrib/rules_oci/releases/download/v1.4.3/rules_oci-v1.4.3.tar.gz",
|
|
)
|
|
|
|
http_archive(
|
|
name = "rules_pkg",
|
|
sha256 = "8c20f74bca25d2d442b327ae26768c02cf3c99e93fad0381f32be9aab1967675",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.8.1/rules_pkg-0.8.1.tar.gz",
|
|
"https://github.com/bazelbuild/rules_pkg/releases/download/0.8.1/rules_pkg-0.8.1.tar.gz",
|
|
],
|
|
)
|
|
|
|
http_archive(
|
|
name = "container_structure_test",
|
|
sha256 = "42edb647b51710cb917b5850380cc18a6c925ad195986f16e3b716887267a2d7",
|
|
strip_prefix = "container-structure-test-104a53ede5f78fff72172639781ac52df9f5b18f",
|
|
urls = ["https://github.com/GoogleContainerTools/container-structure-test/archive/104a53ede5f78fff72172639781ac52df9f5b18f.zip"],
|
|
)
|
|
|
|
http_archive(
|
|
name = "buildifier_prebuilt",
|
|
sha256 = "8ada9d88e51ebf5a1fdff37d75ed41d51f5e677cdbeafb0a22dda54747d6e07e",
|
|
strip_prefix = "buildifier-prebuilt-6.4.0",
|
|
urls = ["https://github.com/keith/buildifier-prebuilt/archive/6.4.0.tar.gz"],
|
|
)
|
|
|
|
http_archive(
|
|
name = "aspect_cli",
|
|
repo_mapping = {
|
|
"@com_github_smacker_go_tree_sitter": "@aspectcli-com_github_smacker_go_tree_sitter",
|
|
},
|
|
sha256 = "045f0186edb25706dfe77d9c4916eec630a2b2736f9abb59e37eaac122d4b771",
|
|
strip_prefix = "aspect-cli-5.8.20",
|
|
url = "https://github.com/aspect-build/aspect-cli/archive/5.8.20.tar.gz",
|
|
)
|
|
|
|
load("@aspect_bazel_lib//lib:repositories.bzl", "register_expand_template_toolchains", "register_jq_toolchains")
|
|
|
|
register_jq_toolchains()
|
|
|
|
register_expand_template_toolchains()
|
|
|
|
http_archive(
|
|
name = "rules_apko",
|
|
patch_args = ["-p1"],
|
|
patches = [
|
|
# required due to https://github.com/chainguard-dev/apko/issues/1052
|
|
"//third_party/rules_apko:repository_label_strip.patch",
|
|
# required until a release contains https://github.com/chainguard-dev/rules_apko/pull/53
|
|
"//third_party/rules_apko:apko_run_runfiles_path.patch",
|
|
# symlinking the lockfile appears to be problematic in CI https://github.com/sourcegraph/sourcegraph/pull/61877
|
|
"//third_party/rules_apko:copy_dont_symlink_lockfile.patch",
|
|
],
|
|
sha256 = "f176171f95ee2b6eef1572c6da796d627940a1e898a32d476a2d7a9a99332960",
|
|
strip_prefix = "rules_apko-1.2.2",
|
|
url = "https://github.com/chainguard-dev/rules_apko/releases/download/v1.2.2/rules_apko-v1.2.2.tar.gz",
|
|
)
|
|
|
|
# hermetic_cc_toolchain setup ================================
|
|
HERMETIC_CC_TOOLCHAIN_VERSION = "v2.2.1"
|
|
|
|
# Please note that we only use hermetic-cc for local development purpose and Nix, at it eases the path to cross-compile
|
|
# so we can produce container images locally on Mac laptops.
|
|
#
|
|
# @jhchabran See https://github.com/sourcegraph/sourcegraph/pull/55969, there is an ongoing issue with UBSAN
|
|
# and treesitter, that breaks the compilation of syntax-highlighter. Since we only use
|
|
# hermetic_cc for local development purposes, while it's a bit heavy handed for a --copt, it's acceptable
|
|
# at this point. Passing --copt=-fno-sanitize=undefined sadly doesn't fix the problem, which is why
|
|
# we have to patch to inject the flag.
|
|
http_archive(
|
|
name = "hermetic_cc_toolchain",
|
|
patch_args = ["-p1"],
|
|
patches = [
|
|
"//third_party/hermetic_cc:disable_ubsan.patch",
|
|
],
|
|
sha256 = "3b8107de0d017fe32e6434086a9568f97c60a111b49dc34fc7001e139c30fdea",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/uber/hermetic_cc_toolchain/releases/download/{0}/hermetic_cc_toolchain-{0}.tar.gz".format(HERMETIC_CC_TOOLCHAIN_VERSION),
|
|
"https://github.com/uber/hermetic_cc_toolchain/releases/download/{0}/hermetic_cc_toolchain-{0}.tar.gz".format(HERMETIC_CC_TOOLCHAIN_VERSION),
|
|
],
|
|
)
|
|
|
|
# rules_js setup ================================
|
|
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
|
|
|
|
rules_js_dependencies()
|
|
|
|
# node toolchain setup ==========================
|
|
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
|
|
|
|
nodejs_register_toolchains(
|
|
name = "nodejs",
|
|
node_version = "20.8.0",
|
|
)
|
|
|
|
# rules_js npm setup ============================
|
|
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
|
|
|
|
npm_translate_lock(
|
|
name = "npm",
|
|
npm_package_target_name = "{dirname}_pkg",
|
|
npmrc = "//:.npmrc",
|
|
pnpm_lock = "//:pnpm-lock.yaml",
|
|
# Required for ESLint test targets.
|
|
# See https://github.com/aspect-build/rules_js/issues/239
|
|
# See `public-hoist-pattern[]=*eslint*` in the `.npmrc` of this monorepo.
|
|
public_hoist_packages = {
|
|
"@typescript-eslint/eslint-plugin": [""],
|
|
"@typescript-eslint/parser@5.56.0_qxbo2xm47qt6fxnlmgbosp4hva": [""],
|
|
"eslint-config-prettier": [""],
|
|
"eslint-plugin-ban": [""],
|
|
"eslint-plugin-etc": [""],
|
|
"eslint-plugin-import": [""],
|
|
"eslint-plugin-jest-dom": [""],
|
|
"eslint-plugin-jsdoc": [""],
|
|
"eslint-plugin-jsx-a11y": [""],
|
|
"eslint-plugin-react@7.32.1_eslint_8.34.0": [""],
|
|
"eslint-plugin-react-hooks": [""],
|
|
"eslint-plugin-rxjs": [""],
|
|
"eslint-plugin-unicorn": [""],
|
|
"eslint-plugin-unused-imports": [""],
|
|
"eslint-import-resolver-node": [""],
|
|
},
|
|
verify_node_modules_ignored = "//:.bazelignore",
|
|
)
|
|
|
|
# rules_ts npm setup ============================
|
|
load("@npm//:repositories.bzl", "npm_repositories")
|
|
|
|
npm_repositories()
|
|
|
|
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")
|
|
|
|
rules_ts_dependencies(ts_version = "4.9.5")
|
|
|
|
# rules_swc setup ==============================
|
|
load("@aspect_rules_swc//swc:dependencies.bzl", "rules_swc_dependencies")
|
|
|
|
rules_swc_dependencies()
|
|
|
|
load("@aspect_rules_swc//swc:repositories.bzl", "LATEST_SWC_VERSION", "swc_register_toolchains")
|
|
|
|
swc_register_toolchains(
|
|
name = "swc",
|
|
swc_version = LATEST_SWC_VERSION,
|
|
)
|
|
|
|
# rules_esbuild setup ===========================
|
|
http_archive(
|
|
name = "aspect_rules_esbuild",
|
|
sha256 = "84419868e43c714c0d909dca73039e2f25427fc04f352d2f4f7343ca33f60deb",
|
|
strip_prefix = "rules_esbuild-0.15.3",
|
|
url = "https://github.com/aspect-build/rules_esbuild/releases/download/v0.15.3/rules_esbuild-v0.15.3.tar.gz",
|
|
)
|
|
|
|
load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependencies")
|
|
|
|
rules_esbuild_dependencies()
|
|
|
|
# Register a toolchain containing esbuild npm package and native bindings
|
|
load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_ESBUILD_VERSION", "esbuild_register_toolchains")
|
|
|
|
esbuild_register_toolchains(
|
|
name = "esbuild",
|
|
esbuild_version = LATEST_ESBUILD_VERSION,
|
|
)
|
|
|
|
# Go toolchain setup
|
|
|
|
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
|
|
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
|
|
load("//:linter_deps.bzl", "linter_dependencies")
|
|
load("//:deps.bzl", "go_dependencies")
|
|
|
|
go_repository(
|
|
name = "com_github_aws_aws_sdk_go_v2_service_ssooidc",
|
|
build_file_proto_mode = "disable_global",
|
|
importpath = "github.com/aws/aws-sdk-go-v2/service/ssooidc",
|
|
sum = "h1:xLPZMyuZ4GuqRCIec/zWuIhRFPXh2UOJdLXBSi64ZWQ=",
|
|
version = "v1.14.5",
|
|
)
|
|
|
|
# Overrides the default provided protobuf dep from rules_go by a more
|
|
# recent one.
|
|
go_repository(
|
|
name = "org_golang_google_protobuf",
|
|
build_file_proto_mode = "disable_global",
|
|
importpath = "google.golang.org/protobuf",
|
|
sum = "h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=",
|
|
version = "v1.33.0",
|
|
)
|
|
|
|
# Pin protoc-gen-go-grpc to 1.3.0
|
|
# See also //:gen-go-grpc
|
|
go_repository(
|
|
name = "org_golang_google_grpc_cmd_protoc_gen_go_grpc",
|
|
build_file_proto_mode = "disable_global",
|
|
importpath = "google.golang.org/grpc/cmd/protoc-gen-go-grpc",
|
|
sum = "h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA=",
|
|
version = "v1.3.0",
|
|
) # keep
|
|
|
|
# Pin specific version for aspect-cli's gazelle rules, with versions
|
|
# that it requires but that our codebase doesnt support.
|
|
go_repository(
|
|
name = "aspectcli-com_github_smacker_go_tree_sitter",
|
|
build_file_proto_mode = "disable_global",
|
|
importpath = "github.com/smacker/go-tree-sitter",
|
|
sum = "h1:DxgjlvWYsb80WEN2Zv3WqJFAg2DKjUQJO6URGdf1x6Y=",
|
|
version = "v0.0.0-20230720070738-0d0a9f78d8f8",
|
|
) # keep
|
|
|
|
load("@aspect_cli//:go.bzl", aspect_cli_deps = "deps")
|
|
|
|
aspect_cli_deps()
|
|
|
|
# gazelle:repository_macro deps.bzl%go_dependencies
|
|
go_dependencies()
|
|
|
|
go_rules_dependencies()
|
|
|
|
go_register_toolchains(
|
|
nogo = "@//:sg_nogo",
|
|
version = "1.22.1",
|
|
)
|
|
|
|
linter_dependencies()
|
|
|
|
gazelle_dependencies()
|
|
|
|
# rust toolchain setup
|
|
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_repository_set")
|
|
|
|
rules_rust_dependencies()
|
|
|
|
rust_version = "1.73.0"
|
|
|
|
rust_register_toolchains(
|
|
edition = "2021",
|
|
# Keep in sync with docker-images/syntax-highlighter/Dockerfile
|
|
# and docker-images/syntax-highlighter/rust-toolchain.toml
|
|
versions = [
|
|
rust_version,
|
|
],
|
|
)
|
|
|
|
# Needed for locally cross-compiling rust binaries to linux/amd64 on a Mac laptop, when seeking to
|
|
# create container images in local for testing purposes.
|
|
rust_repository_set(
|
|
name = "macos_arm_64",
|
|
edition = "2021",
|
|
exec_triple = "aarch64-apple-darwin",
|
|
extra_target_triples = ["x86_64-unknown-linux-gnu"],
|
|
versions = [rust_version],
|
|
)
|
|
|
|
load("@rules_rust//crate_universe:defs.bzl", "crates_repository")
|
|
|
|
crates_repository(
|
|
name = "crate_index",
|
|
cargo_config = "//docker-images/syntax-highlighter:.cargo/config.toml",
|
|
cargo_lockfile = "//docker-images/syntax-highlighter:Cargo.lock",
|
|
# this file has to be manually created and it will be filled when
|
|
# the target is ran.
|
|
# To regenerate this file run: CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index
|
|
lockfile = "//docker-images/syntax-highlighter:Cargo.Bazel.lock",
|
|
# glob doesn't work in WORKSPACE files: https://github.com/bazelbuild/bazel/issues/11935
|
|
manifests = [
|
|
"//docker-images/syntax-highlighter:Cargo.toml",
|
|
"//docker-images/syntax-highlighter:crates/syntax-analysis/Cargo.toml",
|
|
"//docker-images/syntax-highlighter:crates/tree-sitter-all-languages/Cargo.toml",
|
|
"//docker-images/syntax-highlighter:crates/scip-syntax/Cargo.toml",
|
|
],
|
|
)
|
|
|
|
load("@crate_index//:defs.bzl", "crate_repositories")
|
|
|
|
crate_repositories()
|
|
|
|
load("@hermetic_cc_toolchain//toolchain:defs.bzl", zig_toolchains = "toolchains")
|
|
|
|
zig_toolchains()
|
|
|
|
# containers steup ===============================
|
|
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")
|
|
|
|
rules_oci_dependencies()
|
|
|
|
load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "oci_register_toolchains")
|
|
|
|
oci_register_toolchains(
|
|
name = "oci",
|
|
crane_version = LATEST_CRANE_VERSION,
|
|
# Uncommenting the zot toolchain will cause it to be used instead of crane for some tasks.
|
|
# Note that it does not support docker-format images.
|
|
# zot_version = LATEST_ZOT_VERSION,
|
|
)
|
|
|
|
# Optional, for oci_tarball rule
|
|
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
|
|
|
|
rules_pkg_dependencies()
|
|
|
|
load("//dev:oci_deps.bzl", "oci_deps")
|
|
|
|
oci_deps()
|
|
|
|
load("@container_structure_test//:repositories.bzl", "container_structure_test_register_toolchain")
|
|
|
|
container_structure_test_register_toolchain(name = "cst")
|
|
|
|
load("//dev:tool_deps.bzl", "tool_deps")
|
|
|
|
tool_deps()
|
|
|
|
# Buildifier
|
|
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")
|
|
|
|
buildifier_prebuilt_deps()
|
|
|
|
load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")
|
|
|
|
buildifier_prebuilt_register_toolchains()
|
|
|
|
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
|
|
|
|
rules_proto_dependencies()
|
|
|
|
rules_proto_toolchains()
|
|
|
|
load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")
|
|
load("@rules_proto_grpc//go:repositories.bzl", rules_proto_grpc_go_repos = "go_repos")
|
|
load("@rules_proto_grpc//doc:repositories.bzl", rules_proto_grpc_doc_repos = "doc_repos")
|
|
|
|
rules_proto_grpc_toolchains()
|
|
|
|
rules_proto_grpc_repos()
|
|
|
|
rules_proto_grpc_go_repos()
|
|
|
|
rules_proto_grpc_doc_repos()
|
|
|
|
load("@rules_buf//buf:repositories.bzl", "rules_buf_dependencies", "rules_buf_toolchains")
|
|
|
|
rules_buf_dependencies()
|
|
|
|
rules_buf_toolchains(
|
|
sha256 = "05dfb45d2330559d258e1230f5a25e154f0a328afda2a434348b5ba4c124ece7",
|
|
version = "v1.33.0",
|
|
)
|
|
|
|
load("@rules_buf//gazelle/buf:repositories.bzl", "gazelle_buf_dependencies")
|
|
|
|
gazelle_buf_dependencies()
|
|
|
|
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
|
|
|
|
protobuf_deps()
|
|
|
|
# keep revision up-to-date with client/browser/scripts/build-inline-extensions.js
|
|
http_archive(
|
|
name = "sourcegraph_extensions_bundle",
|
|
add_prefix = "bundle",
|
|
build_file_content = """
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
exports_files(["bundle"])
|
|
|
|
filegroup(
|
|
name = "srcs",
|
|
srcs = glob(["**"]),
|
|
)
|
|
""",
|
|
integrity = "sha256-Spx8LyM7k+dsGOlZ4TdAq+CNk5EzvYB/oxnY4zGpqPg=",
|
|
strip_prefix = "sourcegraph-extensions-bundles-5.0.1",
|
|
url = "https://github.com/sourcegraph/sourcegraph-extensions-bundles/archive/v5.0.1.zip",
|
|
)
|
|
|
|
load("//dev:schema_migrations.bzl", "schema_migrations")
|
|
|
|
schema_migrations(
|
|
name = "schemas_migrations",
|
|
updated_at = "2024-05-07 14:39",
|
|
)
|
|
|
|
# wolfi images setup ================================
|
|
|
|
load("@rules_apko//apko:repositories.bzl", "apko_register_toolchains", "rules_apko_dependencies")
|
|
|
|
rules_apko_dependencies()
|
|
|
|
# We don't register the default toolchains, and regsiter our own from a patched go_repository sourced
|
|
# go_binary target that contains some fixes that are not yet merged upstream.
|
|
# https://github.com/chainguard-dev/go-apk/pull/216
|
|
apko_register_toolchains(
|
|
name = "apko",
|
|
register = False,
|
|
)
|
|
|
|
register_toolchains("//:apko_linux_toolchain")
|
|
|
|
register_toolchains("//:apko_darwin_arm64_toolchain")
|
|
|
|
register_toolchains("//:apko_darwin_amd64_toolchain")
|
|
|
|
load("//wolfi-images:repo.bzl", "wolfi_lockfiles")
|
|
|
|
wolfi_lockfiles(name = "apko_lockfiles")
|
|
|
|
load("@apko_lockfiles//:translates.bzl", "apko_translate_locks")
|
|
|
|
apko_translate_locks()
|
|
|
|
load("@apko_lockfiles//:repositories.bzl", "apko_repositories")
|
|
|
|
apko_repositories()
|