@@ -135,7 +135,7 @@ def existing_work_items(self) -> Iterator[WorkItem]:
135135 continue
136136 yield item
137137
138- def update_existing (self , item : WorkItem ) -> None :
138+ def update_existing (self , item : WorkItem , notification_info : str ) -> None :
139139 if self .config .on_duplicate .comment :
140140 comment = self .render (self .config .on_duplicate .comment )
141141 self .client .add_comment (
@@ -175,6 +175,13 @@ def update_existing(self, item: WorkItem) -> None:
175175
176176 if document :
177177 self .client .update_work_item (document , item .id , project = self .project )
178+ logging .info (
179+ f"notify ado: updated work item { item .id } - { notification_info } "
180+ )
181+ else :
182+ logging .info (
183+ f"notify ado: no update for work item { item .id } - { notification_info } "
184+ )
178185
179186 def render_new (self ) -> Tuple [str , List [JsonPatchOperation ]]:
180187 task_type = self .render (self .config .type )
@@ -195,7 +202,7 @@ def render_new(self) -> Tuple[str, List[JsonPatchOperation]]:
195202 )
196203 return (task_type , document )
197204
198- def create_new (self ) -> None :
205+ def create_new (self ) -> WorkItem :
199206 task_type , document = self .render_new ()
200207
201208 entry = self .client .create_work_item (
@@ -209,15 +216,19 @@ def create_new(self) -> None:
209216 self .project ,
210217 entry .id ,
211218 )
219+ return entry
212220
213- def process (self ) -> None :
221+ def process (self , notification_info : str ) -> None :
214222 seen = False
215223 for work_item in self .existing_work_items ():
216- self .update_existing (work_item )
224+ self .update_existing (work_item , notification_info )
217225 seen = True
218226
219227 if not seen :
220- self .create_new ()
228+ entry = self .create_new ()
229+ logging .info (
230+ "notify ado: created new work item" f" { entry .id } - { notification_info } "
231+ )
221232
222233
223234def is_transient (err : Exception ) -> bool :
@@ -251,18 +262,16 @@ def notify_ado(
251262 return
252263
253264 notification_info = (
254- "job_id:%s task_id:%s container:%s filename:%s" ,
255- report .job_id ,
256- report .task_id ,
257- container ,
258- filename ,
265+ f"job_id:%s{ report .job_id } task_id:{ report .task_id } "
266+ f" container:{ container } filename:{ filename } "
259267 )
268+
260269 logging .info ("notify ado: %s" , notification_info )
261270
262271 try :
263272 ado = ADO (container , filename , config , report )
264273 ado .connect ()
265- ado .process ()
274+ ado .process (notification_info )
266275 except (
267276 AzureDevOpsAuthenticationError ,
268277 AzureDevOpsClientError ,
0 commit comments