File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 3434 placement
3535 providers
3636 user
37+
38+ test-new-style :
39+ runs-on : ubuntu-latest
40+ container :
41+ image : ubuntu:latest # Because it has 'curl'
42+ options : --cpus 1
43+ steps :
44+ - name : Checkout
45+ 46+ - name : Install OPA
47+ env :
48+ OPA_VERSION : " 0.27.1"
49+ run : |-
50+ apt-get -yq update && apt-get install -yq curl;
51+ curl -L -o /usr/bin/opa https://github.com/open-policy-agent/opa/releases/download/v${OPA_VERSION}/opa_linux_amd64 2>/dev/null;
52+ chmod +x /usr/bin/opa;
53+ - name : Test
54+ env :
55+ TERM : xterm-256color
56+ run : |-
57+ # Directories having 'main.tf' are considered a 'new-style' example
58+ dirs=$(find . -name 'main.tf' | awk -F'/[^/]*$' '{print $1}' | sort | uniq);
59+ for polgrp in $dirs; do
60+ # Call opa test command for every Rego file in every example directory.
61+ for pol in $(find $polgrp -name '*.rego'); do
62+ tput setaf 2;
63+ echo "Test $pol";
64+ tput sgr0;
65+ opa eval -f pretty --data $pol -i ${pol%.rego}.input.json data.terraform.deny;
66+ done;
67+ done;
You can’t perform that action at this time.
0 commit comments