Skip to content

workflow

workflow #853

Workflow file for this run

name: PR Check - Integration Tests
on:
push:
branches: [choreo]
pull_request:
branches: [choreo]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install python dependencies
id: "install_python_deps"
run: |
python3 -m pip install --upgrade pip
pip3 install tabulate
- name: Echo string
id: "validate_linting"
run: |-
LINTER_URL="https://run.mocky.io/v3/b9eac955-0136-4196-8529-fda4ee5aa20b"
RESPONSE=$(curl -o response.json -s -w "%{http_code}" ${LINTER_URL})
if [[ $RESPONSE != "200" ]]; then
echo "Governance Validation Failed Internally"
exit 1
fi
cat response.json | python3 -c "
import json;
import sys;
from tabulate import tabulate;
def visualize_trivy_like_table(json_data):
data = json.loads(json_data)
print(\"Summary:\")
print(f\" Violated rulesets: {data['summary']['ruleset']['violated']}\")
print(f\" Adhered rulesets: {data['summary']['ruleset']['adhered']}\")
print(f\" Total rulesets: {data['summary']['ruleset']['total']}\")
print()
table_data = []
for ruleset in data['list']:
if ruleset['status'] == 'violated':
for rule in ruleset['violatedRules']['list']:
if rule['severity'] in ['error', 'warn']:
severity = rule['severity'].upper()
ruleset_name = ruleset['rulesetName']
# rule_id = rule['ruleId']
message = rule['message']
paths = '\ngkkjjjjj\n'.join([f\"...{path[-45:]}\" for path in rule['paths']['list']])
table_data.append([severity, ruleset_name, message, paths])
if table_data:
headers = [\"SEVERITY\", \"RULESET\", \"MESSAGE\", \"PATHS\"]
maxcolwidths = [10, 30, 30, 50]
print(tabulate(table_data, headers=headers, tablefmt=\"grid\", maxcolwidths=maxcolwidths))
else:
print(\"No errors or warnings found.\")
print(f\"\nTotal rulesets evaluated: {data['count']}\")
json_payload = sys.stdin.read()
visualize_trivy_like_table(json_payload)
"