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

Migrate PipelineResource in their own package… 📦 #1773

Merged

Conversation

vdemeester
Copy link
Member

@vdemeester vdemeester commented Dec 19, 2019

Changes

Extracts PipelineResource in their own package while still being exposed in tekton.dev. This is require to support embedded PipelineResource in v1alpha2 with PipelineResource still being alpha (aka v1alpha1).

  • This adds a pkg/apis/resource/v1alpha1 package which holds PipelineResource struct and related.
  • This adds a pkg/client/resource package (in addition to the pkg/client package) for the PipelineResource generated clients, lister, … code.

… and API group (resource.tekton.dev). This is mainly done to
separate the PipelineResource from the rest of the API and remove
the dependency cycle that we get by keeping PipelineResource in
alpha.

This doesn't change yet the current webhook and controller, and does
not expose PipelineResource.resource.tekton.dev (current exposed are
PipelineResource.tekton.dev).

We can expose this and support this once we expose v1alpha2 (or
v1beta1). We will need to auto-convert PipelineResource.tekton.dev
to PipelineResource.resource.tekton.dev, the easiest way would be to
have a controller handling that.

This comes from this comment #1725 (comment) 👼 .

This is an experiment, seeing if it make sense. Without this, it is very difficult to support embedded PipelineResource in v1alpha2 (or I am missing something really obvious 😝 )
/hold

/cc @bobcatfish

Signed-off-by: Vincent Demeester vdemeest@redhat.com

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

@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 Dec 19, 2019
@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Dec 19, 2019
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 19, 2019
@imjasonh imjasonh changed the title Migrate PipelineResource in there own package… 📦 Migrate PipelineResource in their own package… 📦 Dec 19, 2019
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/resource/v1alpha1/pipeline_resource_defaults.go Do not exist 0.0%
pkg/apis/resource/v1alpha1/pipelineresource_validation.go Do not exist 86.8%
pkg/apis/resource/v1alpha1/register.go Do not exist 0.0%

@vdemeester
Copy link
Member Author

/test pull-tekton-pipeline-integration-tests

@vdemeester vdemeester mentioned this pull request Dec 19, 2019
3 tasks
Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

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

Thanks again for taking on all this finicky work 🙏

This doesn't change yet the current webhook and controller, and does
not expose PipelineResource.resource.tekton.dev (current exposed are
PipelineResource.tekton.dev).

I think it makes a lot of sense to move the code, but I'm a bit confused by why we want to add a new API group - looking at our other types, and even looking at triggers types such as trigger bindings they are still in the tekton.dev group (or maybe this is a mistake and the group should be different?), so I don't quite understand why we want pipelineresources to be an exceptional case 🤔

v1alpha1.SchemeGroupVersion.WithKind("Task"): &v1alpha1.Task{},
v1alpha1.SchemeGroupVersion.WithKind("ClusterTask"): &v1alpha1.ClusterTask{},
v1alpha1.SchemeGroupVersion.WithKind("TaskRun"): &v1alpha1.TaskRun{},
v1alpha1.SchemeGroupVersion.WithKind("PipelineRun"): &v1alpha1.PipelineRun{},
v1alpha1.SchemeGroupVersion.WithKind("Condition"): &v1alpha1.Condition{},
v1alpha1.SchemeGroupVersion.WithKind("PipelineResource"): &v1alpha1.PipelineResource{},
// resourcev1alpha1.SchemeGroupVersion.WithKind("PipelineResource"): &resourcev1alpha1.PipelineResource{},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe accidentally included? Or if this is the line that exposes the API and we want to uncomment it later, maybe a comment above with an issue number explaining?

})
}

}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like some of these files are duplicated vs. moved? e.g. would https://github.com/tektoncd/pipeline/blob/master/pkg/apis/pipeline/v1alpha1/pipelineresource_validation_test.go still exist after this PR?

@vdemeester
Copy link
Member Author

I think it makes a lot of sense to move the code, but I'm a bit confused by why we want to add a new API group - looking at our other types, and even looking at triggers types such as trigger bindings they are still in the tekton.dev group (or maybe this is a mistake and the group should be different?), so I don't quite understand why we want pipelineresources to be an exceptional case thinking

Right, on triggers, I would really like having them in a different group (make it easier to detect the precense of trigger without having to know which types it exposes — right now.. | grep tekton.dev returns pipeline and triggers 😛).

The main problem I've got, so far, is that I did not manage to make the codegenerator(s) work with two distinct package serving the exact same api group (the clients are from one package only making the thing useless). I am still trying to figure out how to do that, as it would definitely simplify that pull request.

That said, I think we may discuss apiGroup in pipeline and in tekton in general 👼.

@bobcatfish
Copy link
Collaborator

Right, on triggers, I would really like having them in a different group (make it easier to detect the precense of trigger without having to know which types it exposes — right now.. | grep tekton.dev returns pipeline and triggers stuck_out_tongue).

Ah okay, so in that case maybe we should have pipeline.tekton.dev and triggers.tekton.dev - i.e. mirror our repo layout?

I'm still not sure it would make sense to put resources in it's own group 🤔 on the other hand that might fit well with some of the plans @sbwsg and I have been scheming 😈

The main problem I've got, so far, is that I did not manage to make the codegenerator(s) work with two distinct package serving the exact same api group (the clients are from one package only making the thing useless). I am still trying to figure out how to do that, as it would definitely simplify that pull request.

I think it'd be better if we could get this to work, esp. if the main problem is that the tool doesn't work. If you want to write up an issue and get any of the rest of us to take a stab at it just say the word!! happy to help :D

@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 23, 2019
@vdemeester vdemeester force-pushed the move-resource-separate-package branch 3 times, most recently from 494f369 to fe3b432 Compare December 23, 2019 11:26
@vdemeester
Copy link
Member Author

@bobcatfish should be fixed now, no more different apiGroup.

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/resource/v1alpha1/pipeline_resource_defaults.go Do not exist 0.0%
pkg/apis/resource/v1alpha1/pipelineresource_validation.go Do not exist 86.8%
pkg/apis/resource/v1alpha1/register.go Do not exist 0.0%

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/resource/v1alpha1/pipeline_resource_defaults.go Do not exist 0.0%
pkg/apis/resource/v1alpha1/pipelineresource_validation.go Do not exist 86.8%
pkg/apis/resource/v1alpha1/register.go Do not exist 0.0%

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/resource/v1alpha1/pipeline_resource_defaults.go Do not exist 0.0%
pkg/apis/resource/v1alpha1/pipelineresource_validation.go Do not exist 86.8%
pkg/apis/resource/v1alpha1/register.go Do not exist 0.0%

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/resource/v1alpha1/pipeline_resource_defaults.go Do not exist 0.0%
pkg/apis/resource/v1alpha1/pipelineresource_validation.go Do not exist 86.8%
pkg/apis/resource/v1alpha1/register.go Do not exist 0.0%

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/resource/v1alpha1/pipeline_resource_defaults.go Do not exist 0.0%
pkg/apis/resource/v1alpha1/pipelineresource_validation.go Do not exist 86.8%
pkg/apis/resource/v1alpha1/register.go Do not exist 0.0%

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/resource/v1alpha1/pipeline_resource_defaults.go Do not exist 0.0%
pkg/apis/resource/v1alpha1/pipelineresource_validation.go Do not exist 86.8%
pkg/apis/resource/v1alpha1/register.go Do not exist 0.0%

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/resource/v1alpha1/pipeline_resource_defaults.go Do not exist 0.0%
pkg/apis/resource/v1alpha1/pipelineresource_validation.go Do not exist 86.8%
pkg/apis/resource/v1alpha1/register.go Do not exist 0.0%

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/resource/v1alpha1/pipeline_resource_defaults.go Do not exist 0.0%
pkg/apis/resource/v1alpha1/pipelineresource_validation.go Do not exist 86.8%
pkg/apis/resource/v1alpha1/register.go Do not exist 0.0%

@vdemeester
Copy link
Member Author

@bobcatfish @sbwsg this should be ready for review 👼

@vdemeester
Copy link
Member Author

/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 Jan 9, 2020
This is mainly done to separate the `PipelineResource` from the rest
of the API *and* remove the dependency cycle that we get by keeping
`PipelineResource` in alpha.

This update the code generation to generate a different set of clients,
informers, clientsets, … for `resource`, although it is exposed in the
same apiGroup.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
@vdemeester vdemeester force-pushed the move-resource-separate-package branch from 3600fe0 to 30b421b Compare January 9, 2020 13:50
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/resource/v1alpha1/pipeline_resource_defaults.go Do not exist 0.0%
pkg/apis/resource/v1alpha1/pipelineresource_validation.go Do not exist 86.8%
pkg/apis/resource/v1alpha1/register.go Do not exist 0.0%

bash ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \
github.com/tektoncd/pipeline/pkg/client github.com/tektoncd/pipeline/pkg/apis \
"pipeline:v1alpha1,v1alpha2" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
GOFLAGS="${OLDGOFLAGS}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it possible to add some comments around the enw lines in this script explaining what they do? and/or explain in the commit message? iirc from the previous review, it was not obvious what you had to do to make this work without a different apigroup, might be useful to record how this ended up working

Copy link
Member Author

Choose a reason for hiding this comment

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

ah this comes from #1783.. forgot to mention that 😂 😓

Copy link
Member Author

Choose a reason for hiding this comment

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

I need to update comments on the bash … calls though, to explain why there is 2 indeed

Copy link
Collaborator

Choose a reason for hiding this comment

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

kk! happy for that to be in follow up PR :)

@bobcatfish
Copy link
Collaborator

/lgtm

thanks again for all your hard work @vdemeester 🙏 😭 🙇‍♀

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 9, 2020
@bobcatfish
Copy link
Collaborator

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bobcatfish

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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 9, 2020
@tekton-robot tekton-robot merged commit fdbe724 into tektoncd:master Jan 9, 2020
@vdemeester vdemeester deleted the move-resource-separate-package branch January 10, 2020 08:16
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. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit lgtm Indicates that a PR is ready to be merged. 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.

4 participants