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: make http client retryable #6632

Merged
merged 1 commit into from
Jul 6, 2021
Merged

feat: make http client retryable #6632

merged 1 commit into from
Jul 6, 2021

Conversation

yujunz
Copy link
Contributor

@yujunz yujunz commented Jul 3, 2021

Closes #6600

@yujunz yujunz force-pushed the retry branch 2 times, most recently from e08fc46 to fc65f29 Compare July 4, 2021 01:48
@codecov
Copy link

codecov bot commented Jul 4, 2021

Codecov Report

Merging #6632 (f2394c5) into master (f12650c) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6632      +/-   ##
==========================================
- Coverage   41.29%   41.29%   -0.01%     
==========================================
  Files         156      156              
  Lines       20688    20689       +1     
==========================================
  Hits         8543     8543              
- Misses      10937    10938       +1     
  Partials     1208     1208              
Impacted Files Coverage Δ
cmd/argocd/commands/root.go 2.17% <0.00%> (-0.05%) ⬇️
util/settings/settings.go 47.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f12650c...f2394c5. Read the comment docs.

@yujunz yujunz marked this pull request as ready for review July 4, 2021 03:23
Copy link
Member

@jannfis jannfis left a comment

Choose a reason for hiding this comment

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

Thanks for this PR @yujunz.

LGTM and non-intrusive to me, and I think it's a really useful feature to have to improve stability of pipelines. However, I have some usability concern, please see below.

Also, since you are introducing a new dependency, can you please give some information about that and its license? Thanks.

@@ -69,5 +69,6 @@ func NewCommand() *cobra.Command {
command.PersistentFlags().StringSliceVarP(&clientOpts.Headers, "header", "H", []string{}, "Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)")
command.PersistentFlags().BoolVar(&clientOpts.PortForward, "port-forward", config.GetBoolFlag("port-forward"), "Connect to a random argocd-server port using port forwarding")
command.PersistentFlags().StringVar(&clientOpts.PortForwardNamespace, "port-forward-namespace", config.GetFlag("port-forward-namespace", ""), "Namespace name which should be used for port forwarding")
command.PersistentFlags().IntVar(&clientOpts.RetryMax, "retry-max", 0, "Maximum number of retries")
Copy link
Member

Choose a reason for hiding this comment

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

I don't think retry-max is a good name for the option. The name should imply what is actually retried, although I cannot think of a proper name right now. Maybe http-retries or api-retries would fit better? Also, the description should be adapted to be a little more verbose.

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 to http-retry-max and adapted the description to be more verbose.

@yujunz
Copy link
Contributor Author

yujunz commented Jul 6, 2021

Also, since you are introducing a new dependency, can you please give some information about that and its license? Thanks.

The new dependency hashicorp/go-retryablehttp is released under MPL 2.0 which should be compatible to compile into Apache licensed code like argocd if I understand the FAQ correctly.

Q13: May I combine MPL-licensed code and BSD-licensed code in the same executable program? What about Apache?
Yes to both. Mozilla currently does this with BSD-licensed code. For example, libvpx, which is used in Firefox to decode WebM video, is under a BSD license.

Signed-off-by: Yujun Zhang <zhangyujun@gmail.com>
Copy link
Member

@jannfis jannfis left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@jannfis jannfis merged commit e0db23b into argoproj:master Jul 6, 2021
@yujunz yujunz deleted the retry branch July 6, 2021 14:47
@jannfis jannfis added the needs-verification PR requires pre-release verification label Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-verification PR requires pre-release verification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support retry in cli command
2 participants