diff options
author | Vincent Ambo <tazjin@tvl.su> | 2024-08-23T11·14+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2024-08-23T14·40+0000 |
commit | caf653be32f051e7f738a3aa08117df4d9ef6a14 (patch) | |
tree | 5cc71ae12b8d9665e09de3a512eed47931309a97 | |
parent | 11665f4e0a75501b39bf55fd78af871474de6854 (diff) |
chore(ops/besadii): remove sourcegraph index update support r/8557
Change-Id: I4ee9a5a69c90e2050c60b2ef8483431d691b499f Reviewed-on: https://cl.tvl.fyi/c/depot/+/12287 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
-rw-r--r-- | ops/besadii/default.nix | 2 | ||||
-rw-r--r-- | ops/besadii/main.go | 37 |
2 files changed, 1 insertions, 38 deletions
diff --git a/ops/besadii/default.nix b/ops/besadii/default.nix index 1199c56cfb94..424fa19b2b44 100644 --- a/ops/besadii/default.nix +++ b/ops/besadii/default.nix @@ -1,5 +1,5 @@ # This program is used as a Gerrit hook to trigger builds on -# Buildkite, Sourcegraph reindexing and other maintenance tasks. +# Buildkite and perform other maintenance tasks. { depot, ... }: depot.nix.buildGo.program { diff --git a/ops/besadii/main.go b/ops/besadii/main.go index 809acc29e8b4..aacd8f176ecf 100644 --- a/ops/besadii/main.go +++ b/ops/besadii/main.go @@ -8,7 +8,6 @@ // // Gerrit (ref-updated) hook: // - Trigger Buildkite CI builds -// - Trigger SourceGraph repository index updates // // Buildkite (post-command) hook: // - Submit CL verification status back to Gerrit @@ -55,10 +54,6 @@ type config struct { BuildkiteProject string `json:"buildkiteProject"` BuildkiteToken string `json:"buildkiteToken"` GerritChangeName string `json:"gerritChangeName"` - - // Optional configuration for Sourcegraph trigger updates. - SourcegraphUrl string `json:"sourcegraphUrl"` - SourcegraphToken string `json:"sourcegraphToken"` } // buildTrigger represents the information passed to besadii when it @@ -154,11 +149,6 @@ func loadConfig() (*config, error) { return nil, fmt.Errorf("invalid 'gerritChangeName': %s", cfg.GerritChangeName) } - // Rudimentary config validation logic - if cfg.SourcegraphUrl != "" && cfg.SourcegraphToken == "" { - return nil, fmt.Errorf("'SourcegraphToken' must be set if 'SourcegraphUrl' is set") - } - if cfg.Repository == "" || cfg.Branch == "" { return nil, fmt.Errorf("missing repository configuration (required: repository, branch)") } @@ -299,26 +289,6 @@ func triggerBuild(cfg *config, log *syslog.Writer, trigger *buildTrigger) error return nil } -// Trigger a Sourcegraph repository index update. -// -// https://docs.sourcegraph.com/admin/repo/webhooks -func triggerIndexUpdate(cfg *config, log *syslog.Writer) error { - req, err := http.NewRequest("POST", cfg.SourcegraphUrl, nil) - if err != nil { - return err - } - - req.Header.Add("Authorization", "token "+cfg.SourcegraphToken) - - _, err = http.DefaultClient.Do(req) - if err != nil { - return fmt.Errorf("failed to trigger Sourcegraph index update: %w", err) - } - - log.Info("triggered sourcegraph index update") - return nil -} - // Gerrit passes more flags than we want, but Rob Pike decided[0] in // 2013 that the Go art project will not allow users to ignore flags // because he "doesn't like it". This function allows users to ignore @@ -458,13 +428,6 @@ func gerritHookMain(cfg *config, log *syslog.Writer, trigger *buildTrigger) { if err != nil { log.Err(fmt.Sprintf("failed to trigger Buildkite build: %s", err)) } - - if cfg.SourcegraphUrl != "" && trigger.ref == cfg.Branch { - err = triggerIndexUpdate(cfg, log) - if err != nil { - log.Err(fmt.Sprintf("failed to trigger sourcegraph index update: %s", err)) - } - } } func postCommandMain(cfg *config) { |