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(backend): Support running behind a corporate proxy [RHIDP-2217] #1225

Commits on May 21, 2024

  1. Add the undici and global-agent packages to the backend workspace

    Per [1], global-agent addresses node-fetch proxying, while undici afects
    the native fetch.
    
    [1] https://github.com/backstage/backstage/blob/master/contrib/docs/tutorials/help-im-behind-a-corporate-proxy.md
    rm3l committed May 21, 2024
    Configuration menu
    Copy the full SHA
    31785ed View commit details
    Browse the repository at this point in the history
  2. Add the type definitions package for global-agent

    Command used for reference: 'yarn add --dev @types/global-agent'
    
    Otherwise, we get the following errors when building the container
    images:
    
    //:tsc: cache miss, executing 7cdd96a5dd9f08b5
    //:tsc: $ tsc
    //:tsc: packages/backend/src/index.ts:20:27 - error TS7016: Could not
    find a declaration file for module 'global-agent'.
    '/opt/app-root/src/node_modules/global-agent/dist/index.js' implicitly
    //:tsc:   Try `npm i --save-dev @types/global-agent` if it exists or add
    a new declaration (.d.ts) file containing `declare module
    'global-agent';`
    //:tsc:
    //:tsc:                              ~~~~~~~~~~~~~~
    //:tsc:
    //:tsc:
    //:tsc: Found 1 error in packages/backend/src/index.ts:20
    //:tsc:
    //:tsc: error Command failed with exit code 1.
    //:tsc: info Visit https://yarnpkg.com/en/docs/cli/run for documentation
    about this command.
    //:tsc: ERROR: command finished with error: command (/opt/app-root/src/)
    /tmp/yarn--1714731744742-0.9188035523240228/yarn run tsc exited (1)
    //#tsc: command (/opt/app-root/src/)
    /tmp/yarn--1714731744742-0.9188035523240228/yarn run tsc exited (1)
    rm3l committed May 21, 2024
    Configuration menu
    Copy the full SHA
    b168484 View commit details
    Browse the repository at this point in the history
  3. Regen yarn.lock

    rm3l committed May 21, 2024
    Configuration menu
    Copy the full SHA
    a2a7f4f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4a68eb4 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a53f457 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    bd8c558 View commit details
    Browse the repository at this point in the history
  7. Auto-set the GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE env var in t…

    …he container image
    
    Setting it to an empty value allows global-agent to rely on the rather
    conventional HTTP(S)_PROXY and NO_PROXY env vars. [1]
    Otherwise, users would need to configure both GLOBAL_AGENT_HTTP(S)_PROXY
    and HTTP(S)_PROXY to make proxying work with both global-agent and other
    libs.
    Also, it might be a bit confusing for the user to have to set it explicitly
    to an empty value.
    We can set it the other way around, but users can still override it if
    needed.
    
    [1] https://github.com/gajus/global-agent#what-is-the-reason-global-agentbootstrap-does-not-use-http_proxy
    rm3l committed May 21, 2024
    Configuration menu
    Copy the full SHA
    4d3f4cf View commit details
    Browse the repository at this point in the history
  8. Move configureCorporateProxyAgent to a separate file

    This would simplify the merging process in case of upstream changes
    
    Co-authored-by: Gennady Azarenkov <gazarenkov@redhat.com>
    rm3l and Gennady Azarenkov committed May 21, 2024
    Configuration menu
    Copy the full SHA
    ca0de4e View commit details
    Browse the repository at this point in the history
  9. Document that proxy settings can also be specified in the operator de…

    …fault config
    
    Co-authored-by: Gennady Azarenkov <gazarenkov@redhat.com>
    rm3l and Gennady Azarenkov committed May 21, 2024
    Configuration menu
    Copy the full SHA
    ae2c31e View commit details
    Browse the repository at this point in the history
  10. Add instructions for local development and testing in a separate 'doc…

    …s/proxy.md' file
    
    Co-authored-by: Corey Daley <cdaley@redhat.com>
    rm3l and coreydaley committed May 21, 2024
    Configuration menu
    Copy the full SHA
    9c2413b View commit details
    Browse the repository at this point in the history
  11. Document that plugin vendors have nothing to configure if they use th…

    …e supported libraries for HTTP data fetching
    
    Co-authored-by: Kim Tsao <ktsao@redhat.com>
    rm3l and kim-tsao committed May 21, 2024
    Configuration menu
    Copy the full SHA
    615e35a View commit details
    Browse the repository at this point in the history
  12. Apply suggestions from code review

    Co-authored-by: Corey Daley <cdaley@redhat.com>
    rm3l and coreydaley committed May 21, 2024
    Configuration menu
    Copy the full SHA
    37ae9ed View commit details
    Browse the repository at this point in the history