Skip to content

Test for workflow attribution#37593

Closed
joestringer wants to merge 21 commits intopr/joe/test-attributionfrom
pr/joe/test-attribution+test-wf-env
Closed

Test for workflow attribution#37593
joestringer wants to merge 21 commits intopr/joe/test-attributionfrom
pr/joe/test-attribution+test-wf-env

Conversation

@joestringer
Copy link
Copy Markdown
Member

This PR is just testing that workflow attribution via GH env vars is working
as expected.

ScenarioBase provides common functionality for all scenarios, such as
the upcoming feature to correlate test files with GitHub codeowners.
Compose all existing scenarios with this new structure so we can
minimize the amount of boilerplate code required to identify such
codeowners.

Signed-off-by: Joe Stringer <[email protected]>
This library parses GitHub CODEOWNERS syntax and makes the owners
available within the code for programmatic usage.

Signed-off-by: Joe Stringer <[email protected]>
Correlate the test scenarios with the GitHub teams that own these test
scenarios, so that we can pretty-print some helpful assistance to
developers in CI when a test fails.

The intent here is that this makes the developer experience easier by
connecting developers who are struggling with a CI failure with the
owners of those tests.

Signed-off-by: Joe Stringer <[email protected]>
When reporting owners of test files as part of the --log-codeowners
parameter, autodetect the workflow file from the environment variable
GITHUB_WORKFLOW_REF which GitHub sets in the environment in order to
list the owners for the workflow itself while listing owners for a
failed test.

Signed-off-by: Joe Stringer <[email protected]>
This tool takes JSON output as presented by 'go test -json ...' on stdin
and outputs a table with the failed tests and any corresponding owners.

Example usage:

  $ go test -json ./test/fail/ | go run ./tools/testowners/
  ⛑️ The following owners are responsible for reliability of the failing test(s):
  Package                              Owner
  github.com/cilium/cilium/test/fail   @cilium/ci-structure

Signed-off-by: Joe Stringer <[email protected]>
LOG_CODEOWNERS=1 will log the codeowners corresponding to a unit test
failure when the Makefile hands unit test output to its GOTEST
formatters.

Example (with tparse installed):

$ LOG_CODEOWNERS=1 TESTPKGS=./pkg/policy make tests-privileged
  CHECK   running privileged tests...
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃   PANIC  package: github.com/cilium/cilium/pkg/datapath/linux/ipsec • TestInvalidLoadKeys   ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
panic: localNode already set [recovered]
        panic: localNode already set

goroutine 11 [running]:
testing.tRunner.func1.2({0x2bbea80, 0x36d57a0})
        /snap/go/10826/src/testing/testing.go:1632 +0x230
testing.tRunner.func1()
        /snap/go/10826/src/testing/testing.go:1635 +0x35e
panic({0x2bbea80?, 0x36d57a0?})
        /snap/go/10826/src/runtime/panic.go:785 +0x132
github.com/cilium/cilium/pkg/node.SetTestLocalNodeStore(...)
        /var/git/cilium/pkg/node/address.go:552
github.com/cilium/cilium/pkg/datapath/linux/ipsec.setupIPSecSuitePrivileged({0x3742670, 0xc0000ebd40})
        /var/git/cilium/pkg/datapath/linux/ipsec/ipsec_linux_test.go:27 +0x1eb
github.com/cilium/cilium/pkg/datapath/linux/ipsec.TestInvalidLoadKeys(0xc0000ebd40)
        /var/git/cilium/pkg/datapath/linux/ipsec/ipsec_linux_test.go:66 +0x31
testing.tRunner(0xc0000ebd40, 0x3445310)
        /snap/go/10826/src/testing/testing.go:1690 +0xf4
created by testing.(*T).Run in goroutine 1
        /snap/go/10826/src/testing/testing.go:1743 +0x390
FAIL    github.com/cilium/cilium/pkg/datapath/linux/ipsec       0.032s

make: *** [Makefile:89: tests-privileged] Error 1
┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│  STATUS │ ELAPSED │                      PACKAGE                      │ COVER │ PASS │ FAIL │ SKIP  │
│─────────┼─────────┼───────────────────────────────────────────────────┼───────┼──────┼──────┼───────│
│  PANIC  │  0.00s  │ github.com/cilium/cilium/pkg/datapath/linux/ipsec │  --   │  --  │  --  │  --   │
│  PASS   │  0.84s  │ github.com/cilium/cilium/pkg/policy               │ 76.9% │ 518  │  0   │  0    │
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘
⛑️ The following owners are responsible for reliability of the failing test(s):
Package                                             Owner
github.com/cilium/cilium/pkg/datapath/linux/ipsec   @cilium/ipsec

Signed-off-by: Joe Stringer <[email protected]>
@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper maintainer-s-little-helper bot added dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Feb 12, 2025
@github-actions github-actions bot added cilium-cli This PR contains changes related with cilium-cli cilium-cli-exclusive This PR only impacts cilium-cli binary labels Feb 12, 2025
@joestringer joestringer added dont-merge/preview-only Only for preview or testing, don't merge it. and removed cilium-cli This PR contains changes related with cilium-cli cilium-cli-exclusive This PR only impacts cilium-cli binary labels Feb 12, 2025
@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper
Copy link
Copy Markdown

@joestringer joestringer force-pushed the pr/joe/test-attribution+test-wf-env branch from 653f190 to 5c06e2c Compare February 12, 2025 22:34
@maintainer-s-little-helper
Copy link
Copy Markdown

@joestringer joestringer force-pushed the pr/joe/test-attribution+test-wf-env branch from 5c06e2c to 208b73e Compare February 12, 2025 22:47
@maintainer-s-little-helper
Copy link
Copy Markdown

@joestringer joestringer force-pushed the pr/joe/test-attribution+test-wf-env branch from 208b73e to db98249 Compare February 12, 2025 23:12
@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper
Copy link
Copy Markdown

@joestringer joestringer force-pushed the pr/joe/test-attribution branch from 4eed807 to 98d04cd Compare February 13, 2025 15:05
@joestringer
Copy link
Copy Markdown
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. dont-merge/preview-only Only for preview or testing, don't merge it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant