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

updog: respect proxy settings #1324

Merged
merged 1 commit into from
Feb 22, 2021
Merged

updog: respect proxy settings #1324

merged 1 commit into from
Feb 22, 2021

Conversation

webern
Copy link
Contributor

@webern webern commented Feb 16, 2021

Issue number:

#1300

Description of changes:

Adds https-proxy and no-proxy settings to updog's config file. These are
used to set HTTPS_PROXY and NO_PROXY environment variables for the
process at the beginning of the program which ensures that they
are used by the underlying HTTP client.

Testing done:

  • I ran with an https-proxy setting and observed that updog used the proxy during check-update, I also ran a pod.
  • I ran with an https-proxy setting and with my repo's domain in the no-proxy setting. I observed that updog did not use the proxy during check-update. I also ran a pod.
  • I ran with no https-proxy setting and no no-proxy setting. I observed that updog did not use the proxy during check-update. I also ran a pod.

Upgrade Downgrade

  • I created a proxy with tinyproxy.
  • I checked out tag v1.0.5 and built an AMI and a repo.
  • I built what's in this PR and called it v1.0.6, added it to the repo.
  • I ran v1.0.5, upgraded to v1.0.6
  • I used updog on v1.0.6 and observed it using tinyproxy
  • I observed the updog.toml had an https_proxy value. The no_proxy key was absent as expected.
  • I downgraded back to v1.0.5.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

_ => return Ok(()),
};

// TODO - remove this if reqwest adds support for proxy addresses with no scheme
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you opened a GitHub issue for this in reqwest's repository, want to link it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linked to our own #1332 since it's a little bit wrapped up in a dependency knot.

sources/updater/updog/src/main.rs Show resolved Hide resolved
@webern
Copy link
Contributor Author

webern commented Feb 18, 2021

webern force-pushed the webern:updog-proxy branch from de8d2cf to f8a524e

Link to a tracking issue for workaround removal.

@webern
Copy link
Contributor Author

webern commented Feb 19, 2021

webern force-pushed the webern:updog-proxy branch from f8a524e to 3bf01fc

Rebase.

Comment on lines 6 to 11
{{#if settings.network.https-proxy}}
https_proxy="{{settings.network.https-proxy}}"
{{/if}}
{{#if settings.network.no-proxy}}
no_proxy=[{{join_array ", " settings.network.no-proxy}}]
{{/if}}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can suppress the additional newlines this will generate:

Suggested change
{{#if settings.network.https-proxy}}
https_proxy="{{settings.network.https-proxy}}"
{{/if}}
{{#if settings.network.no-proxy}}
no_proxy=[{{join_array ", " settings.network.no-proxy}}]
{{/if}}
{{~#if settings.network.https-proxy}}
https_proxy="{{settings.network.https-proxy}}"
{{~/if}}
{{~#if settings.network.no-proxy}}
no_proxy=[{{join_array ", " settings.network.no-proxy}}]
{{~/if}}

@webern
Copy link
Contributor Author

webern commented Feb 22, 2021

webern force-pushed the webern:updog-proxy branch from 3bf01fc to 3e24e88

rebase

Adds https-proxy and no-proxy settings to updog's config file. These are
used to set HTTPS_PROXY and NO_PROXY environment variables for the
process at the beginning of the program which which ensures that they
are used by the underlying HTTP client.
@webern
Copy link
Contributor Author

webern commented Feb 22, 2021

webern force-pushed the webern:updog-proxy branch from 3e24e88 to 73d3778

Cleaner config file with Ben's template syntax suggestion.

@webern webern merged commit c79f364 into bottlerocket-os:develop Feb 22, 2021
@webern webern deleted the updog-proxy branch February 22, 2021 22:25
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.

4 participants