Skip to content

Duplication vs common packages when adding new API version #5181

@lbernick

Description

@lbernick

When adding the v1 package, most of the code gets copied over from v1beta1. This makes a lot of sense for CRDs but it's less clear whether it makes sense to do for sub-components of the API that aren't CRDs, like params, workspaces, and results. This results in having to write a lot of boilerplate to convert a v1beta1 workspace into a v1 workspace (for example) even though there are no breaking changes to workspaces proposed in v1. It also means we need to maintain duplicate versions of this code, e.g. as discussed in #5171. (We'll have to maintain a lot of copy pasted code to some extent anyway, just by nature of adding a new API version, but using common definitions for parts of the API could help.)

In v1alpha1, we imported v1beta1 and used some API definitions from v1beta1 (example). This sometimes resulted in having to update v1alpha1 tests as well when we wanted to change the v1beta1 versions.

One approach is to start with using common packages for these features, and if we end up deciding to make breaking changes, swap a struct over to using copy + paste. This would break Go clients, which would be less than ideal but workable. Alternatively, we could copy and paste everything and write all the conversion boilerplate from the start.

Thoughts @tektoncd/core-maintainers?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions