Fix CLI SOURCE column for GitHub/Slack TaskSpawners

Merged
KE
5mo ago
+134-12

What type of PR is this?

/kind bug

What this PR does / why we need it:

The SOURCE column in kelos get taskspawners was misleading in two ways:

  1. GitHub Issues / Pull Requests spawners showed the workspace name.
    When a workspaceRef was set (which is required for both source types),
    printTaskSpawnerTable overrode the source label with the workspace
    name. Since the workspace ref is required, users almost always saw
    my-workspace instead of GitHub Issues / GitHub Pull Requests,
    making the table unreadable. The workspace is already shown separately
    in the -d detail view.

  2. Slack spawners showed an empty SOURCE. There was no Slack branch
    in either printTaskSpawnerTable or printTaskSpawnerDetail, so the
    SOURCE column was blank for Slack spawners and -d rendered no
    Slack-specific fields (channels, triggers, exclude patterns).

This PR:

  • Always prints GitHub Issues / GitHub Pull Requests for those sources
    (workspace remains visible in detail view).
  • Adds a Slack branch to the table view.
  • Adds a Slack branch to the detail view that prints Channels,
    Triggers, and Exclude Patterns when set.
  • Updates the existing GitHubPullRequests table test (which asserted the
    buggy workspace-name behavior) and adds positive tests for GitHub Issues
    with a workspace, Slack table output, and Slack detail output.

Which issue(s) this PR is related to:

Fixes #1147

Special notes for your reviewer:

N/A

Does this PR introduce a user-facing change?

Fix `kelos get taskspawners` SOURCE column to show `GitHub Issues` or `GitHub Pull Requests` instead of the workspace name, and to show `Slack` for Slack-based spawners. `kelos get taskspawner -d` now also prints Slack channels, triggers, and exclude patterns.

Summary by cubic

Fixes the SOURCE column in kelos get taskspawners to show the actual source for GitHub and Slack spawners. Improves table clarity and adds Slack details in the -d view.

  • Bug Fixes
    • Table: Always show "GitHub Issues" or "GitHub Pull Requests" (not the workspace name). Show "Slack" for Slack spawners.
    • Detail: Print Slack Channels, Triggers, and Exclude Patterns.
    • Tests: Updated GitHub PR table; added GitHub Issues (with workspace) and Slack table/detail tests; tightened Slack table check by renaming the fixture to avoid false positives.