Selectively respond to chatops with output of specific script line
Right now managing the out of a chatops job with a before_script or multiple commands, is not as easy as it should be. Each command is output, wrapped in ANSI color codes. This can make reading the output unnecessarily difficult for chat clients, which do not support ANSI color codes. Further, it is not trivial to selectively reply with the output of one command.
The command's output must be wrapped with section identifiers. For example: echo -e "section_start:$( date +%s ):chat_reply\r\033[0K\n$( ls -la )\nsection_end:$( date +%s ):chat_reply\r\033[0K".
One option we could consider is adding support for replying with contents of a text file artifact that was persisted by the job.
This offers a few benefits:
- Selectively replying with the output of a command is as simple as redirecting it to a file.
- The output from multiple commands could be concatenated together, if desired.
- Text files are easy to work with and manipulate in shells, providing a flexible way to build the reply.
Edited by silv