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

feat(HACBS-2461): add pipelineRef struct to reference a pipeline #18

Closed
wants to merge 1 commit into from

Conversation

mmalina
Copy link

@mmalina mmalina commented Sep 19, 2023

This will be used in release-service (and possibly others in the future) to reference a pipeline in a ReleaseStrategy CR. This definition will then be converted and used in PipelineRuns created by the release service.

tektonParams = append(tektonParams, tektonv1.Param{
Name: p.Name,
Value: tektonv1.ParamValue{
Type: "string",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use ParamTypeString.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

tekton/pipeline_ref.go Show resolved Hide resolved
tekton/pipeline_ref.go Show resolved Hide resolved
}

type ResolverRef struct {
Resolver string `json:"resolver"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I said that we should limit the possible values, but let's avoid this to support custom resolvers.

Copy link
Author

Choose a reason for hiding this comment

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

ok. we do intend to restrict what pipelines can be used, right? but I guess that validation will go to the controller.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't quite get this comment, sorry. Could you rephrase it?


type PipelineRef struct {
Name string `json:"name,omitempty"`
ResolverRef ResolverRef `json:"resolverRef"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be optional as well if we support the same definition Tekton supports. Another option and maybe I like it would be to remove this struct and rename ResolverRef to PipelineRef.

In fact, the RP/RPA wil have probably something like:

Spec:
    Applications
    PipelineRef
        Resolver
        Params

Copy link
Author

Choose a reason for hiding this comment

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

Yep, that's what PipelineRun.spec has as well and I thought that's how I thought the types are set up, but you correctly pointed out that the types don't match what's in the PipelineRun yaml. Just spelling it out here.

I did as you suggested. Please take a look.

Copy link
Author

Choose a reason for hiding this comment

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

If you look at PipelineRun docs, you have something like this:

spec:
  pipelineRef:
    resolver: bundles
    params:
    - name: bundle
      value: docker.io/myrepo/mycatalog:v1.0

But in the types definition, there is one extra level:

type ResolverRef struct {
	Resolver ResolverName `json:"resolver,omitempty"`
	Params Params `json:"params,omitempty"`
}

type PipelineRef struct {
	Name string `json:"name,omitempty"`
	APIVersion string `json:"apiVersion,omitempty"`
	ResolverRef `json:",omitempty"`
}

I was just saying that originally I didn't realize this and assumed that the types are defined the way I would expect from looking at the docs (no middle layer). And that's the way we want to define it in our copy of the structure. But in any case, I did as you suggested.


func (pr PipelineRef) ToTektonPipelineRef() tektonv1.PipelineRef {
tektonParams := tektonv1.Params{}
for _, p := range pr.ResolverRef.Params {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
for _, p := range pr.ResolverRef.Params {
for _, param := range pr.ResolverRef.Params {

Also, empty line before this one please.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

}

func (pr PipelineRef) ToTektonPipelineRef() tektonv1.PipelineRef {
tektonParams := tektonv1.Params{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can call it just params. Not used in this context and doesn't seem confusing to me.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

This will be used in release-service (and possibly others in
the future) to reference a pipeline in a ReleaseStrategy CR.
This definition will then be converted and used in
PipelineRuns created by the release service.

Signed-off-by: Martin Malina <mmalina@redhat.com>
@mmalina
Copy link
Author

mmalina commented Sep 21, 2023

Since this will really only be used in the release-service, we decided not to add this here, but directly to the release-service repo: konflux-ci/release-service#252

@mmalina mmalina closed this Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants