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

Add types and client for Resolution #5200

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

abayer
Copy link
Contributor

@abayer abayer commented Jul 22, 2022

Changes

Part of #4710

In order to get remote resolution functionality to beta, we're moving it from a separate repository/release to be part of Pipeline. This is the first PR in a sequence moving the code from the Resolution repository into Pipeline.

/kind feature

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • 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)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

action required: Remote resolver `resource` field has changed to `params`.

@tekton-robot tekton-robot added kind/feature Categorizes issue or PR as related to a new feature. release-note-none Denotes a PR that doesnt merit a release note. labels Jul 22, 2022
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 22, 2022
@abayer
Copy link
Contributor Author

abayer commented Jul 22, 2022

/assign @vdemeester @dibyom
cc @chitrangpatel

@abayer
Copy link
Contributor Author

abayer commented Jul 22, 2022

/test check-pr-has-kind-label

@tekton-robot
Copy link
Collaborator

@abayer: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-tekton-pipeline-alpha-integration-tests
  • /test pull-tekton-pipeline-build-tests
  • /test pull-tekton-pipeline-integration-tests
  • /test tekton-pipeline-unit-tests

The following commands are available to trigger optional jobs:

  • /test pull-tekton-pipeline-go-coverage

Use /test all to run all jobs.

In response to this:

/test check-pr-has-kind-label

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@abayer
Copy link
Contributor Author

abayer commented Jul 22, 2022

/hold

Putting this on hold until we've got v0.38.0 cut, 'cos I'd really like to have all of the relevant commits in one release together.

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 22, 2022
// resource being requested. For example: repo URL, commit SHA,
// path to file, the kind of authentication to leverage, etc.
// +optional
Parameters map[string]string `json:"params,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

I was sharing the remote resource spec with a team and came across two different syntaxes. It seems we are implementing it using params:

taskRef:
    resolver: git
    resource:
    - name: url
      value: https://github.com/tekton/catalog.git
    - name: path
      value: /task/golang-fuzz/0.1/golang-fuzz.yaml
    - name: branch
      value: main

The proposal in the Remote Resolution TEP has listed it as:

taskRef:
  resolver: git
  resource:
    repository_url: https://github.com/tektoncd/catalog.git
    branch: main
    path: /task/golang-fuzz/0.1/golang-fuzz.yaml

Do we need to update the proposal to reflect params? or is it documented somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question! I didn't do the initial implementation, but while I like the repository_url etc syntax better, the - name: url syntax is simpler to implement, since we don't need to use a runtime.RawExtension here for arbitrary YAML.

So I'd say the proposal should be updated, yeah.

Copy link
Member

Choose a reason for hiding this comment

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

@abayer to play devil's advocate, we should aim for the API to be the easiest to use (for end-user) than the easiest to implement 😝

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point. =) I spent some time this weekend thinking about this - in practice, it probably is easier to go with a simple map[string]string than I'd been thinking, given that what we've got now is already just a slice of string name/value pairs anyway. Then, if we hit a situation down the road where we have a need for more complex resolver parameters, we could change that to something like unstructured.Unstructured without breaking API compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...though it is worth mentioning that changing the syntax will break compatibility with the existing syntax, but that's alpha syntax and probably not at all widely used right now anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Lemme do that!

Copy link
Member

Choose a reason for hiding this comment

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

the reason why it was implemented as such was because of K8s convention: "Lists of named subobjects preferred over maps" - as discussed in https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#lists-of-named-subobjects-preferred-over-maps and kubernetes/kubernetes#2004

and we listed in https://github.com/tektoncd/community/blob/main/design-principles.md#api-conventions that Tekton API should comply with the K8s API conventions

Copy link
Member

Choose a reason for hiding this comment

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

haha just saw the comments below

Copy link
Member

Choose a reason for hiding this comment

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

and we listed in https://github.com/tektoncd/community/blob/main/design-principles.md#api-conventions that Tekton API should comply with the K8s API conventions

Yeah this is weird 😝 we want to not tied ourselves too much on kubernetes but still, we force ourselves to comply to kubernetes API convention 😅.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...and yeah, I reverted back to the old form for ResolutionRequest.Spec so as not to break compatibility. See #5200 (comment) =)

@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 25, 2022
@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/reconciler/pipelinerun/resources/pipelineref.go 85.7% 87.5% 1.8
pkg/reconciler/taskrun/resources/taskref.go 83.0% 84.1% 1.1

@abayer
Copy link
Contributor Author

abayer commented Jul 25, 2022

/retest

@abayer
Copy link
Contributor Author

abayer commented Jul 25, 2022

@pritidesai @vdemeester I've changed the resource: syntax to be

resource:
  foo: bar

instead of

resource:
  - name: foo
     value: bar

@abayer
Copy link
Contributor Author

abayer commented Jul 25, 2022

/retest

@abayer
Copy link
Contributor Author

abayer commented Jul 26, 2022

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 26, 2022
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.

/cc @tektoncd/core-maintainers

@tekton-robot tekton-robot requested a review from a team July 26, 2022 13:02
@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 26, 2022
@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/reconciler/pipelinerun/resources/pipelineref.go 85.7% 87.5% 1.8
pkg/reconciler/taskrun/resources/taskref.go 83.0% 84.1% 1.1

@abayer
Copy link
Contributor Author

abayer commented Jul 26, 2022

/retest

Copy link
Member

@lbernick lbernick left a comment

Choose a reason for hiding this comment

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

thanks Andrew! I think we'll need an "action required" release note here

// Value is the string value of the parameter that will be
// passed to the resolver.
Value string `json:"value"`
Resource map[string]string `json:"resource,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

If we are making breaking changes here I'm wondering if "resource" is still the best thing to call this field? it's a very overloaded term in tekton.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good question! I am not a fan of resource here - it's not really clear what it means in the first place. I feel like just params would work, though since params is used in a bunch of places with different syntax than here, I'm not sure if that's ideal...

Copy link
Member

Choose a reason for hiding this comment

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

In the TEP, we used resource ? I'd rather go with params or values than resource indeed.

@abayer
Copy link
Contributor Author

abayer commented Jul 26, 2022

/hold

Putting on hold again until we nail down whether we keep the resource field name or not.

@abayer
Copy link
Contributor Author

abayer commented Aug 9, 2022

/retest

1 similar comment
@abayer
Copy link
Contributor Author

abayer commented Aug 9, 2022

/retest

@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/pipeline/v1beta1/resolver_conversion.go 37.5% 50.0% 12.5

@abayer
Copy link
Contributor Author

abayer commented Aug 18, 2022

So this still needs a squash, but I've avoided doing so until there's buy-in from @vdemeester. =)

I deliberately decided to not change the ResolutionRequest syntax for now, because there's already the v1alpha1 version in Resolution. Once this chain lands, I'll deprecate v1alpha1 and replace it with v1beta1 using []Param rather than map[string]string, but I didn't want to break compatibility for the existing CRD. We still need to have the v1alpha1 definition here so that we can add conversion to it, so that's why it's a bit messy. =)

@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/pipeline/v1beta1/resolver_conversion.go 37.5% 50.0% 12.5

@abayer
Copy link
Contributor Author

abayer commented Aug 18, 2022

/retest

@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/pipeline/v1beta1/resolver_conversion.go 37.5% 50.0% 12.5

@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/pipeline/v1beta1/resolver_conversion.go 37.5% 50.0% 12.5

@vdemeester
Copy link
Member

I deliberately decided to not change the ResolutionRequest syntax for now, because there's already the v1alpha1 version in Resolution. Once this chain lands, I'll deprecate v1alpha1 and replace it with v1beta1 using []Param rather than map[string]string, but I didn't want to break compatibility for the existing CRD. We still need to have the v1alpha1 definition here so that we can add conversion to it, so that's why it's a bit messy. =)

👍🏼

Alright, let's do the "Params as everywhere else approach". I don't think it's the ideal UX but it's the most constistent. Better have consistency 👍🏼

I approve 🎉

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom, lbernick, 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:
  • OWNERS [dibyom,lbernick,vdemeester]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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.

Code LGTM

Comment on lines -29 to -30
- all
- tekton
Copy link
Member

Choose a reason for hiding this comment

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

❤️

Comment on lines -40 to -46
properties:
spec:
description: Spec holds the parameters for the request.
type: object
properties:
params:
type: object
Copy link
Member

Choose a reason for hiding this comment

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

That's a shame this goes.. 😅

import "context"

// ManagedByLabelKey is the label key used to mark what is managing this resource
const ManagedByLabelKey = "app.kubernetes.io/managed-by"
Copy link
Member

Choose a reason for hiding this comment

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

I feel we have this defined at least once or twice elsewhere 😝

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have - I tried to avoid having pkg/apis/resolution depend on anything from pkg/apis/pipeline, which may have been overkill.

// resource being requested. For example: repo URL, commit SHA,
// path to file, the kind of authentication to leverage, etc.
// +optional
Parameters map[string]string `json:"params,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

and we listed in https://github.com/tektoncd/community/blob/main/design-principles.md#api-conventions that Tekton API should comply with the K8s API conventions

Yeah this is weird 😝 we want to not tied ourselves too much on kubernetes but still, we force ourselves to comply to kubernetes API convention 😅.

@abayer
Copy link
Contributor Author

abayer commented Aug 23, 2022

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 23, 2022
@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/pipeline/v1beta1/resolver_conversion.go 37.5% 50.0% 12.5

@abayer
Copy link
Contributor Author

abayer commented Aug 23, 2022

/retest

Copy link
Member

@jerop jerop left a comment

Choose a reason for hiding this comment

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

ArrayOrString was renamed to ParamValue in #5304 -- we need to rename it in this PR as well

Part of tektoncd#4710

In order to get remote resolution functionality to beta, we're moving it from a separate repository/release to be part of Pipeline. This is the first PR in a sequence moving the code from the Resolution repository into Pipeline.

This also changes the `.resolver.resource` field's name to `.resolver.params` for consistency across our syntax.

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
@abayer
Copy link
Contributor Author

abayer commented Aug 25, 2022

ArrayOrString was renamed to ParamValue in #5304 -- we need to rename it in this PR as well

Done!

@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/pipeline/v1beta1/resolver_conversion.go 37.5% 50.0% 12.5

@lbernick
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 25, 2022
@tekton-robot tekton-robot merged commit 34a67ad into tektoncd:main Aug 25, 2022
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/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants