-
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
RFC: Size Munger -> Prow "Size" Plugin #3794
Comments
Nice write-up.
I don't think we even need the config option. Is there any problem with just assuming that the file is called
I suggest using the version from the PR, although the file changes infrequently enough that it's not a big deal. |
/area prow |
I guess I figure allowing the configuration option with a sane default is more future-proof. If the file name should ever need to change in the future or be different per repo...not sure how big of a deal that is (it's probably cause I've spent some time re-parameterizing certain prow config assumptions 😛) but this assumption leads to a simpler implementation so I'm cool with it.
So then in the above example, the change would be 1 line and considered i'm updating the main text accordingly |
Yep that sounds right. |
One thing to note is that other plugins want the |
Definitely. I designed the |
I propose writing the size munger as a Prow plugin named
size
.Objective
Write a Prow plugin implementing the same functionality as the size munger. This functionality is defined in Background.
Background
The size munger applies labels to pull-requests based on their size. The size can be one of
XS
,S
,M
,L
,XL
,XXL
. A PR is sized based on the number of relevant lines in the diff it induces with the base branch.We define relevant lines as those in non-generated files. The set of generated files is defined in a configuration file in the target repository.
Generated Files Config
A sample generated files configuration is available here. We briefly define the spec of this file.
The config is a series of newline-delimited statements. Statements that begin with a
#
are ignored. A statement is a white-space delimited key-value tuple.where whitespace is ignored, and:
For example:
The statement's
key
specifies the type of the corresponding value:(this table taken from here)
PR Sizing
Once the relevant files are determined (i.e., lines in generated files ignored as specified in the config), we count the number of relevant additions and deletions in the diff induced in the PR. We call this count
l
.l
Visibility on GitHub
The size assigned to a PR will be made visible on github by labelling the PR in the form
size/<size>
(e.g., "size/L").Implementation Proposal
kubernetes/test-infra/prow/plugins
namedsize
. Directory contains code for a Prow plugin named "size".plugins.PullRequestHandler
Details
Configuring name of generated files config in repo
Update: First implementation will assume the file is called
.generated_files
and forego any additional configuration modifications.Add a configuration
Size
to the prow config struct.(@spxtr is this the way to go? plugins seemed to be listed in
plugins.yaml
but configured inconfig.yaml
?)corresponding to a block in a Prow
config.yaml
:Which revision of config file?
Consider the kubernetes/kubernetes config above. Suppose the user mutates the
.generated_files
file. Adding:Their PR then included the new file
ignoreme.100lines
which contained 100 new lines.We will use the
.generated_files
located at thebase branch revision (in the usual case this is the file currently in thehead branch revision, therefore this PR would have 1 line of relevant diffs and be labeledmaster
branch). Therefore this PR would have 101 lines of relevant diffs, and be labeledsize/L
.size/XS
.The text was updated successfully, but these errors were encountered: