@@ -74,7 +74,7 @@ def __init__(self, username, icon, channel, eventName, eventJsonStr, actionRepo)
7474 elif eventName == "repository_dispatch" :
7575 event_type = self .eventJson .get ("action" , None )
7676 if event_type == "ziti_release" :
77- self .addFipsReleaseDetails ()
77+ self .addFipsPreReleaseDetails ()
7878 elif event_type == "ziti_promote_stable" :
7979 self .addFipsPromoteStableDetails ()
8080 else :
@@ -283,16 +283,16 @@ def addReleaseDetails(self):
283283
284284 self .attachment ["text" ] = bodyText
285285
286- def addFipsReleaseDetails (self ):
286+ def addFipsPreReleaseDetails (self ):
287287 # Pre-release announcement (ziti_release)
288288 payload = self .eventJson .get ("client_payload" , {})
289289 version = payload .get ("version" )
290290 if not version :
291291 self .attachment ["text" ] = "[ziti-fips] Pre-release published, but version not found in event."
292292 return
293293 repo = self .repoJson ["full_name" ]
294- release_url = f"https://github.com/{ repo } /releases/tag/{ version } "
295- self .body ["text" ] = f"FIPS Pre-release published by [{ repo } ](https://github.com/{ repo } )"
294+ release_url = f"https://github.com/{ repo } /releases/tag/v { version } "
295+ self .body ["text" ] = f"FIPS Pre-release published in [{ repo } ](https://github.com/{ repo } )"
296296 self .attachment ["color" ] = self .releaseColor
297297 self .attachment ["thumb_url" ] = self .fipsReleaseThumbnail
298298 self .attachment ["text" ] = f"FIPS Pre-release [{ version } ]({ release_url } ) is now available."
@@ -305,7 +305,7 @@ def addFipsPromoteStableDetails(self):
305305 self .attachment ["text" ] = "[ziti-fips] Stable promotion, but version not found in event."
306306 return
307307 repo = self .repoJson ["full_name" ]
308- release_url = f"https://github.com/{ repo } /releases/tag/{ version } "
308+ release_url = f"https://github.com/{ repo } /releases/tag/v { version } "
309309 self .body ["text" ] = f"FIPS Release promoted to stable in [{ repo } ](https://github.com/{ repo } )"
310310 self .attachment ["color" ] = self .releaseColor
311311 self .attachment ["thumb_url" ] = self .fipsReleaseThumbnail
@@ -414,10 +414,55 @@ def dumpJson(self):
414414 print ("ERROR: no Ziti identity provided, set INPUT_ZITIID or INPUT_ZITIJWT" )
415415 exit (1 )
416416
417+ def generate_json_schema (obj , max_depth = 10 , current_depth = 0 ):
418+ """Generate a schema representation of a JSON object by inferring types from values."""
419+ if current_depth >= max_depth :
420+ return "<max_depth_reached>"
421+
422+ if obj is None :
423+ return "null"
424+ elif isinstance (obj , bool ):
425+ return "boolean"
426+ elif isinstance (obj , int ):
427+ return "integer"
428+ elif isinstance (obj , float ):
429+ return "number"
430+ elif isinstance (obj , str ):
431+ return "string"
432+ elif isinstance (obj , list ):
433+ if len (obj ) == 0 :
434+ return "array[]"
435+ # Get schema of first element as representative
436+ element_schema = generate_json_schema (obj [0 ], max_depth , current_depth + 1 )
437+ return f"array[{ element_schema } ]"
438+ elif isinstance (obj , dict ):
439+ schema = {}
440+ for key , value in obj .items ():
441+ schema [key ] = generate_json_schema (value , max_depth , current_depth + 1 )
442+ return schema
443+ else :
444+ return f"unknown_type({ type (obj ).__name__ } )"
445+
446+ # Validate zitiId as JSON
447+ try :
448+ zitiIdJson = json .loads (zitiId )
449+ except Exception as e :
450+ print (f"ERROR: zitiId is not valid JSON: { e } " )
451+ print (f"zitiId content: { zitiId } " )
452+ exit (1 )
453+
417454 idFilename = "id.json"
418455 with open (idFilename , 'w' ) as f :
419456 f .write (zitiId )
457+
458+ # Load the identity file after it's been written and closed
459+ try :
420460 openziti .load (idFilename )
461+ except Exception as e :
462+ print (f"ERROR: Failed to load Ziti identity: { e } " )
463+ schema = generate_json_schema (zitiIdJson )
464+ print (f"DEBUG: zitiId schema for troubleshooting: { json .dumps (schema , indent = 2 )} " )
465+ raise e
421466
422467 # Create webhook body
423468 try :
0 commit comments