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

Fix append issue to avoid duplication of pipelineruns #1446

Merged
merged 1 commit into from Sep 21, 2023

Conversation

savitaashture
Copy link
Member

@savitaashture savitaashture commented Sep 20, 2023

based on name match just appending pipelineruns leading duplication of pipelineruns and because of that we face
below issue

match_test.go:185: assertion failed: error is not nil: 
found multiple pipelinerun in .tekton with the same generateName: 
pull_request-test1, please update

Issue : #1447

As part of this commit fixing the if condition so
that there won't be append for duplicate pipelineruns

Signed-off-by: Savita Ashture sashture@redhat.com

Changes

Submitter Checklist

  • 📝 A good commit message is important for other reviewers to understand the context of your change. Please refer to How to Write a Git Commit Message for more details how to write beautiful commit messages. We rather have the commit message in the PR body and the commit message instead of an external website.
  • ♽ Run make test before submitting a PR (ie: with pre-commit, no need to waste CPU cycle on CI. (or even better install pre-commit and do pre-commit install in the root of this repo).
  • ✨ We heavily rely on linters to get our code clean and consistent, please ensure that you have run make lint before submitting a PR. The markdownlint error can get usually fixed by running make fix-markdownlint (make sure it's installed first)
  • 📖 If you are adding a user facing feature or make a change of the behavior, please verify that you have documented it
  • 🧪 100% coverage is not a target but most of the time we would rather have a unit test if you make a code change.
  • 🎁 If that's something that is possible to do please ensure to check if we can add a e2e test.
  • 🔎 If there is a flakiness in the CI tests then don't necessary ignore it, better get the flakyness fixed before merging or if that's not possible there is a good reason to bypass it. (token rate limitation may be a good reason to skip).

based on name match just appending pipelineruns leading
duplication of pipelineruns and because of that we face
issue related to multiple pipelinerun in tekton with
the same name or generateName

As part of this commit fixing the if condition so
that there won't be append for duplicate pipelineruns

Signed-off-by: Savita Ashture <sashture@redhat.com>
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (1da7790) 61.65% compared to head (10b00ac) 61.65%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1446   +/-   ##
=======================================
  Coverage   61.65%   61.65%           
=======================================
  Files         136      136           
  Lines       10204    10205    +1     
=======================================
+ Hits         6291     6292    +1     
  Misses       3408     3408           
  Partials      505      505           
Files Changed Coverage Δ
pkg/pipelineascode/match.go 67.88% <100.00%> (+0.14%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@savitaashture savitaashture added backport bug Something isn't working labels Sep 21, 2023
Comment on lines -224 to +225
if match.PipelineRun.Name == pipelineRuns[pr].Name {
if match.PipelineRun.GetName() == "" && match.PipelineRun.GetGenerateName() == pipelineRuns[pr].GenerateName ||
match.PipelineRun.GetName() != "" && match.PipelineRun.GetName() == pipelineRuns[pr].Name {
Copy link
Member

Choose a reason for hiding this comment

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

don't you have to put quotes in between the two, ie:

Suggested change
if match.PipelineRun.Name == pipelineRuns[pr].Name {
if match.PipelineRun.GetName() == "" && match.PipelineRun.GetGenerateName() == pipelineRuns[pr].GenerateName ||
match.PipelineRun.GetName() != "" && match.PipelineRun.GetName() == pipelineRuns[pr].Name {
if (match.PipelineRun.GetName() == "" && match.PipelineRun.GetGenerateName() == pipelineRuns[pr].GenerateName) ||
(match.PipelineRun.GetName() != "" && match.PipelineRun.GetName() == pipelineRuns[pr].GetName()) {
types.PipelineRuns = append(types.PipelineRuns, pipelineRuns[pr])

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 did put initially but its working without that also so i did not add parenthesis

@chmouel chmouel merged commit 3efd1a3 into openshift-pipelines:main Sep 21, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport bug Something isn't working
Development

Successfully merging this pull request may close these issues.

None yet

2 participants