Copy pasting build output into GitHub break formatting

Using a public build as an example: Rails #104016

17 01 2024 03:20:20.700:ERROR [karma-server]: Error: [init({"version":"70","platform":"ANY","tags":[],"name":"ActionCable JS Client","tunnel-identifier":"karma1705461603","record-video":false,"record-screenshots":false,"device-orientation":null,"disable-popup-handler":true,"build":"Buildkite 018d155d-c0f8-459f-972b-4546f68e8c28","public":null,"commandTimeout":300,"idleTimeout":90,"maxDuration":1800,"customData":{},"base":"SauceLabs","browserName":"chrome"})] The environment you requested was unavailable.
Sauce could not start your job. For more information on what happened, please visit https://app.saucelabs.com/tests/5cd54c0077b54e718a62fe4008ea84f7
    at /rails/node_modules/wd/lib/webdriver.js:157:15
    at Request._callback (/rails/node_modules/wd/lib/http-utils.js:89:7)
    at self.callback (/rails/node_modules/request/request.js:185:22)
    at Request.emit (node:events:517:28)
    at Request.<anonymous> (/rails/node_modules/request/request.js:1161:10)
    at Request.emit (node:events:517:28)
    at IncomingMessage.<anonymous> (/rails/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (node:events:631:28)
    at IncomingMessage.emit (node:events:529:35)
    at endReadableNT (node:internal/streams/readable:1400:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  data: '{"status": 13, "sessionId": "5cd54c0077b54e718a62fe4008ea84f7", "value": {"message": "Sauce could not start your job. For more information on what happened, please visit https://app.saucelabs.com/tests/5cd54c0077b54e718a62fe4008ea84f7"}}'
}

If I copy paste this in GitHub comment it turns into:


17 01 2024 03:20:20.700:ERROR [karma-server]: Error: [init({"version":"70","platform":"ANY","tags":[],"name":"ActionCable JS Client","tunnel-identifier":"karma1705461603","record-video":false,"record-screenshots":false,"device-orientation":null,"disable-popup-handler":true,"build":"Buildkite 018d155d-c0f8-459f-972b-4546f68e8c28","public":null,"commandTimeout":300,"idleTimeout":90,"maxDuration":1800,"customData":{},"base":"SauceLabs","browserName":"chrome"})] The environment you requested was unavailable.
--
  | Sauce could not start your job. For more information on what happened, please visit https://app.saucelabs.com/tests/5cd54c0077b54e718a62fe4008ea84f7
  | at /rails/node_modules/wd/lib/webdriver.js:157:15
  | at Request._callback (/rails/node_modules/wd/lib/http-utils.js:89:7)
  | at self.callback (/rails/node_modules/request/request.js:185:22)
  | at Request.emit (node:events:517:28)
  | at Request.<anonymous> (/rails/node_modules/request/request.js:1161:10)
  | at Request.emit (node:events:517:28)
  | at IncomingMessage.<anonymous> (/rails/node_modules/request/request.js:1083:12)
  | at Object.onceWrapper (node:events:631:28)
  | at IncomingMessage.emit (node:events:529:35)
  | at endReadableNT (node:internal/streams/readable:1400:12)
  | at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  | data: '{"status": 13, "sessionId": "5cd54c0077b54e718a62fe4008ea84f7", "value": {"message": "Sauce could not start your job. For more information on what happened, please visit https://app.saucelabs.com/tests/5cd54c0077b54e718a62fe4008ea84f7"}}'
  | }

(notice the extra |) which result in a hard to read comment:

Hey @byroot

Welcome to the Buildkite Community Forums!

That an interesting oberservation there and I’ve tried using the Build logs you’ve shared to try and reproduce it on MacOS but without success.

Are you seeing the extra | being added when pasting elsewhere other than GitHub?
Additionally, is it being pasted with or without formatting? I know different Operating Systems handle formatting of text differently.

Cheers,

Tom

Right, I should have included platform information.

I’m on macOS too, using Google chrome (version likely don’t matter has this issue has been pretty much forever).

Are you seeing the extra | being added when pasting elsewhere other than GitHub?

Not that I can remember, I rarely post code elsewhere though.

is it being pasted with or without formatting?

That’s not something I’m familiar with. I just cmd+c and cmd+v, whatever the default macOS setting is, it’s likely the one I run.

Also I workaround this by first pasting in an editor, copying again from there and then pasting in github.

Alright, this prompted me to test more.

I tried from Firefox, and indeed no problem there. I also tried copying from Chrome and pasting in Firefox, and the output was impacted.

So it seem exclusive to Chrome’s copy, it’s likely trying to copy it as some form of rich text.

Cheers for the reply and testing @byroot !

That’s a good find, I never expected a web browser to affect the formatting of text but there is probably a reason of why Chrome is doing it.

Let us know if you notice anything else strange or have any issue with Buildkite!

Cheers,

Tom

Well, I’m pretty much stuck with Chrome at work, so switching browsers isn’t really an option for me.

Ok, so copy pasting into Google Docs generate a single column table, and inspecting the buildkite output shows the rendering is done with tr/td (HTML table), so that is likely what’s going on here.

The output is copied as rich (HTML?) text, and GitHub comment editor accept rich paste and tries to turn it into a Markdown table (|).

But I’m not aware of any way to prevent chrome from doing a rich copy :confused: aside from not using tables to render output, but I get that’s not trivial.

Hey @byroot

I can confirm that the Build Log Output is rendered on the UI to HTML using our terminal-to-html tool.

Looking into this for you, you could either use the Raw Log output to have the logs in plaintext. Though that will have some character encoding in it.

Alternatively, when copying and pasting the HTML rendered output, you can Paste and Match Style on MacOS with SHIFT+CMD+V.

To keep the general formatting, would recommending putting the output in a markdown code block.

Hope that helps.

Tom

Oh! TIL about SHIFT+CMD+V, thanks a lot!

Hey @byroot

No problems, happy to help! :raised_hands:

Cheers,

Tom