MCPcopy Create free account
hub / github.com/bytebase/bytebase / buildCELVariablesForIssue

Function buildCELVariablesForIssue

backend/runner/approval/runner.go:390–403  ·  view source on GitHub ↗

buildCELVariablesForIssue builds the CEL variable maps for evaluating approval rules. Returns a list of CEL variable maps (one per task/component), done flag, and error. done=false means the caller should retry later (e.g., waiting for plan check runs).

(ctx context.Context, stores *store.Store, issue *store.IssueMessage)

Source from the content-addressed store, hash-verified

388// Returns a list of CEL variable maps (one per task/component), done flag, and error.
389// done=false means the caller should retry later (e.g., waiting for plan check runs).
390func buildCELVariablesForIssue(ctx context.Context, stores *store.Store, issue *store.IssueMessage) ([]map[string]any, bool, error) {
391 switch issue.Type {
392 case storepb.Issue_ROLE_GRANT:
393 return buildCELVariablesForRoleGrant(ctx, stores, issue)
394 case storepb.Issue_DATABASE_CHANGE:
395 return buildCELVariablesForDatabaseChange(ctx, stores, issue)
396 case storepb.Issue_DATABASE_EXPORT:
397 return buildCELVariablesForDataExport(ctx, stores, issue)
398 case storepb.Issue_ACCESS_GRANT:
399 return buildCELVariablesForAccessGrant(ctx, stores, issue)
400 default:
401 return nil, false, errors.Errorf("unknown issue type %v", issue.Type)
402 }
403}
404
405// specTarget represents a database target extracted from a spec.
406type specTarget struct {

Callers 1

Tested by

no test coverage detected