File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -4203,11 +4203,19 @@ def get_slack_payload(pipeline_run):
42034203
42044204 # Adds the task output in case of run failure
42054205 if pipeline_run .status == Run .Status .FAILURE and pipeline_run .task_output :
4206+ slack_text_max_length = 3000 # Slack's block message limit
4207+ output_text = pipeline_run .task_output
4208+ # Truncate the task output and add an indicator if it was cut off
4209+ if len (output_text ) > slack_text_max_length :
4210+ output_text = (
4211+ output_text [: slack_text_max_length - 30 ] + "\n ... (truncated)"
4212+ )
4213+
42064214 task_output_block = {
42074215 "type" : "section" ,
42084216 "text" : {
42094217 "type" : "mrkdwn" ,
4210- "text" : f"```{ pipeline_run . task_output } ```" ,
4218+ "text" : f"```{ output_text } ```" ,
42114219 },
42124220 }
42134221 blocks .append (task_output_block )
You can’t perform that action at this time.
0 commit comments