Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the way the Pipelines controllers receive flags.
This change has a few parts, but the overarching goal is to make it easier for downstreams to repackage Tekton Pipelines across updates to the flags that are parsed and passed into the controllers. 1. Instead of defining `var`s for the flags, and then extracting the flags into the `pipeline.Images` struct, this change takes advantage of `flag.NewFooVar` to pass in the address of the variable to update. This lets us have flag parsing process things directly into its final variable. 2. Wrap `Images` in `FlagOptions`, which is passed to controllers. I'm sort of ambivalent about the nested struct vs. renaming Images, but opted for the former because so many files reference `pipeline.Images` and I wanted to reduce the scope of the change. 3. For flags only used in `main()` use a local flag definition (vs. `FlagOptions`). It turns out the `*namespace` we were passing to the `NewController` methods was unused! 4. For globals we've turned into flags, use the `flag.NewFooVar` form to update the global directly. 5. Colocate the `flag` setup with the validation setup. This allows us to get coverage of the flag processing code, and it turns out there were some bugs in the names of flags emitted from validation! (cherry picked from commit d0a1053)
- Loading branch information