Skip to content

Bug fix: Workflow file failures for gitProxy #871

Bug fix: Workflow file failures for gitProxy

Bug fix: Workflow file failures for gitProxy #871

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
env:
USER_SOURCE_REPO: VirajSalaka/proxy-from-gh
MAX_HEAP: 2048m
MIN_HEAP: 512m
APIM_ENDPOINT: https://sts.preview-dv.choreo.dev
RUDDER_ENDPOINT: http://dp-rudder
SUB_PATH: adminService
ORG_UUID: e615dff6-6691-4cec-96af-45be2a11a2ca
LINTER_ENDPOINT: undefined
SERVICE_SOURCE_DIR: proxy-dir
COMPONENT_ID: 5f7ad903-54ab-4724-aa4b-5cedf8604c88
PROJECT_ID: 01fe8d09-0f76-458a-b40f-d15afbc69f8c
CP_GW_ENDPOINT: https://apis.preview-dv.choreo.dev
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: |
sleep 3
LINTER_URL="https://run.mocky.io/v3/3c1bbb45-a0f8-4d39-86f5-6626c0d210ae"
RESPONSE=$(curl -s -o response.json -w "%{http_code}" -X GET $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']
message = rule['message']
pathsList = []
for path in rule['paths']['list']:
if len(path[2:]) <= 43:
pathsList.append(path)
else:
pathsList.append(f\"{path[:1]}...{path[-41:]}\")
paths = '\\n'.join(pathsList)
table_data.append([severity, ruleset_name, message, paths])
if table_data:
headers = [\"SEVERITY\", \"RULESET\", \"MESSAGE\", \"PATHS\"]
maxcolwidths = [10, 30, 30, None]
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)
"