Skip to content

Support http/https proxy for core.#GitPull, core.#HTTPFetch, core.#Pull #2756

Closed

Description

@samalba

PR #2748 added support for HTTP and HTTPS proxy from environment variables inside actions tasks. However it actually supports proxies for anything using core.#Exec. The proxy env vars will be ignored for other ops involving network connections: core.#GitPull, core.#HTTPFetch, core.#Pull.

It's not critical as most packages are built on top of core.#Exec. Also, not sure if there is a proper way to support proxies outside of a llb Exec.

Related issues: #2053 #1369

cc @dolanor @aluzzardi

Activity

  1. added
    kind/bug
    area/engine
    on Jul 7, 2022
  2. dolanor commented on Jul 7, 2022

    @dolanor
    Contributor

    After a few investigation, I couldn't see some llb.WithProxy that would return some PullOption instead of RunOption.
    So I investigated more, and found that even launching the buildkitd container with https_proxy env var set doesn't make it contact any proxy at all.
    So I guess it would be some upstream issue, unless I'm mistaken.

    related: moby/buildkit#971

  3. spacedub commented on Jul 15, 2022

    @spacedub

    @dolanor AFAIK buildkitd does honor the usual env vars for pull and push:

    docker run --rm --env HTTPS_PROXY=1.2.3.4 --env HTTP_PROXY=1.2.3.4 --privileged --name buildkitd -ti moby/buildkit

    Will end with:

    error="failed to do request: Head \"https://registry-1.docker.io/v2/library/debian/manifests/latest\": proxyconnect tcp: dial tcp 1.2.3.4:80: i/o timeout" host=registry-1.docker.io

    The code responsible for that seems to be here: https://github.com/moby/buildkit/blob/a45b7698dcc14aea3b42ea8bbba39a39381e18f1/util/resolver/resolver.go#L187

    Of course that's not enough to be able to set a proxy per-op - but then I'm wondering if that's really a use-case worth addressing?

    eg: having to use a proxy seems to me like something you want globally, all the time - so in that case it seems to make more sense to just start buildkitd manually with the appropriate env rather than having to somehow stuff that into plans / actions.

    2 cents.

    Hope that helps.

  4. samalba commented on Jul 19, 2022

    @samalba
    ContributorAuthor

    Interesting, this did not work when I tried it on dagger-buildkitd (the buildkitd that dagger starts automatically). Maybe it was due to my dev env. Either way, if this is true, it's trivial to fix by optionally add the env vars on the docker run cli if they are present on the host:

    cmd = exec.CommandContext(ctx,

  5. dolanor commented on Aug 16, 2022

    @dolanor
    Contributor

    Interesting, this did not work when I tried it on dagger-buildkitd (the buildkitd that dagger starts automatically). Maybe it was due to my dev env. Either way, if this is true, it's trivial to fix by optionally add the env vars on the docker run cli if they are present on the host

    That's what I tried in my experimentations, and even that didn't work, which made me think it was more of an upstream issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/enginekind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions