Overview
This feature allow operators to group related policies into one single entity that can be reused across the organization. With Policy Groups, materials and policies can be enforced in Chainloop contracts with little or no effort. For example, they might want to create a “SBOM quality” group with some SBOM-related policies. The policy groups can be defined this way:Using Policy Groups
This policy group could be applied to any contract:attestation push
would fail until the required material is provided:
Policy group parameters
In the same way as policies, groups can accept arguments, which are specified in theinputs
section.
Then those inputs can be passed down to policies using interpolation.
In the example above, bannedComponents
input parameter (which is mandatory) is passed to the underlying policy with the expression {{ inputs.bannedComponents }}
Using placeholders in material names
In the previous example, our policy group enforces asbom
material. But what if our contract requires multiple SBOMs (because we are building several images in the same pipeline, for example)?
By using parameters and placeholders in material names, we can add as many instances of the same policy group as we need: