Logs and Artifacts links Missing on Bitbucket server repository builds page

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Application links are created between Bitbucket and Jenkins however, on the Bitbucket Server Repository Builds page the links to the Logs and Artifacts are missing.

Note: For Bamboo integrations, Bamboo 7.1+ is required for log and artifact links. For Jenkins integrations, the Bitbucket Server integration plugin 2.0.0+ is required for log links. Learn more about Integrating Bitbucket Server with your CI server.

Environment

Bitbucket Server 7.4+

Diagnosis

For the Logs and artifacts link to get populated in the Bitbucket builds page, the Jenkins Application Base URL configured in the Bitbucket must match the Jenkins BASE URL configured on the Jenkins side.

If the Application-link BASE URL (aka RPC URL) is not the same as Jenkins Base URL, then the build status POST request cannot be verified by the Bitbucket, and subsequently, Rich build status data which contains all the info related to the builds(logs and the artifacts) are not populated on the Bitbucket Builds page. This check is to identify and ensure that the POST request is coming from a trusted URL Bitbucket knows of.

So if the Jenkins Application link is set up with the base URL as https://<URL1.com> but requests to POST the build status are coming from https://<URL2.com> (a different URL) then these requests cannot be verified as trusted by the Bitbucket application.

If the builds are not triggered when there is a change to the repository in the Bitbucket enable Adding an additional logger for troubleshooting the Atlassian Bitbucket Integration plugin on the Jenkins server, that should show more info on why the builds are not being triggered.

1 2 3 4 5 6 Jun 18, 2021 6:26:02 AM FINE com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookEndpoint Payload: com.atlassian.bitbucket.jenkins.internal.trigger.RefsChangedWebhookEvent@476338f7 Jun 18, 2021 6:26:02 AM FINE com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookConsumer Received refs changed event from repo: LIN/test Jun 18, 2021 6:26:02 AM INFO com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookConsumer lambda$hasMatchingRepository$6 Base URL of incoming repository selflink - [http://localhost:6763/b763/projects/LIN/repos/test/browse] and bitbucket server configured URL - [http://192.168.1.20:6763/b763] seems to be different

If you see any error as shown below then this may be due to an incorrectly configured Jenkins Application Link

  • Unable to load Jenkins public key for applicationId

1 2 3 4 5 2021-02-02 12:44:05,977 WARN [http-nio-127.0.0.1-7990-exec-2] JenkinsBitbucket @156ZNV6x764x1110856x0 jkibv7 10.10.10.10,10.10.10.10,10.10.10.10,127.0.0.1 "POST /rest/api/latest/projects/LIN/repos/test/commits/bd3414006a5fddb6410ec9d62d34eaf3646adeec/builds HTTP/1.1" c.a.b.i.b.j.JenkinsBuildServerProvider$JenkinsPublicKeyCacheLoader Unable to load Jenkins public key for applicationId: 3a2eb7d9-2fe1-4084-baef-83f337681bc8 java.io.IOException: No header found for https://jenkins.localhost.com at com.atlassian.bitbucket.internal.build.jenkins.JenkinsBuildServerProvider$JenkinsPublicKeyCacheLoader.lambda$load$0(JenkinsBuildServerProvider.java:165) at java.base/java.util.Optional.orElseThrow(Optional.java:408) ...
  • Failed to fetch public key from Jenkins please ensure your application link is configured correctly

1 2 3 4 5 6 7 8 9 2021-02-02 12:44:05,979 ERROR [http-nio-127.0.0.1-7990-exec-2] JenkinsBitbucket @156ZNV6x764x1110856x0 jkibv7 10.10.10.10,10.10.10.10,10.10.10.10,127.0.0.1 "POST /rest/api/latest/projects/LIN/repos/test/commits/bd3414006a5fddb6410ec9d62d34eaf3646adeec/builds HTTP/1.1" c.a.s.i.r.e.DefaultUnhandledExceptionMapperHelper Unhandled exception while processing REST request: "POST /rest/api/latest/projects/LIN/repos/test/commits/bd3414006a5fddb6410ec9d62d34eaf3646adeec/builds HTTP/1.1" com.atlassian.cache.CacheException: Failed to fetch public key from Jenkins please ensure your application link is configured correctly at com.atlassian.bitbucket.internal.build.jenkins.JenkinsBuildServerProvider$JenkinsPublicKeyCacheLoader.load(JenkinsBuildServerProvider.java:170) ... Caused by: java.io.IOException: No header found for https://jenkins.localhost.com at com.atlassian.bitbucket.internal.build.jenkins.JenkinsBuildServerProvider$JenkinsPublicKeyCacheLoader.lambda$load$0(JenkinsBuildServerProvider.java:165) at java.base/java.util.Optional.orElseThrow(Optional.java:408) at com.atlassian.bitbucket.internal.build.jenkins.JenkinsBuildServerProvider$JenkinsPublicKeyCacheLoader.load(JenkinsBuildServerProvider.java:165) ... 82 common frames omitted

Cause

The errors maybe be thrown due to multiple reasons and below are the most common reason why this issue would happen.

  • The Application Base URL of Bitbucket doesn't match the Bitbucket Instance URL Configured in Jenkins.

  • The Application Base URL of Jenkins configured in the Bitbucket server Application link doesn't match the Jenkins Base URL in Jenkins.

Each Jenkins instance maintains an RSA private/public key pair that's used to uniquely identify the Jenkins with this information "instance identity" (X-Instance-Identity) if this is restricted by Reverse Proxy used by Jenkins or 3rd party Jenkins plugin like Reverse Proxy Auth then the Bitbucket might complain that it's not able to fetch the X-Instance-Identity from Jenkins on the bitbucket application logs.

Bitbucket tries to fetch the X-Instance-Identity by loading the <jenkins_application_base_url/login>,  if it's unable to fetch that info then it fails with the error Unable to load Jenkins public key for applicationId which also causes the Log and artifacts not to show up in Bitbucket builds page.

Solution

  • Check if the Application Link is configured as mentioned on Bitbucket Server Integration

  • Check if the Bitbucket Base URL matches the base URL configured in Jenkins while creating the Bitbucket Server instances.

  • Check if the Jenkins Base URL matches the base URL configured in Bitbucket Application Link

  • Verify if the X-Instance-Identity is retrievable by running the below curl

1 curl -D - https://jenkins.localhost.com/login -o /dev/null

You should be able to see the X-Instance-Identity Header if not check the Proxy of Jenkins to see if that removing that header.

Updated on March 11, 2025

Still need help?

The Atlassian Community is here for you.