Skip to content

🐛 Split ko matcher so either setup-ko spelling is detected - #5195

Open
rylena wants to merge 1 commit into
ossf:mainfrom
rylena:fix/packaging-ko-matcher
Open

🐛 Split ko matcher so either setup-ko spelling is detected#5195
rylena wants to merge 1 commit into
ossf:mainfrom
rylena:fix/packaging-ko-matcher

Conversation

@rylena

@rylena rylena commented Aug 24, 2026

Copy link
Copy Markdown

Description

Fixes #5133.

The ko entry in IsPackagingWorkflow (checks/fileparser/github_workflow.go) listed imjasonh/setup-ko and ko-build/setup-ko as two steps of a single JobMatcher. JobMatcher.matches() requires every listed step to match (AND semantics), but a real workflow uses only one of the two spellings — they are the pre-/post-rename names of the same action — so the ko matcher could never fire and ko container publishing was never detected by the Packaging check.

This change splits the entry into two single-step matchers, which is the shape every other ecosystem entry uses, and adds test fixtures for both spellings.

Additive only: no existing workflow's detection result can change; ko workflows simply move from "packaging workflow not detected" to detected.

Verification

Reproduced failing-then-passing with the new fixtures:

  1. With only the new fixtures/tests added and the old matcher code restored:
    go test ./checks/fileparser -run 'TestIsPackagingWorkflow/ko' -count=1
    FAIL: TestIsPackagingWorkflow/ko_publish_(renamed_action) and FAIL: .../ko_publish_(legacy_action) (isPackagingWorkflow() = false, expected true)
  2. With this fix applied:
    • go test ./checks/fileparser -run 'TestIsPackagingWorkflow' -count=1 → all 20 subtests PASS (including the 2 new ones)
    • go test ./checks/fileparser -count=1 → full package suite PASS
    • gofmt -l checks/fileparser/ → clean
    • go vet ./checks/fileparser → clean
    • git diff --check → clean

Signed-off per CONTRIBUTING.md (DCO).

JobMatcher.matches() requires every listed step to match (AND
semantics). The ko entry listed both imjasonh/setup-ko and
ko-build/setup-ko as steps of one JobMatcher, but a workflow uses
only one of them, so the matcher could never fire and ko publishing
was never detected by the Packaging check.

Split it into two single-step matchers (the shape every other
ecosystem entry uses) and add test fixtures for both spellings.

Fixes ossf#5133

Signed-off-by: Rylen Anil <rylen.anil@gmail.com>
@rylena
rylena requested a review from a team as a code owner August 24, 2026 05:08
@rylena
rylena requested review from AdamKorcz and justaugustus and removed request for a team August 24, 2026 05:08
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 24, 2026
@rylena rylena changed the title fix(packaging): split ko matcher so either setup-ko spelling is detected 🐛 Split ko matcher so either setup-ko spelling is detected Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

BUG: Packaging check's ko matcher requires BOTH setup-ko spellings in one job, so ko publishing is never detected

1 participant