-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
tests: ensure that pre-submits get additional reviews #33958
base: master
Are you sure you want to change the base?
Conversation
/assign @aojea @BenTheElder seems an interesting approach that may solve the existing problem, @BenTheElder is more familiar with all the edges here, let's hear his thoughts |
The test worked, my branch was out-dated and thus I didn't include an up-to-date generated file: $ git diff
diff --git a/config/tests/jobs/presubmit-jobs.yaml b/config/tests/jobs/presubmit-jobs.yaml
index b7415779ba..197152ed12 100644
--- a/config/tests/jobs/presubmit-jobs.yaml
+++ b/config/tests/jobs/presubmit-jobs.yaml
@@ -25,7 +25,7 @@ run_if_changed:
run_if_changed: ^(go.mod|go.sum|vendor)
- name: pull-kubernetes-apidiff-client-go
optional: true
- run_if_changed: (^staging\/src\/k8s.io\/client-go)|(^staging\/src\/k8s.io\/code-generator\/examples)
+ run_if_changed: ((^staging\/src\/k8s.io\/client-go)|(^staging\/src\/k8s.io\/code-generator\/examples))/.*\.go
- name: pull-kubernetes-conformance-image-test
optional: true
run_if_changed: conformance |
4f6979f
to
42d46db
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pohly The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
config/tests/jobs/jobs_test.go
Outdated
coreapi "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/api/resource" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/util/sets" | ||
yaml "sigs.k8s.io/yaml/goyaml.v3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is "our" fork of gopkg.in/yaml.v3
. We should use the fork in the entire repo and drop the dependency on the original one, but that's a topic for another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filed #33971
run_if_changed: /staging/src/k8s.io/component-base/logs/ | ||
- name: pull-kubernetes-kind-text-logging | ||
optional: true | ||
run_if_changed: /staging/src/k8s.io/component-base/logs/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two may qualify for merge-blocking now. I'll check...
Having them show up in this list is a useful reminder 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apropos "merge-blocking": as discussed on Slack, we don't want jobs to run only occasionally and be merge-blocking. We currently have one such job. I demoted it to optional: true
, changed the test so that it errors when it encounters such a job (that's how I found it), and removed the optional
from the file because all run_if_changed
jobs now will be optional.
LGTM tagging @michelle192837 too |
config/tests/jobs/jobs_test.go
Outdated
// If a job has the same settings regardless of the branch, then | ||
// we can reduce to a single entry without the branch info. | ||
shorterJobs := make([]presubmitJob, 0, len(*jobs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any possible side effect of this simplification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The job still shows up as intended in config/tests/jobs/presubmit-jobs.yaml
with all of it's settings, we just don't show for which branches it gets defined. For that a reviewer would have to look at the other YAMLs. Forking a job for a release does not change config/tests/jobs/presubmit-jobs.yaml
which IMHO is desirable.
However, it opens a small loophole: a job could get defined and accepted for master, then later someone adds variants for release branches without that triggering a detailed review because config/tests/jobs/presubmit-jobs.yaml
doesn't get touched. I think this is acceptable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with all of it's settings, we just don't show for which branches it gets defined. For that a reviewer would have to look at the other YAMLs.
is it possible to add a comment that shows the versions
# also available in v1.31, v1.32
or is that not worth it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reducing Branches
and SkipBranches
(a regular expression!) to simple version numbers would be a bit challenging, albeit solvable.
But the bigger question is: do we want this file to change when adding the same job to a release branch? It closes a loophole, but also adds churn during each release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenTheElder: thoughts on this?
- name: pull-kubernetes-conformance-image-test | ||
optional: true | ||
run_if_changed: conformance | ||
- name: pull-kubernetes-conformance-kind-ipv6-parallel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #33965
- name: pull-kubernetes-e2e-capz-azure-disk | ||
optional: true | ||
run_if_changed: azure.*\.go | ||
- name: pull-kubernetes-e2e-capz-azure-disk-vmss | ||
optional: true | ||
run_if_changed: azure.*\.go | ||
- name: pull-kubernetes-e2e-capz-azure-disk-windows | ||
optional: true | ||
run_if_changed: azure.*\.go | ||
- name: pull-kubernetes-e2e-capz-azure-file | ||
optional: true | ||
run_if_changed: azure.*\.go | ||
- name: pull-kubernetes-e2e-capz-azure-file-vmss | ||
optional: true | ||
run_if_changed: azure.*\.go | ||
- name: pull-kubernetes-e2e-capz-azure-file-windows | ||
optional: true | ||
run_if_changed: azure.*\.go | ||
- name: pull-kubernetes-e2e-capz-conformance | ||
optional: true | ||
run_if_changed: azure.*\.go | ||
- name: pull-kubernetes-e2e-capz-windows-1-29 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of this seems that must be removed
ubernetes$ find . | grep -E "azure.*go"
./test/e2e/framework/providers/azure/azure.go
./test/e2e/framework/providers/azure/doc.go
./staging/src/k8s.io/csi-translation-lib/plugins/azure_file.go
./staging/src/k8s.io/csi-translation-lib/plugins/azure_disk_test.go
./staging/src/k8s.io/csi-translation-lib/plugins/azure_disk.go
./staging/src/k8s.io/csi-translation-lib/plugins/azure_file_test.go
./staging/src/k8s.io/client-go/applyconfigurations/core/v1/azurefilepersistentvolumesource.go
./staging/src/k8s.io/client-go/applyconfigurations/core/v1/azurediskvolumesource.go
./staging/src/k8s.io/client-go/applyconfigurations/core/v1/azurefilevolumesource.go
./staging/src/k8s.io/client-go/plugin/pkg/client/auth/azure/azure_stub.go
- name: pull-kubernetes-e2e-gci-gce-ipvs | ||
optional: true | ||
run_if_changed: ^(test/e2e/network/|pkg/apis/networking|pkg/.*/ipvs/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not maintained and I don't have time for it , so we remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #33965
- name: pull-kubernetes-e2e-kind-ipvs | ||
optional: true | ||
run_if_changed: ^(test/e2e/network/|pkg/apis/networking|pkg/proxy/ipvs/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #33965
I suggest we remove or update jobs in separate PRs. I can then rebase this one and we merge it when we are happy with the current state. |
@@ -8,4 +8,7 @@ To run via bazel: `bazel test //config/tests/jobs/...` | |||
|
|||
To run via go: `go test .` | |||
|
|||
If tests fail, re-run with the `UPDATE_FIXTURE_DATA=true` env variable | |||
and include the modified files in the PR which updates the jobs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably have a convenient make target since people will be doing this often, normally we have verify scripts spit out the command people need to run when there's generated data to update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added make update-config-fixtures
plus some other make targets like update-unit
for symmetry with make unit
which happens to run the Go test. The Go test itself now points to make update-config-fixtures
because that is faster when the goal is to update the file.
@@ -0,0 +1,158 @@ | |||
# AUTOGENERATED by "UPDATE_FIXTURE_DATA=true go test ./config/tests/jobs". DO NOT EDIT! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should move this into a dedicated sub-folder so we can set a specific list of OWNERS for kubernetes presubmits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to config/tests/jobs/policy
together with the test, a README.md and the OWNERS file. I copied that from ./config/testgrids/kubernetes/presubmits/OWNERS with some changes:
- removed emeritus
- added
no_parent_owners: true
- added
sig/infra
as label
That leaves @BenTheElder, @aojea and @test-infra-oncall as reviewer/approver. I probably should remove the latter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/kubernetes/test-infra/compare/42d46db8df3ecb356f984228408850235f27f446..aa8ef289dd9e091456be488d1d4ee7f4927ee846 for these changes before rebasing.
42d46db
to
aa8ef28
Compare
aa8ef28
to
18862e5
Compare
18862e5
to
7bfe705
Compare
Interesting... $ make go-unit
hack/make-rules/go-test/unit.sh
+ umask 0022
+ mkdir -p /work/gopath/src/k8s.io/test-infra/_output
+ /work/gopath/src/k8s.io/test-infra/_bin/gotestsum --junitfile=/work/gopath/src/k8s.io/test-infra/_output/junit-unit.xml -- ./...
✓ config/prow/cluster/build/boskos-resources (cached)
✓ config/tests/jobs/policy (cached)
✓ config/tests/lint (cached)
✓ config/tests/mergelists (cached)
✓ config/tests/jobs (cached)
∅ def/configmap
...
DONE 6812 tests in 1.006s
$ echo $?
0 No failure! But when I run $ go test ./...
...
--- FAIL: TestPresubmitsKubernetesDashboards (0.00s)
config_test.go:456: pull-kubernetes-e2e-gce-network-proxy-http-connect: should not be in presubmits-kubernetes-blocking because not actually merge-blocking for kubernetes/kubernetes
FAIL
FAIL k8s.io/test-infra/config/tests/testgrids 1.280s
...
ok k8s.io/test-infra/testgrid/pkg/configurator/prow (cached)
FAIL Not good! |
My |
As bentheelder said on Slack (https://kubernetes.slack.com/archives/C2C40FMNF/p1734418617113169?thread_ts=1734417601.687079&cid=C2C40FMNF), "adding blocking tests that only sometimes run is confusing and doesn't work well". That's because a regression might get merged without running the job. Then any PR where the job gets run is blocked, whether it is related to the failure or not. Therefore pull-kubernetes-e2e-gce-network-proxy-http-connect should not be blocking.
7bfe705
to
bf72f1a
Compare
Blocking pre-submit jobs must be for stable, important features and must always run. Non-blocking pre-submit jobs should only be run automatically if they meet the criteria outlined in kubernetes/community#8196. To ensure that this is considered when defining pre-submit jobs, they need to be listed in `config/tests/jobs/policy/presubmit-jobs.yaml`. The OWNERS file in that new directory ensures that relevant reviewers need to approve. `make update-config-fixture` re-generates that file to the expected state for inclusion in a PR.
bf72f1a
to
aa82f16
Compare
Blocking pre-submit jobs must be for stable, important features. Non-blocking pre-submit jobs should only be run automatically if they meet the criteria outlined in kubernetes/community#8196.
To ensure that this is considered when defining pre-submit jobs, they need to be listed in
config/tests/jobs/policy/presubmit-jobs.yaml
.make update-config-fixtures
re-generates that file to the expected state for inclusion in a PR.