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

syz-cluster: initial code #5620

Merged
merged 10 commits into from
Jan 22, 2025
Merged

Conversation

a-nogikh
Copy link
Collaborator

@a-nogikh a-nogikh commented Dec 17, 2024

The basic code of a k8s-based cluster that:

  • Aggregates new LKML patch series.
  • Determines the kernel trees to apply them to.
  • Builds the basic and the patched kernel.
  • Displays the results on a web dashboard.

This is a very rudimentary version with a lot of TODOs that provides a skeleton for further work.

The project makes use of Argo workflows and Spanner DB.
Bootstrap is used for the web interface.

Overall structure:

  • syz-cluster/dashboard: a web dashboard listing patch series and their test results.
  • syz-cluster/series-tracker: polls Lore archives and submits the new patch series to the DB.
  • syz-cluster/controller: schedules workflows and provides API for them.
  • syz-cluster/kernel-disk: a cron job that keeps a kernel checkout up to date.
  • syz-cluster/workflow/*: workflow steps.

For the DB structure see syz-cluster/pkg/db/migrations/*.


TODO (for this PR):

  • Go through the installation section, hopefully get rid of minio use.
  • Figure out why go.mod bumped to 1.23.1 That is go: github.com/argoproj/argo-workflows/v3@v3.6.2 requires go >= 1.23.1 (running go 1.22.7)
  • GAE still does not support a Go 1.23 runtime. So should we use an older Argo workflow version? v3.5.13 still only requires Go 1.21.
  • go: module k8s.io/api@v0.32.0 requires go >= 1.23.0; switching to go1.23.4. v0.31.4 requires Go 1.22.
  • Figure out how to run syz-cluster tests on GitHub CI (we'll need at least some local Spanner emulator binary).
  • Move from minio to https://github.com/fsouza/fake-gcs-server? We might need to use https://argo-workflows.readthedocs.io/en/latest/environment-variables/ to pass STORAGE_EMULATOR_HOST to the argo server.

Questions/thoughts out loud:
1. What to do with the vendor folder
Our vendor/ folder is quite big, and this PR adds even more modules on top of that. Do we still want to keep that code in our repostory? Is it possible to only keep the modules needed by other components but not syz-cluster (since I do go mod download in the Docker containers anyway).
Filed #5645

2. Some pkg/ packages are too eager to depend on prog/ and sys/
It has made some Dockerfiles more complicated that they could have been.
Should we strive to remove these dependencies?

@a-nogikh a-nogikh force-pushed the features/syz-cluster branch from dbf79ae to 0a8c2df Compare December 17, 2024 15:57
@a-nogikh a-nogikh changed the title Features/syz cluster syz-cluster: initial code Dec 17, 2024
Copy link
Collaborator

@dvyukov dvyukov left a comment

Choose a reason for hiding this comment

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

The first patch is not questionable. Let's review/merge it separately.

pkg/email/lore/parse.go Outdated Show resolved Hide resolved
pkg/email/lore/parse.go Outdated Show resolved Hide resolved
pkg/email/lore/parse.go Outdated Show resolved Hide resolved
pkg/email/lore/parse.go Outdated Show resolved Hide resolved
pkg/osutil/osutil.go Outdated Show resolved Hide resolved
pkg/vcs/git.go Outdated Show resolved Hide resolved
pkg/vcs/git.go Outdated Show resolved Hide resolved
pkg/vcs/git.go Outdated Show resolved Hide resolved
pkg/vcs/git.go Outdated Show resolved Hide resolved
pkg/vcs/git.go Outdated Show resolved Hide resolved
@a-nogikh a-nogikh force-pushed the features/syz-cluster branch from 0a8c2df to 3ef5a48 Compare December 19, 2024 21:36
@a-nogikh a-nogikh force-pushed the features/syz-cluster branch from 3ef5a48 to 2a65760 Compare December 20, 2024 21:42
@a-nogikh a-nogikh force-pushed the features/syz-cluster branch 4 times, most recently from 0129842 to 14daace Compare December 24, 2024 10:15
@a-nogikh
Copy link
Collaborator Author

a-nogikh commented Dec 26, 2024

FTR:

@a-nogikh a-nogikh force-pushed the features/syz-cluster branch 2 times, most recently from 2ea42cf to 60046ef Compare January 2, 2025 10:59
@tarasmadan
Copy link
Collaborator

We could add a standalone Spanner emulator binary

Please give more context. Do you need it for the local development or testing?
It should be Ok to use it as a dev environment but I'm hesitating to add it as a CI dependency.
Staging environment may be more reliable way for check your system. And spanner mocks looks like a better (more stable, predictable, faster) alternative for CI testing.

@a-nogikh
Copy link
Collaborator Author

a-nogikh commented Jan 2, 2025

We could add a standalone Spanner emulator binary

Please give more context. Do you need it for the local development or testing? It should be Ok to use it as a dev environment but I'm hesitating to add it as a CI dependency. Staging environment may be more reliable way for check your system. And spanner mocks looks like a better (more stable, predictable, faster) alternative for CI testing.

For dev environment, it already exists - there's make run-go-tests in syz-cluster that runs the tests in the k8s environment. I meant running those tests on the GitHub CI as well (ideally by getting rid of make run-go-tests as well).

I've just added a syz-cluster/pkg/db: add support for running under syz-env commit that runs the Spanner emulator binary for our Go tests. Seems to be quite simple, actually.

For some other external dependencies (e.g. Argo workflows or the blob storage), there are already mocks in the code, but for the DB I fear that there will just be too much boilerplate code. If we can just run a db emulator for the unit tests, why not do it?

Doing so lets us test not just the higher level logic, but also all SQL commands that are used in the implementations.

@a-nogikh a-nogikh force-pushed the features/syz-cluster branch from 5c4d2af to ee912f9 Compare January 2, 2025 15:50
@tarasmadan
Copy link
Collaborator

tarasmadan commented Jan 3, 2025

Unit testing allows to test some component in the isolated environment where you can simulate any kind of the external service behavior (inclulding failure). Mocks give you the required flexibility and are the faster way to emulate external dependencies.
Using the emulator for unit testing we make UT slower and test some interaction... It is not the unit testing by definition... I think it worth discussion...

Emulator may be used to test interaction. In our case we can just use real service instead of the emulator that will always differ from it.

@tarasmadan
Copy link
Collaborator

Let's add the testing and error processing sections to the design doc?

@a-nogikh a-nogikh force-pushed the features/syz-cluster branch 2 times, most recently from 64c431a to 2b105fc Compare January 9, 2025 13:34
tarasmadan
tarasmadan previously approved these changes Jan 22, 2025
The basic code of a K8S-based cluster that:
* Aggregates new LKML patch series.
* Determines the kernel trees to apply them to.
* Builds the basic and the patched kernel.
* Displays the results on a web dashboard.

This is a very rudimentary version with a lot of TODOs that
provides a skeleton for further work.

The project makes use of Argo workflows and Spanner DB.
Bootstrap is used for the web interface.

Overall structure:
* syz-cluster/dashboard: a web dashboard listing patch series
  and their test results.
* syz-cluster/series-tracker: polls Lore archives and submits
  the new patch series to the DB.
* syz-cluster/controller: schedules workflows and provides API for them.
* syz-cluster/kernel-disk: a cron job that keeps a kernel checkout up to date.
* syz-cluster/workflow/*: workflow steps.

For the DB structure see syz-cluster/pkg/db/migrations/*.
Start a spanner emulator binary (if it's present in the image).
Findings are crashes and build/boot/test errors that happened during the
patch series processing.
It's not necessary - submit the results from the individual steps
instead.

Report patched kernel build failures as findings.
Adjust its options to allow the uploading of big files (that is
necessary for Argo workflow artifacts).
Run a smoke test on the base kernel build and report back the results.
Report the findings only for the boot test of the patched kernel.
Configure the number of patch series processed in parallel via an env
variable.
@a-nogikh a-nogikh added this pull request to the merge queue Jan 22, 2025
Merged via the queue into google:master with commit 25e17fd Jan 22, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants