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 AnsiConsoleRenderer in TeamCity and Azure Pipelines #2966

Closed
KatoStoelen opened this issue Dec 4, 2020 · 5 comments · Fixed by #2968
Closed

Enable AnsiConsoleRenderer in TeamCity and Azure Pipelines #2966

KatoStoelen opened this issue Dec 4, 2020 · 5 comments · Fixed by #2968
Assignees
Milestone

Comments

@KatoStoelen
Copy link

I see that AnsiConsoleRenderer is enabled for GitHub Actions (and terminals that supports it).

Since both TeamCity (since 9.1) and Azure Pipelines now supports ANSI coloring, it would make the world much more colorful if AnsiConsoleRenderer is enabled for those build systems as well.

@augustoproiete
Copy link
Member

augustoproiete commented Dec 5, 2020

@KatoStoelen I've opened PRs to enable the AnsiConsoleRenderer for Azure Pipelines (#2968) and TeamCity (#2969).

In the meantime (as a workaround) if you want to enable colors today, you can "cheat" by setting an environment variable that will tell Cake that ANSI is supported:

  • If your builds are running on Windows, set an environment variable ConEmuANSI with the value On
  • If your builds are not running on Windows, set an environment variable TERM with the value ansi

This works for any CI system, including TeamCity and Azure Pipelines.


Just be aware that the colors on TeamCity don't look as nice as you'd expect because Cake sets a black background color on the messages, which are displayed on a white background in TeamCity if you're using the default theme.

image


Also, some messages such as the summary report at the end of the build (with green forecolor on a regular console) are not emitting ANSI color codes and instead are using Console.ForegroundColor thus they won't have colors even with the AnsiConsoleRenderer enabled.

@KatoStoelen
Copy link
Author

Thanks, @augustoproiete!

Went looking for ways to customize ConsolePalette, but did not find any (apart from using Cake.Frosting and a custom IConsole). Hence, I started to think that it might be better to make this an opt-in feature. Either that, or make ConsolePalette customizable, or add some BuildSystem specific palettes (might cause issues for people using custom themes).

I guess with your current PRs, there is no way to opt-out of ANSI coloring?

@augustoproiete
Copy link
Member

@KatoStoelen Yes, as you probably noticed the colors are all hard-coded in AnsiConsoleRenderer. at the moment, so supporting custom color palettes would be a new feature to be added.

Cake also doesn't have a way of opting out of ANSI coloring and it would be another new feature to be added. On this one it might make sense to follow the https://no-color.org standard that a number of other CLI systems use.

@KatoStoelen
Copy link
Author

KatoStoelen commented Dec 8, 2020

I'll add new feature requests for both (customizable palette and opt-out of ANSI coloring).

The opt-out feature might be a great addition to this feature, since enabling ANSI coloring in TeamCity, where most people (I'm assuming) have a white background, would be somewhat intrusive.

Customizable palette would also be great, but I understand that this one might require more effort.

augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Dec 22, 2020
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Dec 22, 2020
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Dec 22, 2020
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Jan 4, 2021
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Jan 4, 2021
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Jan 4, 2021
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Jan 24, 2021
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Jan 24, 2021
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Jan 24, 2021
@augustoproiete augustoproiete added this to the v1.x Next Candidate milestone Feb 4, 2021
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Feb 7, 2021
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Feb 7, 2021
augustoproiete added a commit to augustoproiete-forks/cake-build--cake that referenced this issue Feb 7, 2021
@devlead devlead modified the milestones: v1.x Next Candidate, v1.1.0 Feb 13, 2021
devlead pushed a commit to augustoproiete-forks/cake-build--cake that referenced this issue Feb 13, 2021
devlead pushed a commit to augustoproiete-forks/cake-build--cake that referenced this issue Feb 13, 2021
devlead pushed a commit to augustoproiete-forks/cake-build--cake that referenced this issue Feb 13, 2021
devlead pushed a commit to augustoproiete-forks/cake-build--cake that referenced this issue Feb 13, 2021
devlead pushed a commit to augustoproiete-forks/cake-build--cake that referenced this issue Feb 13, 2021
devlead added a commit that referenced this issue Feb 13, 2021
…-azure-pipelines

GH-2966: Enable AnsiConsoleRenderer when running on Azure Pipelines
@augustoproiete augustoproiete self-assigned this Feb 13, 2021
@cake-build-bot
Copy link

🎉 This issue has been resolved in version v1.1.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants