-
Notifications
You must be signed in to change notification settings - Fork 292
rehearse: Get changed periodics #1
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
rehearse: Get changed periodics #1
Conversation
345261a to
1284d36
Compare
1284d36 to
c30d33c
Compare
stevekuznetsov
left a comment
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 think we want the integration tests in this PR
bbguimaraes
left a comment
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.
Much of the refactoring here could have been done in separate commits (or even a separate PR), 7dad8b3 was especially difficult to review.
c30d33c to
a2de7aa
Compare
6507b01 to
1549535
Compare
|
This should be ready. Only one thing that @stevekuznetsov mentioned, regarding how we want to treat the |
1549535 to
92c262d
Compare
|
We should update |
stevekuznetsov
left a comment
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 think we need to enforce that --git-ref is not set and to actually set it the same was as we do for presubmits, while setting extra_refs[0] to the rehearsal PR so that we get reports. Are we not also making this opt-in at a job level?
8b69f32 to
5158a89
Compare
e3bb293 to
4ea28db
Compare
4ea28db to
86f26fa
Compare
|
@petr-muller @bbguimaraes would love your thoughts to add LGTM here |
Ack, I plan to have a look today |
|
LGTM, but I still think we are adding too much duplication, and the kind that can generate bugs and/or make maintenance unnecessarily harder. I would much rather see functions like these instead of duplicate code (not a mandate, take them as suggestions): // pkg/diff/diff.go
func jobChanged(name string, job0, job1 *prowconfig.JobBase, logger *logrus.Entry, logFields *logrus.Fields) bool {
if job1.Agent != string(pjapi.KubernetesAgent) {
return false
}
if job0.Agent != string(pjapi.KubernetesAgent) {
logger.WithFields(*logFields).WithFields(logrus.Fields{logJobName: name, logDiffs: convertToReadableDiff(job0.Agent, job1.Agent, objectAgent)}).Info(chosenJob)
return true
}
if !equality.Semantic.DeepEqual(job0.Spec, job1.Spec) {
logger.WithFields(*logFields).WithFields(logrus.Fields{logJobName: name, logDiffs: convertToReadableDiff(job0.Spec, job1.Spec, objectSpec)}).Info(chosenJob)
return true
}
return false
}
// pkg/rehearse/jobs.go
func makeRehearsalJob(job *prowconfig.JobBase, prNumber int, name, repo, branch string) {
job.Name = fmt.Sprintf("rehearse-%d-%s", prNumber, name)
gitrefArg := fmt.Sprintf("--git-ref=%s@%s", repo, branch)
job.Spec.Containers[0].Args = append(job.Spec.Containers[0].Args, gitrefArg)
if job.Labels == nil {
job.Labels = make(map[string]string, 1)
}
job.Labels[rehearseLabel] = strconv.Itoa(prNumber)
} |
|
@bbguimaraes Will do a follow up for this. |
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 found myself agreeing with some of the comments @bbguimaraes made. I'd especially like to see the indirect arguments for
JobConfigurermethods being cleaned up. -
@droslean did you test the whole thing end-to-end (I mostly mean if the rehearsal periodics would really report their status to a PR)?
-
I'm a little confused about the opt-in mechanism we were discussing, where people would label their periodics as safe to rehearse. Unless I missed it, we don't have it? But maybe we don't need it, because we currently only rehearse periodics based on
ci-operatorwith a safe set of options? I'm not sure.. -
IMO This is really missing documentation of what it is supposed to do (what periodics would be rehearsed? which wouldn't?), what are the limitations and what are the plans for next steps :/
-
I'm wondering if it would be useful to take a step back, define better what jobs are we supposed to rehearse and how, break this down to fewer smaller PRs and review them separately. Being this big, I'm not feeling exactly well about merging it, and I'm not sure it rehearses jobs that the users need to rehearse.
cmd/pj-rehearse/main.go
Outdated
|
|
||
| jobConfigurer := rehearse.NewJobConfigurer(presubmitsToRehearse, periodicsToRehearse, prConfig.CiOperator, prNumber, loggers, o.allowVolumes, changedTemplates, changedClusterProfiles, jobSpec.Refs) | ||
| presubmits := jobConfigurer.ConfigurePresubmitRehearsals() | ||
| periodics := jobConfigurer.ConfigurePeriodicRehearsals() |
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 think this API would be more readable if presubmitsToRehearse and periodicsToRehearse would be parameters to the methods that work with them instead of members that are only used in a single method.
86f26fa to
bb07d2a
Compare
bb07d2a to
51facc6
Compare
|
After discussing this with @petr-muller we decide to break this PR in smaller ones to make the |
petr-muller
left a comment
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
/approve
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: droslean, petr-muller The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/refresh |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
No description provided.