about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ops/besadii/default.nix2
-rw-r--r--ops/besadii/main.go37
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) {