Skip to content

Refactor sidecar validation to implement apis.Validatable.#8710

Merged
tekton-robot merged 1 commit intotektoncd:mainfrom
twoGiants:issue-8700-refactor-sidecar-validation-to-implement-validatable
May 12, 2025
Merged

Refactor sidecar validation to implement apis.Validatable.#8710
tekton-robot merged 1 commit intotektoncd:mainfrom
twoGiants:issue-8700-refactor-sidecar-validation-to-implement-validatable

Conversation

@twoGiants
Copy link
Member

@twoGiants twoGiants commented Apr 15, 2025

Changes

As a follow up to #8685 in this small PR the Sidecar validation is refactored to align with the pattern used in pipeline_validation.go, task_validation.go, result_validation.go, etc. meaning implementing the apis.Validatable interface and using a custom type for a list of Sidecars namely SidecarList.

Now that the Sidecar validation has a public Validate API, the tests for it were moved from task_validation_test.go to container_validation_test.go which also improves coverage.

Issue #8700.

/kind cleanup

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
  • pre-commit Passed
  • 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

NONE

@tekton-robot tekton-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-none Denotes a PR that doesnt merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 15, 2025
@twoGiants twoGiants force-pushed the issue-8700-refactor-sidecar-validation-to-implement-validatable branch from 9b1e82f to f53931c Compare April 15, 2025 13:34
@twoGiants twoGiants changed the title Refactor sidecar validation to implement apis.Validatable. 🚧 🚧 Refactor sidecar validation to implement apis.Validatable. 🚧 Apr 15, 2025
@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/pipeline/v1/container_validation.go 100.0% 99.4% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.2% -0.4

@twoGiants twoGiants force-pushed the issue-8700-refactor-sidecar-validation-to-implement-validatable branch from f53931c to c94395e Compare April 15, 2025 14:11
@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/pipeline/v1/container_validation.go 100.0% 99.4% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.2% -0.4

@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/pipeline/v1/container_validation.go 100.0% 99.4% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.2% -0.4

@twoGiants
Copy link
Member Author

twoGiants commented Apr 15, 2025

@binkkatal you can take a look but I would wait till #8685 is merged, then this PR will be much smaller. See pr message above. Thank you!

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 26, 2025
@twoGiants twoGiants force-pushed the issue-8700-refactor-sidecar-validation-to-implement-validatable branch from c94395e to 77a7a7a Compare May 8, 2025 14:05
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 8, 2025
Add `SidecarList` with a `Validate` method and implemented a
`Validate` method on `Sidecar`.

Put both Sidecar tests into one test function and move into
`container_validation_test.go`. Remove `validateSidecars`,
`validateSidecar`, switch to `Validate` method entirely and remove old
tests.

Issue tektoncd#8700.

Signed-off-by: Stanislav Jakuschevskij <[email protected]>
@twoGiants twoGiants changed the title 🚧 Refactor sidecar validation to implement apis.Validatable. 🚧 Refactor sidecar validation to implement apis.Validatable. May 8, 2025
@twoGiants twoGiants marked this pull request as ready for review May 8, 2025 14:06
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 8, 2025
@tekton-robot tekton-robot requested review from dibyom and vdemeester May 8, 2025 14:07
@twoGiants twoGiants force-pushed the issue-8700-refactor-sidecar-validation-to-implement-validatable branch from 77a7a7a to 2e56a9d Compare May 8, 2025 14:07
@twoGiants
Copy link
Member Author

/cc @waveywaves

This one is ready for review. It's a small refactor of the sidecar validation, see my short description above. Thank you for the review! 😸

@tekton-robot tekton-robot requested a review from waveywaves May 8, 2025 14:11
@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 12, 2025
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

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

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@waveywaves
Copy link
Member

/lgtm

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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants