[go: up one dir, main page]

Skip to content

fix(ci view): display masked variables in job logs

Description

  • fix(ci view): display masked variables in job logs

When viewing CI job logs with glab ci view, masked variables like [MASKED] were being stripped from the display. This occurred because tview interprets square brackets as color tag markers, and with SetDynamicColors(true) enabled, it attempted to parse [MASKED] as a color tag and removed it when it wasn't valid.

This fix introduces a bracketEscaper that sits at the beginning of the writer chain and escapes literal closing brackets ] to [] (following tview's escaping convention) while preserving ANSI escape sequences needed for colors. The escaper is ANSI-aware, detecting and preserving ANSI escape sequences (which start with ESC[) while only escaping literal text brackets.

Processing chain:

  1. Raw trace with ANSI codes and [MASKED] text
  2. bracketEscaper: Escapes ] to [] while preserving ANSI codes
  3. vtclean: Cleans terminal control sequences, preserves colors
  4. ANSIWriter: Converts ANSI codes to tview color tags
  5. TextView: Displays with colors and escaped brackets

Fixes #8008

Related Issues

Resolves #[issue_number]

How has this been tested?

Run the following command with a build from main:

./bin/glab ci view -b master -R phikai/my-public-test-project

Notice that the log output says:

MASKED variables's value is

Now build this branch and run the same command. Notice the output is now:

MASKED variables's value is [MASKED]

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap
Edited by Kai Armstrong

Merge request reports

Loading