Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Make files in `spec.platforms` optional #261
Many plugins use the pattern to copy all files from the archive into the installation directory. Those plugins always have to specify a file copy operation such as
files: - from: "*" to: "."
This PR makes the files field completely optional and defaults to the above copy specifier. As discussed in #135, the default copy spec may install too many files. The plugin developer docs therefore explicitly show such an antipattern example.
@@ Coverage Diff @@ ## master #261 +/- ## ========================================== + Coverage 54.98% 55.66% +0.67% ========================================== Files 19 19 Lines 902 918 +16 ========================================== + Hits 496 511 +15 - Misses 354 355 +1 Partials 52 52
Sadly, no. This is independent of programming language.
More obvious examples of this can be seen in Kubernetes API design. For example, in Kubernetes NetworkPolicy API, specifying
Let's play safe in this case and (1) distinguish nil and default on that (2) validate error on empty array. Here's another reason to play safe: We can start with defaulting on just
I prefer to err on being more restrictive and being more lenient only if there's a need.
Rebase is finally done.
I added a new validation case which forbids empty file operations now. The difference between empty and unspecified is quite subtle though (this comes from our yaml library):
... bin: foo-amd64 files: # present, but no values
is equivalent to
... bin: foo-amd64 # files: <- not present
Whereas this triggers the error case:
... bin: foo-amd64 files: 
[APPROVALNOTIFIER] This PR is APPROVED
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