-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
/assign @vdemeester @dibyom |
/test check-pr-has-kind-label |
@abayer: The specified target(s) for
The following commands are available to trigger optional jobs:
Use In response to this:
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. |
/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. |
// 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"` |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😝
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Lemme do that!
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 😅.
There was a problem hiding this comment.
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) =)
The following is the coverage report on the affected files.
|
/retest |
@pritidesai @vdemeester I've changed the
instead of
|
/retest |
/hold cancel |
There was a problem hiding this 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
The following is the coverage report on the affected files.
|
/retest |
There was a problem hiding this 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"` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
/hold Putting on hold again until we nail down whether we keep the |
ab51f0f
to
75bdc56
Compare
/retest |
1 similar comment
/retest |
75bdc56
to
2045ac9
Compare
The following is the coverage report on the affected files.
|
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 |
2045ac9
to
4403414
Compare
The following is the coverage report on the affected files.
|
/retest |
4403414
to
de1605b
Compare
The following is the coverage report on the affected files.
|
de1605b
to
f7d0e57
Compare
The following is the coverage report on the affected files.
|
👍🏼 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 |
[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:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM
- all | ||
- tekton |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
properties: | ||
spec: | ||
description: Spec holds the parameters for the request. | ||
type: object | ||
properties: | ||
params: | ||
type: object |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 😝
There was a problem hiding this comment.
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"` |
There was a problem hiding this comment.
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 😅.
f7d0e57
to
30e9a8c
Compare
/hold cancel |
The following is the coverage report on the affected files.
|
/retest |
There was a problem hiding this 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>
30e9a8c
to
744e4f3
Compare
Done! |
The following is the coverage report on the affected files.
|
/lgtm |
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:
functionality, content, code)
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes