Bamboo fails to fetch an HTTP Git Repository

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Bamboo fails to fetch Git repository data running over the HTTP protocol. That can happen on a Checkout task and when testing the Repository connectivity on the repository settings menu.

Environment

  • Any Bamboo version, Server and Agents
  • Git HTTP Repository:
    • GitHub
    • Bitbucket Server
    • Bitbucket Cloud
    • Generic HTTP repositories

Diagnosis

Bamboo reports issues while testing the connectivity with a Repository. The error in UI that you see while you test the connection in the linked repository configuration will be as below:

In the atlassian-bamboo.log file, you will see the below error, which points to testing of the connection failure message:

2023-04-28 10:22:19,540 INFO /rest/api/latest/repository/testConnection; user: testuser RepositoryResource Testing connection to repository (type: Bitbucket Cloud, location: https://bitbucket.org/sky/test_scan)
2023-04-28 10:24:22,160 INFO /rest/api/latest/repository/testConnection; user: testuser RepositoryResource Failed to connect to repository (type: Bitbucket Cloud, location: https://bitbucket.org/sky/test_scann, time: 2.159 min, errors: fatal: unable to access 'https://service_new@bitbucket.org/sky/test_scan/': Failed to connect to 2406:da00:ff00::22c0:3470: Network is unreachable)
2023-04-28 10:26:14,348 INFO /rest/api/latest/repository/testConnection; user: testuser RepositoryResource Testing connection to repository (type: Bitbucket Cloud, location: https://bitbucket.org/sky/test_scan)
2023-04-28 10:31:17,276 INFO /rest/api/latest/repository/testConnection; user: testuser RepositoryResource Failed to connect to repository (type: Bitbucket Cloud, location: https://bitbucket.org/sky/test_scan, time: 2.121 min, errors: fatal: unable to access 'https://service_new@bitbucket.org/sky/test_scan/': Failed to connect to 2406:da00:ff00::22c5:2ef4: Network is unreachable)
2023-04-28 10:34:23,455 INFO /rest/api/latest/repository/testConnection; user: testuser RepositoryResource Failed to connect to repository (type: Bitbucket Cloud, location: https://bitbucket.org/sky/test_scan, time: 2.121 min, errors: fatal: unable to access 'https://service_new@bitbucket.org/sky/test_scan/': Failed to connect to 2406:da00:ff00::22c0:3470: Network is unreachable)

Bamboo also reports errors during the Checkout task with connectivity errors similar to the ones listed above.

Cause

The issue occurs when Git is unable to establish a connection with the HTTP endpoint. This can be attributed to various factors, most commonly a network configuration error, such as a firewall or routing issue or a missing HTTP proxy setting.

It is essential to emphasize that, even with a correct configuration, Bamboo may interpret the Git Repository DNS records as IPv6 hosts due to the network infrastructure. As a result, it will attempt to connect to external repositories using the IPv6 protocol and may fail.

The guidelines provided by the How to configure an outbound proxy for a Bamboo Remote Agent KB article are specifically designed for the Bamboo application within the Java environment. This indicates that Git requires a separate proxy configuration to function properly. Bamboo will not transfer any Java proxy properties to the Git commands it executes.

Solution

Git runs on both Bamboo Server and Bamboo Agents. You may have to implement the solutions below on both locations to allow Git to work.

Option 1: Allow connectivity between the Bamboo Server and Agent(s) to the Git repository running over HTTP

Check your Network infrastructure and open the required network holes on your Firewall to allow the outbound traffic from the Bamboo Server and Bamboo Agent(s) to the Git repository HTTP port. Usually, the repository will be running over HTTPS on ports 443 and 7990. There may be cases where you will also have to allow port 80 if running HTTP only. Your mileage may vary; consult your Git URL to determine what ports to allow.

Option 2: Use an HTTP Proxy for outbound connections

You can use an HTTP Proxy and configure Git to use it to reach external endpoints. For that, you have two choices:

Use HTTP_PROXY environment variables

Declare the http_proxy, https_proxy, and optionally no_proxy environment variables. Those environment variables will need to be present before Bamboo is started, either via regular system variables – when starting Bamboo manually:

$ export http_proxy="http://proxy.mydomain.net:8080"
$ export https_proxy="http://proxy.mydomain.net:8080"
$ export no_proxy="127.0.0.1,localhost,10.20.49.*,10.20.51.*,169.254.169.*,*.mydomain.net"
$ cd /opt/atlassian/bamboo/bin
$ ./start-bamboo-sh

Or via a Service Environment declaration, such as when using a SystemD unit file:

[Service]
Type=forking
User=<bamboo-user>
Environment=CATALINA_PID=<bamboo-install>/bin/Catalina.pid
Environment="no_proxy=127.0.0.1,localhost,10.20.49.*,10.20.51.*,169.254.169.*,*.mydomain.net"
Environment="http_proxy=http://proxy.mydomain.net:8080"
Environment="https_proxy=http://proxy.mydomain.net:8080"
...

Configure Git to use specific a specific proxy host

This allows you better control of the Proxy settings specifically for Git commands. This way, you don't have to expose the whole system (or Bamboo user account) to the Proxy environment variables.

Add proxy settings to the Git configuration at a global or user level. For more details and examples, check the following link:




Last modified on Apr 28, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.