@@ -271,7 +271,7 @@ def buildDivider(cls) -> dict:
271271 Returns:
272272 dict: Slack block kit divider element
273273 """
274- def createThreadConfigMap (cls , namespace : str , channelId : str , threadId : str , instanceId : str ) -> bool :
274+ def createThreadConfigMap (cls , namespace : str , instanceId : str , pipelineRunName : str ) -> bool :
275275 """
276276 Create a ConfigMap to store Slack thread information for a pipeline run.
277277
@@ -291,15 +291,14 @@ def createThreadConfigMap(cls, namespace: str, channelId: str, threadId: str, in
291291 except Exception :
292292 config .load_kube_config ()
293293 v1 = client .CoreV1Api ()
294- configmap_name = f"slack-thread-{ instanceId } "
294+ configmap_name = f"slack-thread-{ instanceId } - { pipelineRunName } "
295295 configmap = client .V1ConfigMap (
296296 metadata = client .V1ObjectMeta (
297297 name = configmap_name ,
298298 namespace = namespace
299299 ),
300300 data = {
301- "threadId" : threadId ,
302- "channelId" : channelId ,
301+ "pipelineName" : pipelineRunName ,
303302 "instanceId" : instanceId ,
304303 "startTime" : datetime .now (timezone .utc )
305304 }
@@ -311,7 +310,7 @@ def createThreadConfigMap(cls, namespace: str, channelId: str, threadId: str, in
311310 logger .error (f"Failed to create ConfigMap: { e } " )
312311 return False
313312
314- def getThreadConfigMap (cls , namespace : str , instanceId : str ) -> dict | None :
313+ def getThreadConfigMap (cls , namespace : str , instanceId : str , pipelineRunName : str ) -> dict | None :
315314 """
316315 Retrieve Slack thread information from a ConfigMap.
317316
@@ -329,7 +328,7 @@ def getThreadConfigMap(cls, namespace: str, instanceId: str) -> dict | None:
329328 except Exception :
330329 config .load_kube_config ()
331330 v1 = client .CoreV1Api ()
332- configmap_name = f"slack-thread-{ instanceId } "
331+ configmap_name = f"slack-thread-{ instanceId } - { pipelineRunName } "
333332 configmap = v1 .read_namespaced_config_map (name = configmap_name , namespace = namespace )
334333 logger .debug (f"Retrieved ConfigMap { configmap_name } from namespace { namespace } " )
335334 return configmap .data
@@ -343,7 +342,7 @@ def getThreadConfigMap(cls, namespace: str, instanceId: str) -> dict | None:
343342 logger .error (f"Failed to retrieve ConfigMap: { e } " )
344343 return None
345344
346- def updateThreadConfigMap (cls , namespace : str , instanceId : str , updates : dict ) -> bool :
345+ def updateThreadConfigMap (cls , namespace : str , instanceId : str , updates : dict , pipelineRunName : str ) -> bool :
347346 """
348347 Update the ConfigMap with additional data (e.g., task message timestamps).
349348
@@ -362,7 +361,7 @@ def updateThreadConfigMap(cls, namespace: str, instanceId: str, updates: dict) -
362361 except Exception :
363362 config .load_kube_config ()
364363 v1 = client .CoreV1Api ()
365- configmap_name = f"slack-thread-{ instanceId } "
364+ configmap_name = f"slack-thread-{ instanceId } - { pipelineRunName } "
366365
367366 # Get existing ConfigMap
368367 configmap = v1 .read_namespaced_config_map (name = configmap_name , namespace = namespace )
@@ -380,7 +379,7 @@ def updateThreadConfigMap(cls, namespace: str, instanceId: str, updates: dict) -
380379 logger .error (f"Failed to update ConfigMap: { e } " )
381380 return False
382381
383- def deleteThreadConfigMap (cls , namespace : str , instanceId : str ) -> bool :
382+ def deleteThreadConfigMap (cls , namespace : str , instanceId : str , pipelineRunName : str ) -> bool :
384383 """
385384 Delete the ConfigMap containing Slack thread information.
386385
@@ -399,7 +398,7 @@ def deleteThreadConfigMap(cls, namespace: str, instanceId: str) -> bool:
399398 config .load_kube_config ()
400399
401400 v1 = client .CoreV1Api ()
402- configmap_name = f"slack-thread-{ instanceId } "
401+ configmap_name = f"slack-thread-{ instanceId } - { pipelineRunName } "
403402 v1 .delete_namespaced_config_map (name = configmap_name , namespace = namespace )
404403 logger .info (f"Deleted ConfigMap { configmap_name } from namespace { namespace } " )
405404 return True
0 commit comments