Skip to content

Commit e949436

Browse files
committed
Add EC checks for StepActions
Ref: https://issues.redhat.com/browse/EC-1010 Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
1 parent 93bae89 commit e949436

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed

.tekton/tasks/ec-checks.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,19 @@ spec:
4949
policy='./policies/build-tasks.yaml'
5050
5151
ec validate input --policy "${policy}" --output yaml --strict=true ${args[*]}
52+
- name: validate-step-actions
53+
workingDir: "$(workspaces.source.path)/source"
54+
image: quay.io/enterprise-contract/ec-cli:snapshot@sha256:46fae4d356d678383a926de8a68f79177d7e685d5497675acf41c9d3425aaacc
55+
script: |
56+
#!/bin/bash
57+
set -euo pipefail
58+
59+
shopt -s globstar
60+
readarray -t args < <(yq -r 'select(.kind == "StepAction") | "--file=" + filename' stepactions/**/*.yaml)
61+
echo "[DEBUG] Files parameter: ${args[*]}"
62+
63+
policy='./policies/step-actions.yaml'
64+
ec validate input --show-successes --policy "${policy}" --output yaml --strict=true "${args[@]}"
65+
5266
workspaces:
5367
- name: source

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,13 @@ Specify the Quay repository using the `QUAY_NAMESPACE` environment variable in t
135135
### Compliance
136136
137137
Task definitions must comply with the [Enterprise Contract](https://enterprisecontract.dev/) policies.
138-
Currently, there are two policy configurations.
139-
- The [all-tasks](./policies/all-tasks.yaml) policy
140-
configuration applies to all Task definitions
141-
- The [build-tasks](./policies/build-tasks.yaml)
142-
policy configuration applies only to build Task definitions.
143-
144-
A build Task, i.e., one that produces a
145-
container image, must abide by both policy configurations.
138+
Currently, there are three policy configurations.
139+
140+
- The [all-tasks](./policies/all-tasks.yaml) policy configuration applies to all Task definitions.
141+
- The [build-tasks](./policies/build-tasks.yaml) policy configuration applies only to build Task
142+
definitions.
143+
- The [step-actions](./policies/step-actions.yaml) policy configuration applies to all StepAction
144+
definitions.
145+
146+
A build Task, e.g. one that produces a container image, must abide by both `all-tasks` and
147+
`build-tasks` policy configurations.

policies/step-actions.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
# These policies are meant to be applied to all of the Tasks in this repo.
3+
sources:
4+
- policy:
5+
- github.com/enterprise-contract/ec-policies//policy/lib
6+
- github.com/enterprise-contract/ec-policies//policy/stepaction
7+
data:
8+
- oci::quay.io/konflux-ci/tekton-catalog/data-acceptable-bundles:latest
9+
- github.com/release-engineering/rhtap-ec-policy//data
10+
config:
11+
include:
12+
- stepaction.image
13+
- stepaction.kind
14+
# Support legacy matchers for now
15+
- image
16+
- kind

0 commit comments

Comments
 (0)