Skip to content

Commit

Permalink
added schema and correct statuses field
Browse files Browse the repository at this point in the history
  • Loading branch information
erjosito committed Jun 29, 2024
1 parent 522035d commit 0c51d1d
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 5 deletions.
53 changes: 50 additions & 3 deletions .github/actions/get_aprl/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,52 @@
# Other control variables (which probably should be turned into parameters)
max_files = 0 # Maximum number of files to process. Set to 0 to process all files.

# Constants to create a compliant checklist
statuses_object = [
{
"name": "Not verified",
"description": "This check has not been looked at yet"
},
{
"name": "Open",
"description": "There is an action item associated to this check"
},
{
"name": "Fulfilled",
"description": "This check has been verified, and there are no further action items associated to it"
},
{
"name": "N/A",
"description": "Not applicable for current design"
},
{
"name": "Not required",
"description": "Not required"
}
]
yesno_object = [
{'name': 'Yes'},
{'name': 'No'}
]
waf_object = [
{
"name": "Reliability"
},
{
"name": "Security"
},
{
"name": "Cost"
},
{
"name": "Operations"
},
{
"name": "Performance"
}
]
schema_url = 'https://raw.githubusercontent.com/Azure/review-checklists/main/checklists/checklist.schema.json'

# Function to store an object in a JSON file
def store_json(obj, filename):
with open(filename, 'w') as f:
Expand Down Expand Up @@ -166,12 +212,13 @@ def get_aprl_kql(aprl_recos):

# Add metadata and other info
aprl_checklist = {
'$schema': schema_url,
'items': aprl_recos,
'categories': aprl_categories_object,
'severities': aprl_severities_object,
'waf': [{'name': 'Security'}, {'name': 'Resiliency'}, {'name': 'Operational Excellence'}, {'name': 'Performance'}, {'name': 'Cost'}],
'yesno': [{'name': 'Yes'}, {'name': 'No'}],
'status': [{'name': 'Not verified'}, {'name': 'Open'}, {'name': 'Fulfilled'}, {'name': 'Not required'}, {'name': 'N/A'}],
'waf': waf_object,
'yesno': yesno_object,
'status': statuses_object,
'metadata': {
'name': 'APRL Checklist',
'waf': 'none',
Expand Down
36 changes: 34 additions & 2 deletions .github/actions/get_service_guides/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,34 @@
args_load_filename = None
args_checklist_filename = None

# Constants to create a compliant checklist
statuses_object = [
{
"name": "Not verified",
"description": "This check has not been looked at yet"
},
{
"name": "Open",
"description": "There is an action item associated to this check"
},
{
"name": "Fulfilled",
"description": "This check has been verified, and there are no further action items associated to it"
},
{
"name": "N/A",
"description": "Not applicable for current design"
},
{
"name": "Not required",
"description": "Not required"
}
]
yesno_object = (
{'name': 'Yes'},
{'name': 'No'}
)
schema_url = 'https://raw.githubusercontent.com/Azure/review-checklists/main/checklists/checklist.schema.json'

# Function to store an object in a JSON file
def store_json(obj, filename):
Expand Down Expand Up @@ -358,10 +386,12 @@ def compare_recos(waf_recos, checklist_recos, minimum_similarity=0.5):
service_recos = [x for x in waf_recos if x['service'] == service and x['type'] == 'recommendation']
# Create a dictionary with checklist format
service_checklist = {
'$schema': schema_url,
'items': service_recos,
'categories': (),
'waf': waf_pillars_object,
'yesno': ({'name': 'Yes'}, {'name': 'No'}),
'yesno': yesno_object,
'status': statuses_object,
'metadata': {
'name': f'{service} Service Guide',
'waf': 'all',
Expand All @@ -380,10 +410,12 @@ def compare_recos(waf_recos, checklist_recos, minimum_similarity=0.5):
if (args_verbose): print("DEBUG: Exported {0} recos (only recommendations and not design checks are exported) to filename {1}".format(len(service_recos), service_filename))
# Finally, export the full file
full_checklist = {
'$schema': schema_url,
'items': waf_recos,
'categories': (),
'waf': waf_pillars_object,
'yesno': ({'name': 'Yes'}, {'name': 'No'}),
'yesno': yesno_object,
'status': statuses_object,
'metadata': {
'name': f'WAF Service Guides',
'waf': 'all',
Expand Down

0 comments on commit 0c51d1d

Please sign in to comment.