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: allow configuration of retry attempts for Promotion steps #2940

Merged
merged 8 commits into from
Nov 21, 2024

Conversation

hiddeco
Copy link
Contributor

@hiddeco hiddeco commented Nov 15, 2024

We have discovered some edge cases in which a Promotion step may end up in an infinite loop. To remediate this, we can configure the number of (retry) attempts a step is allowed to make before bailing.

This could later be extended to a waiting (or polling) configuration for steps like git-wait-for-pr, to e.g., set a deadline for merging a pull request.

With this pull request, any step execution (no matter the outcome) is counted as an "attempt", while the wait-for-pr and argocd-update steps have been allowed an unlimited number of retries (by default) to achieve backwards compatible behavior.

steps:
- uses: argocd-update
  retry:
    attempts: 5
  config:
    apps:
    - name: guestbook
       sources:
       - repoURL: https://github.com/example/guestbook.git

Note: In the future, we probably want to introduce more rigorous handling of errors, to be able to distinguish "fatal" errors from transient ones.

Copy link

netlify bot commented Nov 15, 2024

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit 029aff5
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-io/deploys/673f92233bf90800088f322e
😎 Deploy Preview https://deploy-preview-2940.docs.kargo.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@hiddeco hiddeco force-pushed the promotion-steps-retry branch 8 times, most recently from 16407fe to a98bbd1 Compare November 20, 2024 01:02
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 82.81787% with 50 lines in your changes missing coverage. Please review.

Project coverage is 51.27%. Comparing base (40efb5c) to head (029aff5).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/directives/simple_engine_promote.go 82.38% 27 Missing and 7 partials ⚠️
internal/controller/promotions/promotions.go 0.00% 4 Missing ⚠️
internal/directives/git_pr_opener.go 40.00% 3 Missing ⚠️
internal/directives/git_pr_waiter.go 25.00% 3 Missing ⚠️
internal/directives/simple_engine_health.go 95.58% 2 Missing and 1 partial ⚠️
internal/directives/argocd_updater.go 0.00% 2 Missing ⚠️
internal/directives/argocd_revisions.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2940      +/-   ##
==========================================
+ Coverage   51.04%   51.27%   +0.23%     
==========================================
  Files         280      282       +2     
  Lines       25380    25465      +85     
==========================================
+ Hits        12955    13057     +102     
+ Misses      11719    11707      -12     
+ Partials      706      701       -5     

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


🚨 Try these New Features:

@hiddeco hiddeco force-pushed the promotion-steps-retry branch 3 times, most recently from 174f60a to 482226b Compare November 20, 2024 15:37
@hiddeco hiddeco marked this pull request as ready for review November 20, 2024 16:04
@hiddeco hiddeco requested a review from a team as a code owner November 20, 2024 16:04
@hiddeco hiddeco added this to the v1.1.0 milestone Nov 20, 2024
@hiddeco hiddeco self-assigned this Nov 20, 2024
@hiddeco hiddeco force-pushed the promotion-steps-retry branch from 1d9a82a to c6aa00f Compare November 21, 2024 14:18
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
@hiddeco hiddeco force-pushed the promotion-steps-retry branch from c6aa00f to f8c4a5b Compare November 21, 2024 15:40
Comment on lines 112 to 113
// PromotionRetry describes the retry policy for a PromotionStep.
type PromotionRetry struct {
Copy link
Member

Choose a reason for hiding this comment

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

Given #2972, I wonder if we should name this PromotionStepRetry or even PromotionStepRetryPolicy as I think we will probably also end up with Promotion-level retry policies in addition to step-level.

Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed it to PromotionStepRetry to reserve the policy version for e.g. some enum that describes how it should be retried.

Copy link
Member

@krancour krancour left a comment

Choose a reason for hiding this comment

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

🔥 This is awesome!

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
@hiddeco hiddeco enabled auto-merge November 21, 2024 20:04
@hiddeco hiddeco added this pull request to the merge queue Nov 21, 2024
Merged via the queue into akuity:main with commit 1b14619 Nov 21, 2024
17 checks passed
@hiddeco hiddeco deleted the promotion-steps-retry branch November 21, 2024 20:27
@krancour krancour mentioned this pull request Dec 5, 2024
fykaa pushed a commit to fykaa/kargo that referenced this pull request Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants