-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(kubernetes): Clean up ArtifactReplacer (#4020)
* test(kubernetes): Fix ArtifactReplacer tests We should be using when/then instead of expect * refactor(kubernetes): Make ArtifactReplacer immutable We always create an ArtifactReplacer then immediately call registerReplacer a number of times to register all replacers. Replace this with just passing the replacers into the constructor. * refactor(kubernetes): Delete unused static variables At some point in the past, this class was refactored and all references to these static variables were removed, but the variables themselves were never removed. Remove them. * refactor(kubernetes): Replace static methods with constants As the Replacer class is immutable, it is safe to just return the same Replacer ever time we need one. Let's replace the static methods to generate a replacer with static constants. * refactor(kubernetes): Improve encapsulation of Replacer class The ArtifactReplacer and Replacer classes don't clearly define a boundary of responsibility; this commit is a few changes to disentangle the classes a bit, as well as make a few minor other improvements to them. In particular: * Replace stream .filter() and .map() operations that have side- effects with forEach * Add nullity annotations where appropriate * Remove the unused (always null) namePattern field from replacer * Consolidate the API of Replacer down to getArtifacts and ReplaceArtifacts * refactor(kubernetes): Move Replacer class to top level This is a reasonably complex class to be an inner class, which reduces its ability to encapsulate its complexity. This commit is just moving the existing class, with no other changes. * refactor(kubernetes): Make Replacer builder private Defining a replacer is reasonably complex, so ideally this would only be done by the class itself, exposing useful replacers for consumers. Move the one replacer defined outside the class into the class, and make the builder private. * refactor(kubernetes): Address PR review comments * Have ArtifactReplacer accept a Collection instead of an ImmutableList * Replace public static replacers with static methods
- Loading branch information
Showing
14 changed files
with
428 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.