diff options
Diffstat (limited to 'ops/besadii/main.go')
-rw-r--r-- | ops/besadii/main.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ops/besadii/main.go b/ops/besadii/main.go index 3d694800a415..a5a144efea89 100644 --- a/ops/besadii/main.go +++ b/ops/besadii/main.go @@ -34,6 +34,18 @@ var changeIdRegexp = regexp.MustCompile(`^.*/(\d+)$`) // besadii configuration file structure type config struct { + // Required configuration for Buildkite<>Gerrit monorepo + // integration. + Repository string `json:"repository"` + Branch string `json:"branch"` + GerritUrl string `json:"gerritUrl"` + GerritUser string `json:"gerritUser"` + GerritPassword string `json:"gerritPassword"` + BuildkiteOrg string `json:"buildkiteOrg"` + BuildkiteProject string `json:"buildkiteProject"` + BuildkiteToken string `json:"buildkiteToken"` + + // Optional configuration for Sourcegraph trigger updates. SourcegraphUrl string `json:"sourcegraphUrl"` SourcegraphToken string `json:"sourcegraphToken"` } @@ -107,6 +119,18 @@ func loadConfig() (*config, error) { 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)") + } + + if cfg.GerritUrl == "" || cfg.GerritUser == "" || cfg.GerritPassword == "" { + return nil, fmt.Errorf("missing Gerrit configuration (required: gerritUrl, gerritUser, gerritPassword)") + } + + if cfg.BuildkiteOrg == "" || cfg.BuildkiteProject == "" || cfg.BuildkiteToken == "" { + return nil, fmt.Errorf("mising Buildkite configuration (required: buildkiteOrg, buildkiteProject, buildkiteToken)") + } + return &cfg, nil } |