ontrack icon indicating copy to clipboard operation
ontrack copied to clipboard

Proxy issue in GitLab connector

Open pversteijnen opened this issue 8 years ago • 14 comments

Hello,

We are trying to use Ontrack in combination with GitLab. However this does not seem to work due to the extention not picking up the Proxy Settings.

What do we have:

  • AWS EC2 instance running docker
  • Ontrack and Prostgresql Containers Setup using docker compose

What did we do:

  • Configure the Proxy in Environment sesstings on host and in ontrack docker Container
  • Configure the Proxy in docker-compose file using JAVA_OPTIONS (GitHub Connection now worked GitLab did not)
  • Validation learned that the GitHub extention did use the Proxy Settings but the GitLab extention ignores them

Can this be fixed? Or can we do a pull request when we fixed it?

Kind regards, Pieter

(Credits go to Henk Bakker for figuring out why it did not work)

pversteijnen avatar Dec 20 '17 12:12 pversteijnen

Hi Pieter,

It's interesting to see that the proxy settings do work for GitHub, but not for GitLab. Have you a concrete example of the options you're using (after obfuscation of sensitive data of course)?

As for a PR, there is of course no issue ; it will be welcome. Just note that I'll be in holidays in the next two weeks so it'll have to wait.

Best regards, Damien.

dcoraboeuf avatar Dec 20 '17 13:12 dcoraboeuf

We are just trying to setup the connection between Ontrack and GitLab using the configuration section in Ontrack as administrator. Eventually we get a connection timeout. After viewing the log files and experiments using curl or wget we narrowed it down to the GitLab extention not setting the proxy on the GitLabApi object. In this file https://github.com/nemerosa/ontrack/blob/master/ontrack-extension-gitlab/src/main/java/net/nemerosa/ontrack/extension/gitlab/client/DefaultOntrackGitLabClient.java

Support is availalbe as stated here https://github.com/timols/java-gitlab-api/pull/193/files

pversteijnen avatar Dec 20 '17 13:12 pversteijnen

Understood. So you'd like to have the proxy configurable at the GitLab configuration level (together with other parameters like URL, etc.)? For GitHub, you were able to do otherwise?

dcoraboeuf avatar Dec 20 '17 13:12 dcoraboeuf

Basically when the proxy is configured in the Docker container or on the host the GitLab configuration should pick this up and use it when connecting to GitLab.

Thank you for the fast feedback!

pversteijnen avatar Dec 20 '17 13:12 pversteijnen

Apperently the GitHub connector does this already?

pversteijnen avatar Dec 20 '17 13:12 pversteijnen

What are the Java options that you pass at container level to enable the proxy?

dcoraboeuf avatar Dec 20 '17 13:12 dcoraboeuf

# Ontrack container
  ontrack:
    image: nemerosa/ontrack:3
    volumes:
      - /var/ontrack/site/data:/var/ontrack/data
      - /var/ontrack/site/conf:/var/ontrack/conf
    environment:
        PROFILE: prod
        JAVA_OPTIONS: '-Dhttp.proxyHost=http://proxy.blabla.com -Dhttp.proxyPort=3128 -Dhttps.proxyHost=http://proxy.blabla.com -Dhttps.proxyPort=31$
        JAVA_OPTS: '-Djavax.net.ssl.trustStore'
        http_proxy: http://proxy.blabla.com:3128
        https_proxy: http://proxy.blabla.com:3128
    links:
      - "postgresql:postgresql"
    ports:
      - "80:8080"
      - "443:443"

pversteijnen avatar Dec 20 '17 13:12 pversteijnen

So using the docker-compose file we include the proxy settings using JAVA_OPTIONS and also as environment settings

pversteijnen avatar Dec 20 '17 13:12 pversteijnen

  • For GitHub, I'm using the org.eclipse.egit.github.core.client.GitHubClient which must have a layer accepting the proxy options from the JVM
  • For GitLab, I'm using the org.gitlab.api.GitlabAPI but this one seems to have to be configured explicitly for proxy settings.

That can be corrected. I'd like to align the proxy settings source of course but that might not be trivial. What would you prefer? Reusing the JVM system properties (like http.proxyHost) or an explicit configuration in the configuration. I'd rather reuse the JVM settings.

As I said, I won't be able to perform any code change before January but I can always review a PR.

dcoraboeuf avatar Dec 20 '17 13:12 dcoraboeuf

I would like the JVM settings as well so no additionl proxy settings are required. Maybe it is good to validate this for other extentions as well.

We will see if we have time for the PR else we will see the change in the next version of Ontrack ;-)

pversteijnen avatar Dec 20 '17 13:12 pversteijnen

Yes indeed, any other connector (JIRA, Artifactory, other) might potentially need this. I'll do this for January.

dcoraboeuf avatar Dec 20 '17 13:12 dcoraboeuf

Thank you have a nice vacation!

pversteijnen avatar Dec 20 '17 13:12 pversteijnen

We did not found the time to work on a solution. Did you already had time to look into this? @dcoraboeuf ?

pversteijnen avatar Jan 16 '18 11:01 pversteijnen

Hi, I had no time to work on this. Any chance you could make a contribution to the code?

dcoraboeuf avatar Dec 02 '18 20:12 dcoraboeuf