Skip to content
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

Refactor version.ValidateEnabledAPIFields to config pkg #7206

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

JeromeJu
Copy link
Member

@JeromeJu JeromeJu commented Oct 11, 2023

Changes

This commit refactors the ValidateEnabledAPIFields function to the config package. The validation previously lived in v1beta1 and it was moved to the version pkg which functions as API version conversion utils rather than for feature versions. This commit moves it to the config pkg since it is actually more tied with featureflags config validation of the enabled-api-fields feature flag.
A future work for this might be renaming the filename to stability-level after the implementations of TEP0138 where glossaries have been planned to be updated for the API compatibility policy.

/kind misc

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

refactor: version.ValidateEnabledAPIFields has been moved to the config package

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/misc Categorizes issue or PR as a miscellaneuous one. labels Oct 11, 2023
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 11, 2023
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/version_validation.go Do not exist 100.0%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/version_validation.go Do not exist 100.0%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/version_validation.go Do not exist 100.0%

Copy link
Member

@pritidesai pritidesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I please request renaming this to featureflags_validation.go instead of version_validation.go. I see this as more of validating configuration specified in config-feature-flags.yaml. Thoughts?

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 11, 2023
@JeromeJu
Copy link
Member Author

Can I please request renaming this to featureflags_validation.go instead of version_validation.go. I see this as more of validating configuration specified in config-feature-flags.yaml. Thoughts?

Thanks Priti!
Done. Makes perfect sense, I was just thinking this might be done later but sounds good to complete in the same step.
Just completed this in this PR and removed "A future work for this might be renaming the filename to stability-level after the implementations of TEP0138 where glossaries have been planned to be updated for the API compatibility policy." from the commit message.

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/featureflags_validation.go Do not exist 100.0%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/featureflags_validation.go Do not exist 100.0%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/featureflags_validation.go Do not exist 100.0%

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we don't really have this in our "guidelines", but this will break "go code" consumer, as the package is removed. We could keep the old package, alias the function and mark them as deprecated to be removed in a later release, but that's probably fine.

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pritidesai, vdemeester

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

This commit refactors the ValidateEnabledAPIFields function to the
config package. The validation previously lived in v1beta1 and it was
moved to the version pkg which functions as API version conversion
utils rather than for feature versions. This commit moves it to the
config pkg since it is actually more tied with config validation of
the  feature flag. version.ValidateEnabledAPIFields has been
deprecated and aliased to keep backwards compatibility.

/kind misc
@JeromeJu
Copy link
Member Author

So, we don't really have this in our "guidelines", but this will break "go code" consumer, as the package is removed. We could keep the old package, alias the function and mark them as deprecated to be removed in a later release, but that's probably fine.

Thanks @vdemeester
That's a solid point given it is a LTS coming up. I've restored it as deprecated and aliased.

Meanwhile I'm double-checking if https://github.com/tektoncd/pipeline/blob/main/docs/developers/api-changes.md is the right place for such guideline updates? I'm happy to add such refactor case if that sounds good.

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/featureflags_validation.go Do not exist 100.0%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/featureflags_validation.go Do not exist 100.0%

@vdemeester
Copy link
Member

Meanwhile I'm double-checking if https://github.com/tektoncd/pipeline/blob/main/docs/developers/api-changes.md is the right place for such guideline updates? I'm happy to add such refactor case if that sounds good.

Probably but maybe we should have one document for Go 🙃

Copy link
Member

@Yongxuanzhang Yongxuanzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 13, 2023
@tekton-robot tekton-robot merged commit 5d403c6 into tektoncd:main Oct 13, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants