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

ginkgo: disable color escape sequences by default when not connected to a terminal #111633

Merged
merged 1 commit into from Aug 2, 2022

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Aug 2, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

This applies to all jobs using hack/ginkgo-e2e.sh. This is done because
Spyglass does not render the escape sequences, making test output harder to
read:

[BeforeEach] [sig-node] Probing container
  test/e2e/framework/framework.go:186
�[1mSTEP:�[0m Creating a kubernetes client �[38;5;243m08/02/22 07:59:02.423�[0m
Aug  2 07:59:02.423: INFO: >>> kubeConfig: /root/.kube/kind-test-config

It is done here because then we don't need to set GINKGO_NO_COLOR in all the
different Prow job configs.

Special notes for your reviewer:

Discussed in #111627 (comment)

Does this PR introduce a user-facing change?

ginkgo: when e2e tests are invoked through ginkgo-e2e.sh, the default now is to use color escape sequences only when connected to a terminal. `GINKGO_NO_COLOR=y/n` can be used to override that default.

/cc @aojea

…to a terminal

This applies to all jobs using hack/ginkgo-e2e.sh. This is done because
Spyglass does not render the escape sequences, making test output harder to
read.

It is done here because then we don't need to set GINKGO_NO_COLOR in all the
different Prow job configs.
@k8s-ci-robot k8s-ci-robot requested a review from aojea August 2, 2022 12:22
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 2, 2022
# Since Kubernetes 1.25, the default is to use colors only when connected to
# a terminal. That is the right choice for all Prow jobs (Spyglass doesn't
# render them properly).
GINKGO_NO_COLOR=${GINKGO_NO_COLOR:-$(if [ -t 2 ]; then echo n; else echo y; fi)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL https://unix.stackexchange.com/a/401938

why only on 2? and not 0? any special reason

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we care about the output, not the input.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(And because stderr is where fancy diagnostic output should be going as opposed to structured program output to stdout, so stderr not stdout)

@aojea
Copy link
Member

aojea commented Aug 2, 2022

/sig testing
assign bash masters
/assign @thockin @BenTheElder
/lgtm

@k8s-ci-robot k8s-ci-robot added sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 2, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 2, 2022
Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve
approving as a reasonable quick fix, but noting that failing to render escape sequences is a regression over the gubernator log viewer, and sounds like a spyglass bug

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, pohly

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 2, 2022
@pohly
Copy link
Contributor Author

pohly commented Aug 2, 2022

sounds like a spyglass bug

Even if this got fixed I would still prefer to not have the escape sequences. Directly viewing the full log (i.e. https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/111633/pull-kubernetes-e2e-gce-100-performance/1554442569306345472/build-log.txt) also didn't support them.

@BenTheElder
Copy link
Member

/priority important-soon
/triage accepted

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 2, 2022
@k8s-ci-robot k8s-ci-robot merged commit 448e48b into kubernetes:master Aug 2, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.25 milestone Aug 2, 2022
@aojea
Copy link
Member

aojea commented Aug 3, 2022

awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants