Skip to content

Commit 6042485

Browse files
nikpivkinsimar7
andauthored
chore: pass schemas to opa test (#386)
* chore: pass schemas to opa test Signed-off-by: Nikita Pivkin <nikita.pivkin@smartforce.io> * pass schemas to 'opa check' Signed-off-by: Nikita Pivkin <nikita.pivkin@smartforce.io> --------- Signed-off-by: Nikita Pivkin <nikita.pivkin@smartforce.io> Co-authored-by: simar7 <1254783+simar7@users.noreply.github.com>
1 parent 4adf8ef commit 6042485

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
bundle.tar.gz
22
opa
3+
schemas
34

45
.idea
56
.vscode

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ test:
1717
test-integration:
1818
go test -v -timeout 5m -tags=integration ./integration/...
1919

20+
.PHONY: download-schemas
21+
download-schemas:
22+
@schemas_path=schemas ; \
23+
base_url=https://raw.githubusercontent.com/aquasecurity/trivy/main/pkg/iac/rego/schemas ; \
24+
mkdir -p $$schemas_path ; \
25+
for file in cloud.json dockerfile.json kubernetes.json ; do \
26+
wget -q -O $$schemas_path/$$file $$base_url/$$file ; \
27+
done
28+
2029
.PHONY: rego
2130
rego: fmt-rego check-rego lint-rego test-rego docs
2231

@@ -29,8 +38,8 @@ test-rego:
2938
go run ./cmd/opa test --explain=fails lib/ checks/ examples/ --ignore '*.yaml'
3039

3140
.PHONY: check-rego
32-
check-rego:
33-
@go run ./cmd/opa check lib checks --v0-v1 --strict
41+
check-rego: download-schemas
42+
@go run ./cmd/opa check lib checks --v0-v1 --strict -s schemas
3443

3544
.PHONY: lint-rego
3645
lint-rego: check-rego

examples/serverless/python2.rego

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
# Ensure that you use a supported runtime version, such as Python 3.x,
99
# to maintain the security and reliability of your serverless application.
1010
# scope: package
11-
# schemas:
12-
# - input: schema["yaml"]
1311
# related_resources:
1412
# - https://www.python.org/doc/sunset-python-2/
1513
# custom:

examples/terraform-plan/asg_capacity.rego

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#
77
# Ensure that the desired capacity for Auto Scaling Groups is set to a reasonable value, typically within limits defined by your organization.
88
# scope: package
9-
# schemas:
10-
# - input: schema["json"]
119
# related_resources:
1210
# - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group
1311
# custom:

0 commit comments

Comments
 (0)