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):
4203
4203
4204
4204
# Adds the task output in case of run failure
4205
4205
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
+
4206
4214
task_output_block = {
4207
4215
"type" : "section" ,
4208
4216
"text" : {
4209
4217
"type" : "mrkdwn" ,
4210
- "text" : f"```{ pipeline_run . task_output } ```" ,
4218
+ "text" : f"```{ output_text } ```" ,
4211
4219
},
4212
4220
}
4213
4221
blocks .append (task_output_block )
You can’t perform that action at this time.
0 commit comments