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(pr): multiple bugs in the PR controller #187

Merged
merged 8 commits into from
Nov 9, 2023
Merged

Conversation

corrieriluca
Copy link
Member

@corrieriluca corrieriluca commented Nov 5, 2023

Breaking changes

  • PR controller: delete linked layers in discovery just before creating new ones
    • Previously new layers were created (with GenerateName), thus when a PR was updated outdated layers were still planned, resulting in confusing results in the comment.
    • Another strategy would have been to update the existing layers (this was implemented but never done because of the GenerateName uniqueness), but you also have to provide a value to metadata.resourceVersion when doing so, delete and re-create is simpler IMO.

Minor Changes

  • When handling push events, only inspect the layers linked to the affected repositories
  • Add a few more log entries on PR creation or resource reconciliation to improve log reading
  • Fix PR comment template: Markdown headings were not displayed properly when multiple layers were planned
  • Add a Planning state to the TerraformPullRequest resource for better UX

@codecov-commenter
Copy link

codecov-commenter commented Nov 5, 2023

Codecov Report

Merging #187 (cdb221f) into main (983ad07) will increase coverage by 0.15%.
The diff coverage is 63.41%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main     #187      +/-   ##
==========================================
+ Coverage   68.93%   69.09%   +0.15%     
==========================================
  Files          28       28              
  Lines        2025     2035      +10     
==========================================
+ Hits         1396     1406      +10     
  Misses        545      545              
  Partials       84       84              
Files Coverage Δ
internal/controllers/terraformlayer/controller.go 38.02% <100.00%> (ø)
...nal/controllers/terraformpullrequest/controller.go 33.87% <100.00%> (-1.05%) ⬇️
internal/controllers/terraformrun/controller.go 62.62% <100.00%> (ø)
internal/webhook/event/pullrequest.go 82.19% <100.00%> (+0.24%) ⬆️
internal/webhook/event/push.go 55.84% <100.00%> (+1.79%) ⬆️
...nal/controllers/terraformpullrequest/conditions.go 85.83% <0.00%> (+3.25%) ⬆️
internal/controllers/terraformpullrequest/layer.go 80.43% <66.66%> (-3.57%) ⬇️
...nternal/controllers/terraformpullrequest/states.go 57.95% <20.00%> (+0.97%) ⬆️

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@corrieriluca corrieriluca marked this pull request as ready for review November 5, 2023 17:49
@corrieriluca corrieriluca requested a review from Alan-pad November 5, 2023 17:49
@Alan-pad Alan-pad merged commit 2e79f83 into main Nov 9, 2023
6 of 7 checks passed
@corrieriluca corrieriluca deleted the fix/pr-controller branch November 9, 2023 15:30
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.

3 participants