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 }}
Skipping specific policies
Sometimes you may want to use a policy group but temporarily or permanently exclude certain policies from evaluation without modifying the group definition itself. This is useful when:- A specific policy doesn’t apply to a particular workflow
- You need to temporarily bypass a policy during development or migration
- Different workflows need different subsets of policies from the same group
skip field to selectively exclude policies by their metadata name:
Policy names in the
skip list refer to the policy’s metadata name (the name field in the policy definition)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:
