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

Git cloning fails behind a proxy #19242

Closed
4 of 22 tasks
yeungalan0 opened this issue Mar 9, 2021 · 10 comments
Closed
4 of 22 tasks

Git cloning fails behind a proxy #19242

yeungalan0 opened this issue Mar 9, 2021 · 10 comments
Assignees
Labels
area/plugins kind/bug Outline of a bug - must adhere to the bug report template. new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes severity/P1 Has a major impact to usage or development of the system. sprint/current status/release-notes-review-done Issues that have been reviewed by the doc team for the Release Notes wording
Milestone

Comments

@yeungalan0
Copy link

yeungalan0 commented Mar 9, 2021

Describe the bug

When setting up a new eclipse che application using the standard operator with all default settings on an OpenShift cluster behind a proxy with a self signed certificate, everything seems to work except that after workspace creation the initial git clone times out, which seems to indicate it's not honoring/aware of the proxies.

  • On the theia container the proxy Env variables seem to be set
  • Manually I can run a git clone on the theia container in my project directory and that succeeds without issue
  • Image pulling and everything else seems to succeed in eclipse che, indicating that the cluster proxies are respected, but just the plugin/process that does the initial git clone seems to ignore them

Che version

  • latest
  • nightly
  • other: please specify
  • Eclipse-che operator version: 7.27.0

Steps to reproduce

  1. Deploy Eclipse Che using the Operator (leaving all defaults) to an OpenShift cluster with proxy configuration
  2. Start a workspace
  3. Project cloning fails with a timeout

Expected behavior

Cloning should succeed and pickup the proxy variables set in the environment.

Runtime

  • kubernetes (include output of kubectl version)
  • Openshift (include output of oc version)
  • minikube (include output of minikube version and kubectl version)
  • minishift (include output of minishift version and oc version)
  • docker-desktop + K8S (include output of docker version and kubectl version)
  • other: (please specify)

Screenshots

Installation method

  • chectl
    • provide a full command that was used to deploy Eclipse Che (including the output)
    • provide an output of chectl version command
  • OperatorHub
  • I don't know

Environment

  • my computer
    • Windows
    • Linux
    • macOS
  • Cloud
    • Amazon
    • Azure
    • GCE
    • other (please specify)
  • other: OpenShift cluster

Eclipse Che Logs

Log output from theia container:

2021-03-09 01:08:13.066 root ERROR [hosted-plugin: 46] Child process git stderr: fatal: unable to access 'https://github.com/che-samples/python-hello-world.git/': Failed to connect to github.com port 443: Operation timed out 
2021-03-09 01:08:13.066 root ERROR Child process git stderr: fatal: unable to access 'https://github.com/che-samples/python-hello-world.git/': Failed to connect to github.com port 443: Operation timed out

 
2021-03-09 01:08:13.189 root ERROR [hosted-plugin: 46] Child process "git" exited with code 128 
2021-03-09 01:08:13.189 root ERROR Child process "git" exited with code 128
 
2021-03-09 01:08:13.191 root INFO [hosted-plugin: 46] Couldn't clone https://github.com/che-samples/python-hello-world.git Error: Cloning into '/projects/python-hello-world'...
fatal: unable to access 'https://github.com/che-samples/python-hello-world.git/': Failed to connect to github.com port 443: Operation timed out

    at ChildProcess.<anonymous> (/tmp/theia-unpacked/eclipse_che_workspace_plugin.theia/lib/exec.js:83:36)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) 
2021-03-09 01:08:13.191 root INFO Couldn't clone https://github.com/che-samples/python-hello-world.git Error: Cloning into '/projects/python-hello-world'...
fatal: unable to access 'https://github.com/che-samples/python-hello-world.git/': Failed to connect to github.com port 443: Operation timed out

    at ChildProcess.<anonymous> (/tmp/theia-unpacked/eclipse_che_workspace_plugin.theia/lib/exec.js:83:36)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
 
2021-03-09 01:08:14.192 root ERROR [hosted-plugin: 46] Promise rejection not handled in one second: Error: Error: Cloning into '/projects/python-hello-world'...

We also see the below in the theia container logs, but aren't sure if it's related...

2021-03-09 01:06:03.383 root ERROR [hosted-plugin: 46] Promise rejection not handled in one second: TypeError: Cannot read property 'path' of undefined , reason: TypeError: Cannot read property 'path' of undefined 
2021-03-09 01:06:03.383 root ERROR Promise rejection not handled in one second: TypeError: Cannot read property 'path' of undefined , reason: TypeError: Cannot read property 'path' of undefined
 
2021-03-09 01:06:03.384 root ERROR [hosted-plugin: 46] With stack trace: TypeError: Cannot read property 'path' of undefined
    at Object.a [as joinPath] (/default-theia-plugins/vscode-builtin-json-language-features/extension/client/dist/node/jsonClientMain.js:1:248754)
    at /default-theia-plugins/vscode-builtin-json-language-features/extension/client/dist/node/jsonClientMain.js:1:116514
    at Array.forEach (<anonymous>)
    at /default-theia-plugins/vscode-builtin-json-language-features/extension/client/dist/node/jsonClientMain.js:1:116371
    at Array.forEach (<anonymous>)
    at f (/default-theia-plugins/vscode-builtin-json-language-features/extension/client/dist/node/jsonClientMain.js:1:116229)
    at /default-theia-plugins/vscode-builtin-json-language-features/extension/client/dist/node/jsonClientMain.js:1:122454 
2021-03-09 01:06:03.384 root ERROR With stack trace: TypeError: Cannot read property 'path' of undefined
    at Object.a [as joinPath] (/default-theia-plugins/vscode-builtin-json-language-features/extension/client/dist/node/jsonClientMain.js:1:248754)
    at /default-theia-plugins/vscode-builtin-json-language-features/extension/client/dist/node/jsonClientMain.js:1:116514
    at Array.forEach (<anonymous>)
    at /default-theia-plugins/vscode-builtin-json-language-features/extension/client/dist/node/jsonClientMain.js:1:116371
    at Array.forEach (<anonymous>)
    at f (/default-theia-plugins/vscode-builtin-json-language-features/extension/client/dist/node/jsonClientMain.js:1:116229)
    at /default-theia-plugins/vscode-builtin-json-language-features/extension/client/dist/node/jsonClientMain.js:1:122454

Additional context

Related issue:
#17017 - This closed issue seems to match what we're seeing exactly

Release Notes

Cloning a git repository failed even if the proxy was configured at the container level. This has been resolved when the editor is Che-Theia.

@yeungalan0 yeungalan0 added the kind/bug Outline of a bug - must adhere to the bug report template. label Mar 9, 2021
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Mar 9, 2021
@tolusha tolusha added the area/editor/theia Issues related to the che-theia IDE of Che label Mar 10, 2021
@tolusha
Copy link
Contributor

tolusha commented Mar 10, 2021

I've just tried to deploy Eclipse Che 7.27 on OpenShift 4.7 with cluster wide proxy configured.
I've set nonProxyHosts due to #17681

nonProxyHosts: 'api.<DOMAIN>|oauth-openshift.apps.<DOMAIN>'

I was able to start a workspace and project was successfully cloned.

It leads me to question if it is possible to check proxy server logs?

@azatsarynnyy
I am wondering if curl is used to clone the project.
If so, @yeungalan0 could you check if curl works correctly inside theia container?

@yeungalan0
Copy link
Author

yeungalan0 commented Mar 10, 2021

Thanks for looking into this @tolusha !

Ok we're using Eclipse Che 7.27 on Openshift 4.5.31 with a cluster wide proxy configured.

We used the default operator settings (so we didn't set the nonProxyHosts manually).

Unfortunately, we do not have access to the proxy server logs to see if the request even hit it.

curl seems to work without issue on the theia container.

bash-5.0$ curl www.google.com
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for." name="description"><meta content="noodp" name="robots"><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/logos/doodles/2021/wu-lien-tehs-142nd-birthday-6753651837108881-l.png" itemprop="image"><meta content="Dr. Wu Lien-teh's 142nd Birthday" 
...

The default operator settings we used to standup the cluster:

apiVersion: org.eclipse.che/v1
kind: CheCluster
metadata:
  name: eclipse-che
  namespace: eclipse-che
spec:
  auth:
    identityProviderURL: ''
    identityProviderRealm: ''
    oAuthSecret: ''
    identityProviderPassword: ''
    identityProviderImage: ''
    oAuthClientName: ''
    initialOpenShiftOAuthUser: true
    identityProviderClientId: ''
    identityProviderAdminUserName: ''
    externalIdentityProvider: false
  database:
    postgresImage: ''
    chePostgresUser: ''
    externalDb: false
    chePostgresHostName: ''
    chePostgresPassword: ''
    chePostgresDb: ''
    chePostgresPort: ''
  metrics:
    enable: true
  server:
    proxyURL: ''
    cheClusterRoles: ''
    singleHostGatewayConfigMapLabels: {}
    singleHostGatewayImage: ''
    proxyPassword: ''
    nonProxyHosts: ''
    pluginRegistryImage: ''
    serverMemoryRequest: ''
    devfileRegistryImage: ''
    proxyPort: ''
    singleHostGatewayConfigSidecarImage: ''
    tlsSupport: true
    serverMemoryLimit: ''
    allowUserDefinedWorkspaceNamespaces: false
    serverTrustStoreConfigMapName: ''
    proxyUser: ''
    cheImage: ''
    cheWorkspaceClusterRole: ''
    workspaceNamespaceDefault: <username>-che
    serverExposureStrategy: ''
    gitSelfSignedCert: false
    useInternalClusterSVCNames: true
    cheFlavor: ''
    cheImageTag: ''
  storage:
    postgresPVCStorageClassName: ''
    preCreateSubPaths: true
    pvcClaimSize: 1Gi
    pvcJobsImage: ''
    pvcStrategy: common
    workspacePVCStorageClassName: ''

@yeungalan0
Copy link
Author

yeungalan0 commented Mar 10, 2021

So seems like the OpenShift cluster wide proxy settings are automatically set in the theia container (including the no_proxy). When I unset the proxies and then run a clone, the timeout issue appears. Which seems to indicate that the module that does the initial git clone just seems to not have inherited the proxy Env variables somehow...

bash-5.0$ unset https_proxy http_proxy
bash-5.0$ git clone https://github.com/che-samples/python-hello-world.git
Cloning into 'python-hello-world'...
fatal: unable to access 'https://github.com/che-samples/python-hello-world.git/': Failed to connect to github.com port 443: Operation timed out

@tolusha
Copy link
Contributor

tolusha commented Mar 11, 2021

@RomanNikitenko
Copy link
Member

Taking into account #19242 (comment) looks like the problem is on workspace-plugin side, so I'm changing the area to plugins.

@RomanNikitenko RomanNikitenko added area/plugins and removed area/editor/theia Issues related to the che-theia IDE of Che labels Mar 11, 2021
@tolusha
Copy link
Contributor

tolusha commented Mar 11, 2021

/cc @svor

@azatsarynnyy azatsarynnyy added severity/P1 Has a major impact to usage or development of the system. and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Mar 11, 2021
@azatsarynnyy
Copy link
Member

@azatsarynnyy it sounds like a bug

@tolusha I agree

@ericwill ericwill added this to the 7.29 milestone Mar 11, 2021
@ericwill ericwill mentioned this issue Mar 18, 2021
46 tasks
@ericwill ericwill mentioned this issue Apr 8, 2021
42 tasks
@sunix
Copy link
Contributor

sunix commented Apr 8, 2021

che-theia is invoking the git command. So if the env variable is there it should work ... we'll investigate

@vitaliy-guliy
Copy link
Contributor

@yeungalan0 could you create a workspace from the devfile on your che deployment in a proxy environment and test how cloning works?

There is a PR with workspace plugin improvements.
Now the plugin checks for http_proxy, https_proxy and no_proxy environment variables and applies them when it runs git or ssh.

@vitaliy-guliy
Copy link
Contributor

See the PR to get more details how the fixup was tested.

@l0rd l0rd added new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes status/release-notes-review-needed Issues that needs to be reviewed by the doc team for the Release Notes wording labels Jun 8, 2021
@l0rd l0rd changed the title Git cloning fails in a proxy environment Support git cloning behind a proxy Jun 8, 2021
@l0rd l0rd changed the title Support git cloning behind a proxy Git cloning fails behind a proxy Jun 8, 2021
@themr0c themr0c added status/release-notes-review-done Issues that have been reviewed by the doc team for the Release Notes wording and removed status/release-notes-review-needed Issues that needs to be reviewed by the doc team for the Release Notes wording labels Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugins kind/bug Outline of a bug - must adhere to the bug report template. new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes severity/P1 Has a major impact to usage or development of the system. sprint/current status/release-notes-review-done Issues that have been reviewed by the doc team for the Release Notes wording
Projects
None yet
Development

No branches or pull requests

10 participants