-
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
add optional presubmit job to run apidiff on the client-go module #33866
Conversation
EDIT This seems to be a problem of getting the base from kubernetes versions without go workspaces, see description with good run |
/assign @deads2k @liggitt @jpbetz |
/lgtm |
Ok, this should be ready now, but still depends on kubernetes/kubernetes#129021 to support the wildecard and the modules that are not present in the workspace for the generated code |
/hold cancel The k/k fixes got merged @pohly can you PTAL? |
# PR gets merged into. What we want instead is the revision at | ||
# which the PR branch diverged from the target branch. | ||
# We get that from "git merge-base". | ||
- "./hack/apidiff.sh -r $(git merge-base ${PULL_BASE_SHA} ${PULL_PULL_SHA}) -t ${PULL_PULL_SHA} ./staging/src/k8s.io/code-generator/examples ./staging/src/k8s.io/client-go" |
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 recommend moving this fully out into a script somewhere, it will need iterating on and inline in prowjob config is a poor place to iterate on scripts.
I don't consider this a hard blocker, but seriously consider doing this sooner than later.
If it were planned to be a blocking job, I'd be more concerned.
The moment this apidiff script wants more computed inputs, we have a mess, but if some wrapper script takes in the prow envs, it's not a problem.
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 don't think adding an indirection in this case is going to help, if we end needing more complexity for this job then we are doing something wrong
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.
usually the prowjob should make a trivial invocation like make test
, and encapsulate the rest in the repo under test, where you can iterate on it with a tested PR
it's not about more complexity, it's about any change to how this needs to be invoked. right now you're passing quite a lot as arguments coming from env or even computed.
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.
(which also makes local replication more difficult)
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 are only 2 arguments that depend on prow variables
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.
(aside: PULL_PULL_SHA will not be set on batch PR runs, TODO to rework this out if we ever want a blocking job later)
https://docs.prow.k8s.io/docs/jobs/#job-environment-variables
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.
apidiff.sh
was meant to be agnostic of the CI system in which it gets run. But I don't feel strongly about this.
(aside: PULL_PULL_SHA will not be set on batch PR runs, TODO to rework this out if we ever want a blocking job later)
It's complexity like this that I wanted to keep out of the script... In the job it's clearer which variables are set. 🤷
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.
apidiff.sh was meant to be agnostic of the CI system in which it gets run. But I don't feel strongly about this.
... eh... prow is the CI system Kubernetes uses, we normally support it in our tools / scripts.
It's complexity like this that I wanted to keep out of the script... In the job it's clearer which variables are set. 🤷
That complexity has to go somewhere, and it's harder to iterate on correctly if it's inline in the job.
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.
(also, we're not requiring prow-like-environment-variables, just supporting it as a fallback if the args are not otherwise set, see the 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.
the REPO_ROOT value is wrong and should be detected in the apidiff script (or passed in via pwd if we really can't do it in the script for some reason, there's copy paste one-liners for this in k/k)
that's the only blocking concern
# A periodic job which shows API diffs for staging repos per day | ||
- name: ci-kubernetes-apidiff-daily | ||
cluster: eks-prow-build-cluster | ||
interval: 24h |
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 approach isn't technically guaranteed to schedule daily, you should probably use a cron for this and pick a particular time of day to run for consistency
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.
it's a canary job, I just want to get some periodic signal , nothing else, if this work well we figure out a more elegant way of scheduling, but in the meantime think on it as a personal job, nothing else
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.
OK, it's not that complicated though ... https://docs.prow.k8s.io/docs/jobs/#how-to-configure-new-jobs
You just swap this field for cron: <normal cron string>
, e.g. cron: 0 0 * * *
would run every day at midnight UTC
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.
If the time window matches, the report will be more useful, otherwise it will vary by how many developers have recently been merging code. not blocking, but consider this in a follow-up. We can look at the merge graph in k/k.
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 thread is non-blocking, we can do this in a follow-up, but I strongly recommend it.
interval: 24h
is almost always not what people actually want, interval
makes sense for frequently run things where we don't want to stack up missed runs from the job potentially taking longer than the interval, and we don't care at all about timing otherwise.
pretty much any job with a long interval is using a cron instead for this reason, the scheduling is more predictable.
for a daily report you want predictable, so you can reliably check it after it's done.
the timing of interval is affected by when it was first introduced, any disruptions to prow, and any other jitter, since it's always computed since the last run.
that variable is not used, at least I didn't find where, so I removed it |
/lgtm after kubernetes/kubernetes#129188 we could gracefully drop some of the flags in presubmit and streamline it. I'll send a follow-up to switch to a cron for the periodic. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aojea, BenTheElder The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
/lgtm
@aojea: Updated the
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Having an optional presubmit that gets executed automatically when a client-go file is modified, to run apidiff against the client-go module will be helpful for reviewers to understand the impact of the changes and, if necessary, evaluate if the breaking changes are necessary or can be done in a different way that does not break downstream clients (i.e. declare the old function deprecated and add a new one)
See gist with the differences between minors versions in client-go https://gist.github.com/aojea/696155fb3e2f8775574e6afddcb33cfc , it seems we were doing better overall, but being more consistent in this area will help to reduce the friction of the ecosystem that need to consume these APIS and clients, see kubernetes/kubernetes#124380
Reference to slack discussion https://kubernetes.slack.com/archives/C0EG7JC6T/p1732746366129629
Example execution: