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

refactor job configuration #19

Merged
merged 3 commits into from
Jul 10, 2019

Conversation

droslean
Copy link
Member

@droslean droslean commented Jul 8, 2019

This PR generalizes the functions that are responsible for the job configuration. This will allow to accept different job types in the future without the need of further refactoring.

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 8, 2019
@droslean
Copy link
Member Author

droslean commented Jul 8, 2019

/cc @openshift/openshift-team-developer-productivity-test-platform

@openshift-ci-robot openshift-ci-robot requested a review from a team July 8, 2019 11:42
if len(rehearsals) == 0 {
jobConfigurer := rehearse.NewJobConfigurer(toRehearse, prConfig.CiOperator, prNumber, loggers, o.allowVolumes, changedTemplates, changedClusterProfiles, jobSpec.Refs)

presubmitsToRehearse := jobConfigurer.ConfigurePresubmitRehearsals()
Copy link
Member

Choose a reason for hiding this comment

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

As discussed in the original PR review, please make the set of presubmits to rehearse an argument of ConfigurePresubmitRehearsals, not a member of the configurer struct.

Copy link
Member Author

@droslean droslean Jul 8, 2019

Choose a reason for hiding this comment

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

Sure, since its only using a logger and presubmits, what you suggest sounds orthogonal. But the filtering logic will change also... If we do the filtering outside the job configurer, then that struct is losing its purpose..

Copy link
Member

Choose a reason for hiding this comment

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

Well the struct is going to be useful once you start adding the periodic rehearsals (oh man, how I would love to have them for mirroring jobs...), no? It keeps "things we need to configure all jobs" , while the ConfigureXXXRehearsals can deal with just the jobs of the appropriate type.

Copy link
Member Author

Choose a reason for hiding this comment

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

All job types have only spec in common, that's why I moved that configuration in configureJobSpec. The other parts of the types will be done in ConfigureXXXRehearsals

Copy link
Member

Choose a reason for hiding this comment

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

That's right, and eventually the ConfigurePresubmitRehearsals will be the only one that would work with presubmits, ConfigurePeriodicRehearsals will be the one working with periodics, etc. And I argue that in that case, it's better to have an API like this:

jobConfigurer := rehearse.NewJobConfigurer(prConfig.CiOperator, prNumber, loggers, o.allowVolumes, changedTemplates, changedClusterProfiles, jobSpec.Refs)
pres := jobConfigurer.ConfigurePresubmitRehearsals(presubmits)
pers := jobConfigurer.ConfigurePeriodicRehearsals(periodics)
posts := jobConfigurer.ConfigurePostsubmitRehearsals(postsubmits)

than this:

jobConfigurer := rehearse.NewJobConfigurer(presubmits, periodics, postsubmits, prConfig.CiOperator, prNumber, loggers, o.allowVolumes, changedTemplates, changedClusterProfiles, jobSpec.Refs)
pres := jobConfigurer.ConfigurePresubmitRehearsals()
pers := jobConfigurer.ConfigurePeriodicRehearsals()
posts := jobConfigurer.ConfigurePostsubmitRehearsals()

Copy link
Member Author

Choose a reason for hiding this comment

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

But the jobs that we will pass to the jobconfigurer are after filtering, which they are a member of the struct already. In better case we can have them global in order to pass them to metrics etc...

Copy link
Member

Choose a reason for hiding this comment

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

The configurer is already doing the filtering (well, its constructor is, but that's almost the same thing), so you may as well do the filtering inside the Configure... methods.

Copy link
Member Author

Choose a reason for hiding this comment

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

alright. Let me check and address that.

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed

return rehearsals
}

func (jc *JobConfigurer) configureJobSpec(spec *v1.PodSpec, jobName string) error {
Copy link
Member

Choose a reason for hiding this comment

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

Requiring jobName parameter that's only used to build a debug logger looks like a code smell to me (the method does not need a name, it needs a logger). I don't think there's any easy fix for this, maybe consider passing the logger directly? We already create a job-specific logger in ConfigurePresubmitRehearsals...

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed

Copy link
Member

@petr-muller petr-muller left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 10, 2019
@openshift-ci-robot
Copy link
Contributor

[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

Needs approval from an approver in each of these files:
  • OWNERS [droslean,petr-muller]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 89a4b8b into openshift:master Jul 10, 2019
@droslean droslean deleted the periodics branch October 16, 2019 11:05
DennisPeriquet pushed a commit to DennisPeriquet/ci-tools that referenced this pull request Jan 6, 2022
# This is the 1st commit message:

force all disruption aggregation to skipped status while we re-gather unbugged data

# This is the commit message openshift#2:

Fix lint issue.

# This is the commit message openshift#3:

sanitize: keep jobs from the same PR on the same cluster

# This is the commit message openshift#4:

Support runIfChanged and skipIfOnlyChanged for postsubmit

Signed-off-by: clyang82 <chuyang@redhat.com>

# This is the commit message openshift#5:

Update UT

Signed-off-by: clyang82 <chuyang@redhat.com>

# This is the commit message openshift#6:

fix integration test

Signed-off-by: clyang82 <chuyang@redhat.com>

# This is the commit message openshift#7:

[DPTP-2635]cluster-display: add endpont for clusters

# This is the commit message openshift#8:

prowgen: stop tolerating changes to `optional` fields

...except for images jobs for which do not have syntax in ci-operator config

Once we pull all manual changes to ci-operator configs, we can stop tolerating these changes. One step closer to fully generated Prowjob configuration.

# This is the commit message openshift#9:

Honor semver when comparing clone target/source

# This is the commit message openshift#10:

Write a README for autoconfigbrancher

# This is the commit message openshift#11:

autoconfigbrancher: simplify a conditional

# This is the commit message openshift#12:

autoconfigbrancher: use a permanent link in README

# This is the commit message openshift#13:

Rename mis-spelled variable, add short for cobra help, add comments

# This is the commit message openshift#14:

add more comments re: GCS

# This is the commit message openshift#15:

Note two tables created in memory using a SELECT

# This is the commit message openshift#16:

fix typo

# This is the commit message openshift#17:

cast to a type so we can see more info on dryrun mode

# This is the commit message openshift#18:

Share ReleaseController's config

# This is the commit message openshift#19:

Add aggregating job results to testgrid (openshift#2576)

* Add aggregating job results to testgrid

* Add aggregating job results to testgrid

Aggregating jobs are added to blocking dashboard of the corresponding release.
Release is determined by the aggregated job prow config.

* Add test cases

* Add nil pointer check
# This is the commit message openshift#20:

Updating auto-include logic for OpenStack jobs

Adding the OpenStack jobs which recently moved from release to
shiftstack directory.
This will add them to testgrid automatically.

# This is the commit message openshift#21:

[DPTP-2660]payload-testing-prow-plugin: format errors

# This is the commit message openshift#22:

handle missing history for aggregated disruption

# This is the commit message openshift#23:

Add create-tables subcommand to create Jobs tab and debugging tips to README

# This is the commit message openshift#24:

create JobRuns table

# This is the commit message openshift#25:

Rename vars to be more generic for table creation

# This is the commit message openshift#26:

add in gofmt fixes for lint

# This is the commit message openshift#27:

comment about Jobs being initially primed

# This is the commit message openshift#28:

comment compile time checks in case go beginners have never seen it

# This is the commit message openshift#29:

prpqr: add a PR deploy makefile target

# This is the commit message openshift#30:

prpqr ui: use centos stream instead of 8 from docker

# This is the commit message openshift#31:

Refuse /payload command on PRs to repositories that do not contribute to OCP

# This is the commit message openshift#32:

allow correcting history without changing test name when we get criteria incorrect

# This is the commit message openshift#33:

switch the check for aggregation passes to use the SQL views
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants