-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marat Komarov
committed
Mar 18, 2021
1 parent
79443f1
commit c75727a
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,34 @@ jobs: | |
placement | ||
providers | ||
user | ||
test-new-style: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ubuntu:latest # Because it has 'curl' | ||
options: --cpus 1 | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Install OPA | ||
env: | ||
OPA_VERSION: "0.27.1" | ||
run: |- | ||
apt-get -yq update && apt-get install -yq curl; | ||
curl -L -o /usr/bin/opa https://github.com/open-policy-agent/opa/releases/download/v${OPA_VERSION}/opa_linux_amd64 2>/dev/null; | ||
chmod +x /usr/bin/opa; | ||
- name: Test | ||
env: | ||
TERM: xterm-256color | ||
run: |- | ||
# Directories having 'main.tf' are considered a 'new-style' example | ||
dirs=$(find . -name 'main.tf' | awk -F'/[^/]*$' '{print $1}' | sort | uniq); | ||
for polgrp in $dirs; do | ||
# Call opa test command for every Rego file in every example directory. | ||
for pol in $(find $polgrp -name '*.rego'); do | ||
tput setaf 2; | ||
echo "Test $pol"; | ||
tput sgr0; | ||
opa eval -f pretty --data $pol -i ${pol%.rego}.input.json data.terraform.deny; | ||
done; | ||
done; |