openshift-pipelines / pipelines-as-code

Pipelines-as-Code for Tekton
https://pipelinesascode.com
Apache License 2.0
137 stars 81 forks source link

Redesign PAC Resolver #1762

Closed piyush-garg closed 2 months ago

piyush-garg commented 2 months ago

This will redesign resolver to work with multiple edge case scenarios.

Previously pac resolver was filtering pipelinerun based on annotations but it was resolving all pipelines in .tekton dir leading to resolving unnecessary pipelines and other issue was it was storing task based on task name, instead of annotation name and version, so different version of task were not used across pipelineruns in .tekton dir

Now with new design we are first filtering pipelinerun based on annotations, and then processing all pipelineruns one by one and only resolving pipeline related to these pipelineruns. Also we are now maintaining map of tasks with name and version at event level to not re fetch the task and now inline spec replacement in pipelinerun is done one by one so respective task as mentioned in annotation with name and version is used

Also before filtering the pipelineruns, we should make sure that no two pipelineruns exists with same name in .tekton dir

Added tests for the three scenarios

Submitter Checklist

chmouel commented 2 months ago

/retest

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 84.17722% with 25 lines in your changes missing coverage. Please review.

Project coverage is 65.13%. Comparing base (6f16e11) to head (9ba9da2). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/resolve/remote.go 78.07% 16 Missing and 9 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1762 +/- ## ========================================== + Coverage 65.08% 65.13% +0.04% ========================================== Files 174 174 Lines 13167 13185 +18 ========================================== + Hits 8570 8588 +18 + Misses 4029 4028 -1 - Partials 568 569 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

savitaashture commented 2 months ago

@piyush-garg Thank you for the PR

  1. Can you add e2e to cover the scenario which is described in this https://issues.redhat.com/browse/SRVKP-4018 and https://issues.redhat.com/browse/SRVKP-3517 which gives confidence that PR works in those cases

  2. Will this PR covers this issue https://issues.redhat.com/browse/SRVKP-3973 ?

piyush-garg commented 2 months ago

/test

savitaashture commented 2 months ago

@piyush-garg error message

[notice] A new release of pip is available: 23.2.1 -> 24.2
[notice] To update, run: pip install --upgrade pip
3: B6 Body message is missing
chmouel commented 2 months ago

/retest

piyush-garg commented 2 months ago

@piyush-garg Thank you for the PR

  1. Can you add e2e to cover the scenario which is described in this https://issues.redhat.com/browse/SRVKP-4018 and https://issues.redhat.com/browse/SRVKP-3517 which gives confidence that PR works in those cases
  2. Will this PR covers this issue https://issues.redhat.com/browse/SRVKP-3973 ?

Added e2e tests for all three

piyush-garg commented 2 months ago

/test

chmouel commented 2 months ago

LGTM

tested and reviewed this and this looks good, thanks @piyush-garg