sourcegraph/dev/sg/BUILD.bazel
Jean-Hadrien Chabran bc4acd1fbd
feat(local): sg tail (#64146)
This PR brings back https://github.com/sourcegraph/sgtail back in `sg`,
plus a few adjustments to make it easier to use. I'll archive that repo
once this PR lands.

@camdencheek mentioned you here as you've been the most recent beta
tester, it's more an FYI than a request for a review, though it's
welcome if you want to spend a bit of time reading this.

Closes DINF-155

## Test plan

Locally tested + new unit test + CI

## Changelog

- Adds a new `sg tail` command that provides a better UI to tail and
filter log messages from `sg start --tail`.
2024-07-30 14:03:27 +02:00

168 lines
5.0 KiB
Python

load("//dev:go_defs.bzl", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "sg_lib",
srcs = [
"analytics.go",
"checks.go",
"generates.go",
"live.go",
"main.go",
"os.go",
"sg_audit.go",
"sg_backport.go",
"sg_bazel.go",
"sg_cloud.go",
"sg_cody_gateway.go",
"sg_db.go",
"sg_deploy.go",
"sg_doctor.go",
"sg_embeddings_qa.go",
"sg_generate.go",
"sg_help.go",
"sg_images.go",
"sg_insights.go",
"sg_install.go",
"sg_lint.go",
"sg_live.go",
"sg_logo.go",
"sg_migration.go",
"sg_monitoring.go",
"sg_ops.go",
"sg_page.go",
"sg_rfc.go",
"sg_run.go",
"sg_secret.go",
"sg_security.go",
"sg_setup.go",
"sg_src.go",
"sg_start.go",
"sg_teammate.go",
"sg_tests.go",
"sg_update.go",
"sg_version.go",
"sg_wolfi.go",
],
embedsrcs = ["sg.doctor.yaml"],
importpath = "github.com/sourcegraph/sourcegraph/dev/sg",
visibility = ["//visibility:private"],
deps = [
"//cmd/embeddings/qa",
"//dev/sg/buf",
"//dev/sg/ci",
"//dev/sg/dependencies",
"//dev/sg/enterprise",
"//dev/sg/internal/analytics",
"//dev/sg/internal/background",
"//dev/sg/internal/backport",
"//dev/sg/internal/category",
"//dev/sg/internal/check",
"//dev/sg/internal/cloud",
"//dev/sg/internal/db",
"//dev/sg/internal/generate",
"//dev/sg/internal/generate/golang",
"//dev/sg/internal/generate/proto",
"//dev/sg/internal/images",
"//dev/sg/internal/migration",
"//dev/sg/internal/release",
"//dev/sg/internal/repo",
"//dev/sg/internal/rfc",
"//dev/sg/internal/run",
"//dev/sg/internal/secrets",
"//dev/sg/internal/sgconf",
"//dev/sg/internal/slack",
"//dev/sg/internal/std",
"//dev/sg/internal/usershell",
"//dev/sg/internal/wolfi",
"//dev/sg/interrupt",
"//dev/sg/linters",
"//dev/sg/msp",
"//dev/sg/root",
"//dev/sg/sams",
"//dev/sg/tail",
"//dev/team",
"//internal/accesstoken",
"//internal/collections",
"//internal/database",
"//internal/database/basestore",
"//internal/database/connections/live",
"//internal/database/dbconn",
"//internal/database/dbtest",
"//internal/database/migration/cliutil",
"//internal/database/migration/runner",
"//internal/database/migration/schemas",
"//internal/database/migration/store",
"//internal/database/postgresdsn",
"//internal/download",
"//internal/encryption",
"//internal/extsvc",
"//internal/hashutil",
"//internal/lazyregexp",
"//internal/observation",
"//internal/types",
"//lib/cliutil/completions",
"//lib/cliutil/docgen",
"//lib/cliutil/exit",
"//lib/errors",
"//lib/output",
"//monitoring/command",
"//monitoring/definitions",
"//monitoring/monitoring",
"@com_github_gomodule_redigo//redis",
"@com_github_google_go_github_v55//github",
"@com_github_grafana_regexp//:regexp",
"@com_github_jackc_pgx_v4//:pgx",
"@com_github_keegancsmith_sqlf//:sqlf",
"@com_github_masterminds_semver//:semver",
"@com_github_mitchellh_hashstructure_v2//:hashstructure",
"@com_github_opsgenie_opsgenie_go_sdk_v2//alert",
"@com_github_opsgenie_opsgenie_go_sdk_v2//client",
"@com_github_slack_go_slack//:slack",
"@com_github_sourcegraph_log//:log",
"@com_github_sourcegraph_run//:run",
"@com_github_urfave_cli_v2//:cli",
"@in_gopkg_yaml_v3//:yaml_v3",
"@org_golang_x_exp//maps",
"@org_golang_x_mod//semver",
"@org_golang_x_oauth2//:oauth2",
"@org_golang_x_text//cases",
"@org_golang_x_text//language",
],
)
go_binary(
name = "sg",
embed = [":sg_lib"],
# keep
gotags = select({
"//:sg_msp_flag": ["msp"],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
)
go_test(
name = "sg_test",
timeout = "short",
srcs = [
"main_test.go",
"sg_images_test.go",
"sg_start_test.go",
],
# Required by func findRoot() to check if sg is running in sourcegraph/sourcegraph
data = ["//:go.mod"],
embed = [":sg_lib"],
# HOME is required to be set to start sg
env = {"HOME": "/tmp"},
deps = [
"//dev/sg/internal/run",
"//dev/sg/internal/sgconf",
"//dev/sg/internal/std",
"//lib/output/outputtest",
"@com_github_google_go_cmp//cmp",
"@com_github_stretchr_testify//assert",
"@com_github_urfave_cli_v2//:cli",
],
)