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

Sync fails behind a proxy #71

Closed
przemeklal opened this issue Aug 18, 2023 · 1 comment · Fixed by #76
Closed

Sync fails behind a proxy #71

przemeklal opened this issue Aug 18, 2023 · 1 comment · Fixed by #76

Comments

@przemeklal
Copy link
Member

Bug Description

Git sync fails behind a proxy regardless of the protocol used, SSH and HTTP both fail.

To Reproduce

juju run-action cos-config/0 sync-now --wait
unit-cos-config-0:
  UnitId: cos-config/0
  id: "6"
  log:
  - 2023-08-18 12:06:54 +0000 UTC Calling git-sync with --one-time...
  - 2023-08-18 12:10:29 +0000 UTC I0818 12:06:54.309038     306 main.go:473] "level"=0
    "msg"="starting up" "pid"=306 "args"=["/git-sync","--repo","https://<username>:<token>@git.launchpad.net/~<redacted>/+git/cos-config","--branch","<branch>","--r
ev","HEAD","--depth","1","--root","/git","--dest","repo","--one-time"]
  - 2023-08-18 12:10:29 +0000 UTC I0818 12:06:54.309175     306 main.go:923] "level"=0
    "msg"="cloning repo" "origin"="https://<username>:<token>@git.launchpad.net/~<redacted>/+git/cos-config"
    "path"="/git"
  - 2023-08-18 12:10:29 +0000 UTC I0818 12:06:54.311270     306 main.go:929] "level"=0
    "msg"="git root exists and is not empty (previous crash?), cleaning up" "path"="/git"
  - '2023-08-18 12:10:30 +0000 UTC E0818 12:10:29.295155     306 main.go:525] "msg"="too
    many failures, aborting" "error"="Run(git clone -v --no-checkout -b <branch>
    --depth 1 https://<username>:<token>@git.launchpad.net/~<redacted>/+git/cos-config
    /git): context deadline exceeded: { stdout: "", stderr: "Cloning into ''/git''...\nfatal:
    unable to access ''https://git.launchpad.net/~<redacted>/+git/cos-config/'':
    Failed to connect to git.launchpad.net port 443: Connection timed out\n" }" "failCount"=0'
  message: 'Sync error: Exited with code 1.'
  results: {}
  status: failed
  timing:
    completed: 2023-08-18 12:10:30 +0000 UTC
    enqueued: 2023-08-18 12:03:02 +0000 UTC
    started: 2023-08-18 12:06:54 +0000 UTC

Repository is accessible through the proxy from the cos-config git-sync container:

$ juju ssh --container git-sync cos-config/0

# export https_proxy=http://<proxy_url>:8000
# git clone -v --no-checkout -b <branch> --depth 1 https://<username>:<token>@git.launchpad.net/~<redacted>/+git/cos-config
Cloning into 'cos-config'...
POST git-upload-pack (415 bytes)
POST git-upload-pack (157 bytes)
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (6/6), 16.93 KiB | 298.00 KiB/s, done.

Without the proxy env var it throws the same error as the sync-now action:

$ juju ssh --container git-sync cos-config/0

# unset https_proxy
# git clone -v --no-checkout -b <branch> --depth 1 https://<username>:<token>@git.launchpad.net/~<redacted>/+git/cos-config
Cloning into 'cos-config'...
fatal: unable to access 'https://git.launchpad.net/~<redacted>/+git/cos-config/': Failed to connect to git.launchpad.net port 443: Connection timed out

Environment

cos-configuration-k8s-operator rev 38 running behind proxya

Relevant log output

juju run-action cos-config/0 sync-now --wait
unit-cos-config-0:
  UnitId: cos-config/0
  id: "6"
  log:
  - 2023-08-18 12:06:54 +0000 UTC Calling git-sync with --one-time...
  - 2023-08-18 12:10:29 +0000 UTC I0818 12:06:54.309038     306 main.go:473] "level"=0
    "msg"="starting up" "pid"=306 "args"=["/git-sync","--repo","https://<username>:<token>@git.launchpad.net/~<redacted>/+git/cos-config","--branch","<branch>","--r
ev","HEAD","--depth","1","--root","/git","--dest","repo","--one-time"]
  - 2023-08-18 12:10:29 +0000 UTC I0818 12:06:54.309175     306 main.go:923] "level"=0
    "msg"="cloning repo" "origin"="https://<username>:<token>@git.launchpad.net/~<redacted>/+git/cos-config"
    "path"="/git"
  - 2023-08-18 12:10:29 +0000 UTC I0818 12:06:54.311270     306 main.go:929] "level"=0
    "msg"="git root exists and is not empty (previous crash?), cleaning up" "path"="/git"
  - '2023-08-18 12:10:30 +0000 UTC E0818 12:10:29.295155     306 main.go:525] "msg"="too
    many failures, aborting" "error"="Run(git clone -v --no-checkout -b <branch>
    --depth 1 https://<username>:<token>@git.launchpad.net/~<redacted>/+git/cos-config
    /git): context deadline exceeded: { stdout: "", stderr: "Cloning into ''/git''...\nfatal:
    unable to access ''https://git.launchpad.net/~<redacted>/+git/cos-config/'':
    Failed to connect to git.launchpad.net port 443: Connection timed out\n" }" "failCount"=0'
  message: 'Sync error: Exited with code 1.'
  results: {}
  status: failed
  timing:
    completed: 2023-08-18 12:10:30 +0000 UTC
    enqueued: 2023-08-18 12:03:02 +0000 UTC
    started: 2023-08-18 12:06:54 +0000 UTC

Additional context

Fixing it for ssh protocol might be tricky.

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

Successfully merging a pull request may close this issue.

2 participants