@@ -279,7 +279,7 @@ def createThreadConfigMap(cls, namespace: str, instanceId: str, pipelineRunName:
279279 namespace (str): Kubernetes namespace for the ConfigMap
280280 channelId (str): Slack channel ID where the thread was created
281281 threadId (str): Slack thread timestamp
282- instanceId (str): Name of the Mas Instance ID
282+ instanceId (str): Name of the Mas Instance ID (can be None or empty for update pipeline)
283283
284284 Returns:
285285 bool: True if ConfigMap was created successfully, False otherwise
@@ -291,7 +291,9 @@ def createThreadConfigMap(cls, namespace: str, instanceId: str, pipelineRunName:
291291 except Exception :
292292 config .load_kube_config ()
293293 v1 = client .CoreV1Api ()
294- configmap_name = f"slack-thread-{ instanceId } -{ pipelineRunName } "
294+ # For update pipeline (no instance ID), use "update" as identifier
295+ instance_identifier = instanceId if instanceId else "update"
296+ configmap_name = f"slack-thread-{ instance_identifier } -{ pipelineRunName } "
295297 configmap = client .V1ConfigMap (
296298 metadata = client .V1ObjectMeta (
297299 name = configmap_name ,
@@ -316,7 +318,7 @@ def getThreadConfigMap(cls, namespace: str, instanceId: str, pipelineRunName: st
316318
317319 Parameters:
318320 namespace (str): Kubernetes namespace containing the ConfigMap
319- instanceId (str): Unique identifier for the pipeline run
321+ instanceId (str): Unique identifier for the pipeline run (can be None or empty for update pipeline)
320322
321323 Returns:
322324 dict | None: Dictionary containing threadId, channelId, pipelineName, and startTime, or None if not found
@@ -328,7 +330,9 @@ def getThreadConfigMap(cls, namespace: str, instanceId: str, pipelineRunName: st
328330 except Exception :
329331 config .load_kube_config ()
330332 v1 = client .CoreV1Api ()
331- configmap_name = f"slack-thread-{ instanceId } -{ pipelineRunName } "
333+ # For update pipeline (no instance ID), use "update" as identifier
334+ instance_identifier = instanceId if instanceId else "update"
335+ configmap_name = f"slack-thread-{ instance_identifier } -{ pipelineRunName } "
332336 configmap = v1 .read_namespaced_config_map (name = configmap_name , namespace = namespace )
333337 logger .debug (f"Retrieved ConfigMap { configmap_name } from namespace { namespace } " )
334338 return configmap .data
@@ -348,7 +352,7 @@ def updateThreadConfigMap(cls, namespace: str, instanceId: str, updates: dict, p
348352
349353 Parameters:
350354 namespace (str): Kubernetes namespace containing the ConfigMap
351- instanceId (str): Unique identifier for the pipeline run
355+ instanceId (str): Unique identifier for the pipeline run (can be None or empty for update pipeline)
352356 updates (dict): Dictionary of key-value pairs to add/update in the ConfigMap
353357
354358 Returns:
@@ -361,7 +365,9 @@ def updateThreadConfigMap(cls, namespace: str, instanceId: str, updates: dict, p
361365 except Exception :
362366 config .load_kube_config ()
363367 v1 = client .CoreV1Api ()
364- configmap_name = f"slack-thread-{ instanceId } -{ pipelineRunName } "
368+ # For update pipeline (no instance ID), use "update" as identifier
369+ instance_identifier = instanceId if instanceId else "update"
370+ configmap_name = f"slack-thread-{ instance_identifier } -{ pipelineRunName } "
365371
366372 # Get existing ConfigMap
367373 configmap = v1 .read_namespaced_config_map (name = configmap_name , namespace = namespace )
@@ -385,6 +391,7 @@ def deleteThreadConfigMap(cls, namespace: str, instanceId: str, pipelineRunName:
385391
386392 Parameters:
387393 namespace (str): Kubernetes namespace containing the ConfigMap
394+ instanceId (str): Unique identifier for the pipeline run (can be None or empty for update pipeline)
388395 pipelineRunName (str): Unique identifier for the pipeline run
389396
390397 Returns:
@@ -398,7 +405,9 @@ def deleteThreadConfigMap(cls, namespace: str, instanceId: str, pipelineRunName:
398405 config .load_kube_config ()
399406
400407 v1 = client .CoreV1Api ()
401- configmap_name = f"slack-thread-{ instanceId } -{ pipelineRunName } "
408+ # For update pipeline (no instance ID), use "update" as identifier
409+ instance_identifier = instanceId if instanceId else "update"
410+ configmap_name = f"slack-thread-{ instance_identifier } -{ pipelineRunName } "
402411 v1 .delete_namespaced_config_map (name = configmap_name , namespace = namespace )
403412 logger .info (f"Deleted ConfigMap { configmap_name } from namespace { namespace } " )
404413 return True
0 commit comments