anyone know why circleci wont display ANSI colors ...
# general
b
anyone know why circleci wont display ANSI colors for pulumi? 😢
w
@bitter-oil-46081 @lemon-spoon-91807 Any idea?
l
can you clarify a bit more?
what are you seeing?
For example, are you seeing no colors, but would like them?
are you seeing control codes printed out, but not colorized?
something else entirely?
b
The issue is probably here: https://github.com/pulumi/pulumi/blob/6e29ada4b8478b8cc0f1fcf57991b131e21987ed/pkg/util/cmdutil/diag.go#L38-L44 I would guess that when run as part of CircleCI, we don't believe we are connected to a terminal and so we don't print the color codes.
b
pulumi preview --non-interactive --color always
@lemon-spoon-91807 ^
l
Thanks!
since you're seeing this:
that means that pulumi thinks this is not a terminal
which would also explain the lack of colors
b
anything that can be done to override that?
im guessing its not just as simple as setting
TERM
env var
l
i don't k now enoug about unix+go to know 🙂
i spelunked through the go code, and this bottoms out in stuff that's really beyond me unfortunately. Sorry! Maybe someone else will have an idea.
b
setting
--color raw
should ignore it
lets see
lol no it just looks fucked up lol
l
yeah, that says to just echo raw colorization codes
and really, that value only exists so we can test things 🙂
b
ugh
thought it was gonna be bash color codes
i might compile a custom binary just for this
l
is there anything online about how to get circleci to behave more like a terminal?
b
@lemon-spoon-91807 Is the issue possibly what Matt pointed out? That we are intentionally switching to
color.Never
, due to
Copy code
if globalColorization == colors.Always && !terminal.IsTerminal(int(os.Stdout.Fd())) {
		return colors.Never
	}
? Not sure, but if so, it seems like if someone explicitly asked for colorization, we should respect it?
b
IMHO, we should bring back the Auto value for colorization (and have it be the default) and update the above to check colors.Auto instead of Always and just respect Always, Never and Raw.
👍 2
💯 1
g
just ran into the same problem on gitlab ci
w
l
If you now pass
--color=always
, we'll respect that and actually print colors no matter what. Leaving out the command line option, or specifying 'auto' will put us in the mode where we try to figure out what's best in terms or colors or not.