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: add option to overwrite Docker read and open timeout values #10359

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

yeikel
Copy link
Contributor

@yeikel yeikel commented Aug 4, 2024

What are you trying to accomplish?

Allows overwriting the read and open timeout values for interactions with the docker registry using two separate environment variables

What issues does this affect or fix?

I do not have any issue in the tracker, but I noticed this need while using dependabot-core with slow private registries

If there were multiple ways to approach the problem, why did you pick this one?

Initially, I considered using the existing environment variables defined here :

DEFAULT_OPEN_TIMEOUT_IN_SECONDS = 2
DEFAULT_READ_TIMEOUT_IN_SECONDS = 5

But I noticed that the default values there are different and I figured that separate environment properties may be better

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@github-actions github-actions bot added the L: docker Docker containers label Aug 4, 2024
@yeikel yeikel force-pushed the timeout/envs branch 3 times, most recently from 9035f98 to 2cbcb34 Compare August 4, 2024 05:32
@yeikel yeikel marked this pull request as ready for review August 4, 2024 05:40
@yeikel yeikel requested a review from a team as a code owner August 4, 2024 05:40
@yeikel
Copy link
Contributor Author

yeikel commented Aug 4, 2024

The e2e failures seem unrelated to my change

@yeikel yeikel force-pushed the timeout/envs branch 2 times, most recently from 6c031da to 8209f5d Compare August 11, 2024 23:37
@yeikel
Copy link
Contributor Author

yeikel commented Dec 4, 2024

@jeffwidman Any chance you can review this?

@yeikel yeikel force-pushed the timeout/envs branch 3 times, most recently from 6e51aee to 071ff89 Compare December 17, 2024 03:22
@sachin-sandhu
Copy link
Contributor

Hi @yeikel , Thanks for the contribution!! We are reviewing the changes.

@sachin-sandhu
Copy link
Contributor

Hi @yeikel , do you happen to know the default value for open_timeout if no value to supplied to DockerRegistry2, is it 2 seconds?

DockerRegistry2::Registry.new(
"https://#{registry_hostname}",
user: registry_credentials&.fetch("username", nil),
password: registry_credentials&.fetch("password", nil),
read_timeout: :read_timeout_in_seconds,
open_timeout: ??,
http_options: { proxy: ENV.fetch("HTTPS_PROXY", nil) }
)

sachin-sandhu
sachin-sandhu previously approved these changes Jan 28, 2025
Copy link
Contributor

@sachin-sandhu sachin-sandhu left a comment

Choose a reason for hiding this comment

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

approving the changes.

@sachin-sandhu sachin-sandhu self-requested a review January 28, 2025 13:28
@sachin-sandhu
Copy link
Contributor

Hi @yeikel , i suspected the smoke test fails are due to your changes, so i created a new PR with your changes and it started failing #11425 , can you please assess your changes once what might cause smoke tests to fail, Thanks !

@yeikel
Copy link
Contributor Author

yeikel commented Jan 29, 2025

Hi @yeikel , do you happen to know the default value for open_timeout if no value to supplied to DockerRegistry2, is it 2 seconds?

DockerRegistry2::Registry.new( "https://#{registry_hostname}", user: registry_credentials&.fetch("username", nil), password: registry_credentials&.fetch("password", nil), read_timeout: :read_timeout_in_seconds, open_timeout: ??, http_options: { proxy: ENV.fetch("HTTPS_PROXY", nil) } )

Hi @sachin-sandhu See the defaults here https://github.com/deitch/docker_registry2/blob/bfde04144f0b7fd63c156a1aca83efe19ee78ffd/lib/registry/registry.rb#L26-L27

@yeikel yeikel force-pushed the timeout/envs branch 4 times, most recently from c1ca350 to b44bbf7 Compare January 29, 2025 01:18
@yeikel
Copy link
Contributor Author

yeikel commented Jan 29, 2025

Hi @yeikel , i suspected the smoke test fails are due to your changes, so i created a new PR with your changes and it started failing #11425 , can you please assess your changes once what might cause smoke tests to fail, Thanks !

You are right. I updated it and it should be ready now.

I also documented the default values

Copy link
Contributor

@sachin-sandhu sachin-sandhu left a comment

Choose a reason for hiding this comment

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

Approving based on discussions and changes.

@sachin-sandhu
Copy link
Contributor

@yeikel , thanks for the changes , the test cases are good now , i have approved it and will be deploying/merging today. Thanks for improving :dependabot: !!

@sachin-sandhu sachin-sandhu merged commit 229af0a into dependabot:main Jan 29, 2025
38 checks passed
@sachin-sandhu
Copy link
Contributor

Update: PR was deployed and merged, we didn't find any issues while monitoring

cc @yeikel , @abdulapopoola

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: docker Docker containers
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants