nemerosa / ontrack

Continuous delivery monitoring
https://nemerosa.github.io/ontrack
MIT License
96 stars 25 forks source link

Proxy issue in GitLab connector #588

Open pversteijnen opened 6 years ago

pversteijnen commented 6 years ago

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:

What did we do:

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)

dcoraboeuf commented 6 years ago

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.

pversteijnen commented 6 years ago

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

dcoraboeuf commented 6 years ago

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?

pversteijnen commented 6 years ago

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 commented 6 years ago

Apperently the GitHub connector does this already?

dcoraboeuf commented 6 years ago

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

pversteijnen commented 6 years ago
# 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 commented 6 years ago

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

dcoraboeuf commented 6 years ago

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.

pversteijnen commented 6 years ago

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 ;-)

dcoraboeuf commented 6 years ago

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

pversteijnen commented 6 years ago

Thank you have a nice vacation!

pversteijnen commented 6 years ago

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

dcoraboeuf commented 5 years ago

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