Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable console colours under Azure Pipelines #150

Closed
blairconrad opened this issue Nov 17, 2018 · 15 comments
Closed

Enable console colours under Azure Pipelines #150

blairconrad opened this issue Nov 17, 2018 · 15 comments
Labels
question Further information is requested

Comments

@blairconrad
Copy link
Contributor

blairconrad commented Nov 17, 2018

Under Bullseye 2.2.0, on Azure pipelines, the build output is not coloured, instead displaying the ANSI escape codes:

image

(from https://dev.azure.com/blairconrad/SendComics/_build/results?buildId=9&view=logs)

I'd offer to help, but I am not sure where to start!

@adamralph adamralph self-assigned this Nov 17, 2018
@adamralph
Copy link
Owner

Hi @blairconrad! Unfortunately I suspect there is little that can be done about this. Either a console supports ANSI colouring or it doesn't. You may find that the best course of action is to switch off colouring with the --no-color option.

Out of interest, can you try re-running it with the --verbose option? When running on Windows, Bullseye attempts to switch on ANSI colouring using the Win32 API. The verbose output might give us some insight into why that fails in this environment.

@blairconrad
Copy link
Contributor Author

Ah, thanks, @adamralph. I should've thought about the need for ANSI support. I built with --verbose:

2018-11-17T17:20:50.1410759Z Bullseye: Got a handle to the standard output device (GetStdHandle): 2164
2018-11-17T17:20:50.1413863Z Bullseye: Failed to get the current output mode of the console screen buffer (GetConsoleMode). Error code: 6
2018-11-17T17:20:50.1471639Z �[36mBullseye�[37m: �[0m�[90mVersion: 2.2.0+2fee2d5f074ee03dea3b0a899551c2da0dd1480d
2018-11-17T17:20:50.1490203Z �[36mBullseye�[37m: �[0m�[90mHost: Unknown
2018-11-17T17:20:50.1490465Z �[36mBullseye�[37m: �[0m�[90mOS: Windows
2018-11-17T17:20:50.1490824Z �[36mBullseye�[37m: �[0m�[90mArgs: --verbose
2018-11-17T17:20:50.1566686Z �[36mBullseye�[37m: �[0m�[37mStarting...�[97m (default)�[0m
2018-11-17T17:20:50.1732460Z �[36mBullseye�[37m/�[36mdefault�[37m: �[0m�[90mWalking dependencies...
2018-11-17T17:20:50.1732867Z �[36mBullseye�[37m/�[36mdefault�[37m/�[36mtest�[37m: �[0m�[90mWalking dependencies...
2018-11-17T17:20:50.1733134Z �[36mBullseye�[37m/�[36mdefault�[37m/�[36mtest�[37m/�[36mbuild�[37m: �[0m�[90mWalking dependencies...
2018-11-17T17:20:50.1733380Z �[36mBullseye�[37m/�[36mdefault�[37m/�[36mtest�[37m/�[36mbuild�[37m: �[0m�[90mAwaiting...
2018-11-17T17:20:50.1776379Z �[36mBullseye�[37m/�[36mbuild�[37m: �[0m�[37mStarting...�[0m

Seems the handle is invalid. Not that surprising, I suppose. There is a defunct UserVoice request for this feature. I can take a peek and see where we request these features now.

@blairconrad
Copy link
Contributor Author

Ah. There's an existing issue. Took some searching. microsoft/azure-pipelines-agent#1569

@adamralph
Copy link
Owner

adamralph commented Nov 17, 2018

Seems the handle is invalid. Not that surprising, I suppose.

Yeah, I don't think this works on build servers at all. I was more just curious to see the logs. It fails on Appveyor too but Appveyor respects the ANSI codes, so it's fine.

I guess you just need to wait for that issue to be fixed, and perhaps consider the --no-color option in the meantime.

@adamralph
Copy link
Owner

Perhaps this could go into an FAQ.

@blairconrad
Copy link
Contributor Author

Yeah, I'll probably turn on --no-color. I've also checked out the azure-pipelines-agent, in case I can see an easy way to fix it. (I've low hopes.)

Thanks for your time!

@adamralph adamralph removed their assignment Nov 18, 2018
@adamralph
Copy link
Owner

Closing in favour of microsoft/azure-pipelines-agent#1569.

@adamralph
Copy link
Owner

@blairconrad now that microsoft/azure-pipelines-agent#1569 has been released, it would be interested to see how your build looks.

@blairconrad
Copy link
Contributor Author

But I've been logged out for over 5 minutes! How will I know?
But seriously, I will push something soonish.

@blairconrad
Copy link
Contributor Author

It is more better! Not quite what I expected, but tonnes more readable. I am a content person.

https://dev.azure.com/blairconrad/SendComics/_build/results?buildId=14

image

Thanks!

@adamralph
Copy link
Owner

Definitely an improvement. If I'm not too lazy, I may introduce an optimised palette for Azure Piplines.

@blairconrad
Copy link
Contributor Author

blairconrad commented Dec 14, 2018

Like the one you can see at https://dev.azure.com/blairconrad/blair%20bullseye/_build/results?buildId=18?

(Ignore the bonus environment variables at the top.)

PR coming soon! Would you want me to add a azure-pipelines.yml for the smoke tests?

@blairconrad
Copy link
Contributor Author

Whoops. I meant to start a PR to my own repo and sent it to yours. #199. Carrying on!

@tlian
Copy link

tlian commented Feb 14, 2020

Where is this setting to turn off coloring (i.e. --no-color option)?

@adamralph
Copy link
Owner

@tlian if you follow the quick start you will see it when you run dotnet run -- --help:

 -N, --no-color             Disable colored output

You can specify it like so:

dotnet run -- --no-color`

or

dotnet run -- -N

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants