Go to the scan step your STO pipeline and click Advanced.
Under Policy Enforcement, click Add/Modify Policy Set and add the policy set you just created.
Click Apply Changes and then save the updated pipeline.
Set up notifications for pipeline failures
You have a Policy that fails the pipeline based on an OPA policy. Now you can configure your pipeline to send notification automatically whenever it fails.
The following pipeline that can generate two different notifications. If the code scan detects any CRITICAL or NEW_CRITICAL issues, it sends an automated email like this:
"STO scan of sto-notification-example found the following issues:
Critical : 1
New Critical : 0
High: 0
New High: 0
Medium: 0
New Medium: 0
See https://app.harness.io/ng/#/account/XXXXXXXXXXXXXXXXXXXXXX/sto/orgs/default/"
If the scan finds any NEW_CRITICAL or NEW_HIGH issues, it stops the pipeline execution and sends an email like this:
Here's the full pipeline. Note that the policy and policy set are referenced, but not defined, in the pipeline itself.