MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / WithProjectContext

Function WithProjectContext

pkg/policies/engine/engine.go:123–128  ·  view source on GitHub ↗

WithProjectContext sets the project name and version that this engine instance is evaluating policies for. The rego engine exposes them on the per-evaluation input as input.chainloop_metadata.project_name / input.chainloop_metadata.project_version_name so policy authors can pass them as operands to

(name, version string)

Source from the content-addressed store, hash-verified

121// input.chainloop_metadata.project_version_name so policy authors can pass them
122// as operands to chainloop.* built-ins. Either value may be empty.
123func WithProjectContext(name, version string) Option {
124 return func(opts *Options) {
125 opts.ProjectName = name
126 opts.ProjectVersionName = version
127 }
128}
129
130// ApplyOptions applies options and returns the configured Options
131// This automatically appends BaseAllowedHostnames to any user-provided hostnames

Callers 2

executeScriptMethod · 0.92

Calls

no outgoing calls

Tested by 1