@@ -30,17 +30,9 @@ def create_notes(self,repo_path, file_paths):
30
30
if 'name' in data and 'stories/' in file_path :
31
31
story_link = "https://research.splunk.com/stories/" + data ['name' ]
32
32
story_link = story_link .replace (" " ,"_" )
33
- story_link = story_link .replace ("- " ,"_" )
34
33
story_link = story_link .lower ()
35
34
print ("- " + "[" + f"{ data ['name' ]} " + "]" + "(" + story_link + ")" )
36
- # Check and create detection link
37
- if 'name' in data and 'id' in data and 'detections/' in file_path :
38
- temp_link = "https://research.splunk.com" + file_path .replace (repo_path ,"" )
39
- pattern = r'(?<=/)[^/]*$'
40
- detection_link = re .sub (pattern , data ['id' ], temp_link )
41
- detection_link = detection_link .replace ("detections" ,"" )
42
- detection_link = detection_link .replace (".com//" ,".com/" )
43
- print ("- " + "[" + f"{ data ['name' ]} " + "]" + "(" + detection_link + ")" )
35
+
44
36
if 'name' in data and 'playbooks/' in file_path :
45
37
playbook_link = "https://research.splunk.com" + file_path .replace (repo_path ,"" )
46
38
playbook_link = playbook_link .replace (".yml" ,"/" ).lower ()
@@ -52,6 +44,28 @@ def create_notes(self,repo_path, file_paths):
52
44
if 'name' in data and 'lookups/' in file_path :
53
45
print ("- " + f"{ data ['name' ]} " )
54
46
47
+ # Create only SSA link when its production
48
+ if 'name' in data and 'id' in data and 'ssa_detections/' in file_path :
49
+ if data ['status' ] == "production" :
50
+ temp_link = "https://research.splunk.com" + file_path .replace (repo_path ,"" )
51
+ pattern = r'(?<=/)[^/]*$'
52
+ detection_link = re .sub (pattern , data ['id' ], temp_link )
53
+ detection_link = detection_link .replace ("detections" ,"" )
54
+ detection_link = detection_link .replace ("ssa_/" ,"" )
55
+ print ("- " + "[" + f"{ data ['name' ]} " + "]" + "(" + detection_link + ")" )
56
+
57
+ if data ['status' ] == "validation" :
58
+ print ("- " + f"{ data ['name' ]} " + " (Validation Mode)" )
59
+
60
+ # Check and create detection link
61
+ if 'name' in data and 'id' in data and 'detections/' in file_path and not 'ssa_detections/' in file_path :
62
+ temp_link = "https://research.splunk.com" + file_path .replace (repo_path ,"" )
63
+ pattern = r'(?<=/)[^/]*$'
64
+ detection_link = re .sub (pattern , data ['id' ], temp_link )
65
+ detection_link = detection_link .replace ("detections" ,"" )
66
+ detection_link = detection_link .replace (".com//" ,".com/" )
67
+ print ("- " + "[" + f"{ data ['name' ]} " + "]" + "(" + detection_link + ")" )
68
+
55
69
except yaml .YAMLError as exc :
56
70
print (f"Error parsing YAML file { file_path } : { exc } " )
57
71
else :
@@ -60,7 +74,7 @@ def create_notes(self,repo_path, file_paths):
60
74
def release_notes (self , input_dto : DirectorInputDto , old_tag :Union [str ,None ], new_tag :str , latest_branch :str ) -> None :
61
75
62
76
### Remove hard coded path
63
- directories = ['detections/' ,'stories/' ,'macros/' ,'lookups/' ,'playbooks' ]
77
+ directories = ['detections/' ,'stories/' ,'macros/' ,'lookups/' ,'playbooks/' , 'ssa_detections/ ' ]
64
78
repo_path = os .path .abspath (input_dto .director_input_dto .input_path )
65
79
repo = Repo (repo_path )
66
80
# Ensure the new tag is in the tags if tags are supplied
@@ -104,25 +118,28 @@ def release_notes(self, input_dto: DirectorInputDto, old_tag:Union[str,None], ne
104
118
# Check if a file is Modified
105
119
if diff .change_type == 'M' :
106
120
modified_files .append (file_path )
121
+
122
+
107
123
# Check if a file is Added
108
124
elif diff .change_type == 'A' :
109
125
added_files .append (file_path )
110
126
# print(added_files)
111
-
112
127
detections_added = []
128
+ ba_detections_added = []
113
129
stories_added = []
114
130
macros_added = []
115
131
lookups_added = []
116
132
playbooks_added = []
117
133
detections_modified = []
134
+ ba_detections_modified = []
118
135
stories_modified = []
119
136
macros_modified = []
120
137
lookups_modified = []
121
138
playbooks_modified = []
122
139
123
140
for file in modified_files :
124
141
file = repo_path + "/" + file
125
- if 'detections/' in file :
142
+ if 'detections/' in file and 'ssa_detections/' not in file :
126
143
detections_modified .append (file )
127
144
if 'stories/' in file :
128
145
stories_modified .append (file )
@@ -132,10 +149,12 @@ def release_notes(self, input_dto: DirectorInputDto, old_tag:Union[str,None], ne
132
149
lookups_modified .append (file )
133
150
if 'playbooks/' in file :
134
151
playbooks_modified .append (file )
152
+ if 'ssa_detections/' in file :
153
+ ba_detections_modified .append (file )
135
154
136
155
for file in added_files :
137
156
file = repo_path + "/" + file
138
- if 'detections/' in file :
157
+ if 'detections/' in file and 'ssa_detections/' not in file :
139
158
detections_added .append (file )
140
159
if 'stories/' in file :
141
160
stories_added .append (file )
@@ -145,6 +164,9 @@ def release_notes(self, input_dto: DirectorInputDto, old_tag:Union[str,None], ne
145
164
lookups_added .append (file )
146
165
if 'playbooks/' in file :
147
166
playbooks_added .append (file )
167
+ if 'ssa_detections/' in file :
168
+ ba_detections_added .append (file )
169
+
148
170
if new_tag :
149
171
150
172
print (f"Generating release notes - \033 [92m{ latest_tag } \033 [0m" )
@@ -177,6 +199,16 @@ def release_notes(self, input_dto: DirectorInputDto, old_tag:Union[str,None], ne
177
199
print ("\n ### Playbooks Updated" )
178
200
self .create_notes (repo_path ,playbooks_modified )
179
201
180
- print ("\n ### Other Updates\n -\n " )
202
+ print ("\n ### Other Updates\n -\n " )
203
+
204
+ print ("\n ## BA Release Notes" )
205
+
206
+ print ("\n ### New BA Analytics" )
207
+ self .create_notes (repo_path ,ba_detections_added )
208
+
209
+ print ("\n ### Updated BA Analytics" )
210
+ self .create_notes (repo_path ,ba_detections_modified )
211
+
212
+
181
213
182
214
print (f"Release notes completed succesfully" )
0 commit comments