about summary refs log tree commit diff
path: root/ops/besadii/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'ops/besadii/main.go')
-rw-r--r--ops/besadii/main.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/ops/besadii/main.go b/ops/besadii/main.go
index f86275750473..9a1befa0230b 100644
--- a/ops/besadii/main.go
+++ b/ops/besadii/main.go
@@ -25,6 +25,7 @@ import (
 	"os"
 	"path"
 	"regexp"
+	"strings"
 )
 
 var branchRegexp = regexp.MustCompile(`^refs/heads/(.*)$`)
@@ -259,24 +260,26 @@ func refUpdatedMain() {
 		os.Exit(0)
 	}
 
-	buildkiteToken, err := ioutil.ReadFile("/etc/secrets/buildkite-besadii")
+	buildkiteTokenBytes, err := ioutil.ReadFile("/etc/secrets/buildkite-besadii")
 	if err != nil {
 		log.Alert(fmt.Sprintf("buildkite token could not be read: %s", err))
 		os.Exit(1)
 	}
+	buildkiteToken := strings.TrimSpace(string(buildkiteTokenBytes))
 
-	sourcegraphToken, err := ioutil.ReadFile("/etc/secrets/sourcegraph-token")
+	sourcegraphTokenBytes, err := ioutil.ReadFile("/etc/secrets/sourcegraph-token")
 	if err != nil {
 		log.Alert(fmt.Sprintf("sourcegraph token could not be read: %s", err))
 		os.Exit(1)
 	}
+	sourcegraphToken := strings.TrimSpace(string(sourcegraphTokenBytes))
 
-	err = triggerBuild(log, string(buildkiteToken), update)
+	err = triggerBuild(log, buildkiteToken, update)
 	if err != nil {
 		log.Err(fmt.Sprintf("failed to trigger Buildkite build: %s", err))
 	}
 
-	err = triggerIndexUpdate(string(sourcegraphToken))
+	err = triggerIndexUpdate(sourcegraphToken)
 	if err != nil {
 		log.Err(fmt.Sprintf("failed to trigger sourcegraph index update: %s", err))
 	}