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

Implement Dynamic Pipeline Name Retrieval from CodebaseBranch API Spec in Tekton #112

Closed
zmotso opened this issue Aug 13, 2024 · 0 comments · Fixed by #113
Closed

Implement Dynamic Pipeline Name Retrieval from CodebaseBranch API Spec in Tekton #112

zmotso opened this issue Aug 13, 2024 · 0 comments · Fixed by #113
Assignees
Labels
enhancement New feature or request

Comments

@zmotso
Copy link
Contributor

zmotso commented Aug 13, 2024

Description
Currently, we are using a specific technical approach to determine which pipeline should be triggered on specific events from the version control system. The pipeline name for PipelineRun is dynamically generated via TriggerTemplates located in the pipelines-library and follows the structure below:

pipelineRef:
  name: github-$(tt.params.buildtool)-$(tt.params.framework)-$(tt.params.cbtype)-build-$(tt.params.versioning-type)

This naming convention facilitates the automatic creation of PipelineRun instances in response to payload from GitHub during Merge Request events. However, this approach has limitations:

  1. We cannot define a specific pipeline for a code branch (codebasebranch).
  2. We must always manipulate buildtool, framework, codebase.type, and versioning type to generate the pipeline name.

To address these challenges, we propose defining review and build pipelines inside the codebasebranch API spec. With this approach, the EDP Interceptor will retrieve the pipeline name from the codebasebranch and return it for further processing to TriggerBinding. TriggerBinding will pass this value to TriggerTemplate in the pipelineRef section.

The new structure for TriggerTemplate will be:

pipelineRef:
  name: $(tt.params.pipelineName)

Acceptance Criteria

  1. The EDP Interceptor should be able to retrieve the pipeline name from the codebasebranch API spec.
  2. The retrieved pipeline name should be correctly passed to TriggerBinding.
  3. TriggerBinding should correctly pass the pipeline name to TriggerTemplate in the pipelineRef section.
  4. The new naming convention should be used:
    pipelineRef:
      name: $(tt.params.pipelineName)
    
  5. Codebase-operator should populate default values for review/build pipelines based on the old schema:
    {code}
    github-$(tt.params.buildtool)-$(tt.params.framework)-$(tt.params.cbtype)-build-$(tt.params.versioning-type)
    {code}
    to ensure backward compatibility.
  6. The solution should be tested to ensure that review and build pipelines can be dynamically triggered based on the codebasebranch API spec.
  7. Documentation should be updated to reflect the changes in the pipeline naming and triggering process.
  8. Ensure backward compatibility by verifying that existing pipelines using the old schema continue to function correctly.

Implementation Plan

  1. Update the codebasebranch API spec to include fields for review and build pipelines.

  2. Modify the EDP Interceptor to retrieve the pipeline name from the codebasebranch API spec.

  3. Update TriggerBinding to pass the retrieved pipeline name to TriggerTemplate.

  4. Modify TriggerTemplate to use the new naming convention:

    pipelineRef:
      name: $(tt.params.pipelineName)
    
  5. Implement logic in the codebase-operator to populate default values for review/build pipelines based on the old schema to ensure backward compatibility.

  6. Conduct unit and integration tests to verify that:

    • The new pipeline naming convention works as expected.
    • Review and build pipelines are dynamically triggered based on the codebasebranch API spec.
    • Existing pipelines using the old schema continue to function correctly.
  7. Update documentation to reflect changes in the pipeline naming and triggering process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

1 participant