Troubleshooting Smart Commit

Still need help?

The Atlassian Community is here for you.

Ask the community


Debug logging

Want some debug logs?

You can do so by simply enabling DEBUG level logging for the com.atlassian.jira.plugin.devstatus.smartcommits package on the JIRA end.

Common Errors

Invalid email address

If a Smart Commit is made where no JIRA user matches the email address in the commit message, the following message is returned in JIRA:

2016-03-15 00:17:45,257 JIRA-EventThread-45 WARN anonymous 17x1034x1 1bs7h8z 192.168.10.2 /rest/remote-event-consumer/latest/events/JiraCommitEvent [c.a.j.p.d.smartcommits.notifications.SmartCommitsNotificationServiceImpl] a smart commit failed due to there being no matching jira user for the commiter email address, but no email notifications has been sent.

Found more than one user by email

When Bitbucket Server detects a Smart Commit, we take the author email from the commit message and find the first matching user in the list of users. We then send the email address and user of the user we found along with the commit message (using remote events) to JIRA. JIRA will then search for a user that matches this email address. If an email address and name match is found, we'll use that. If not, we'll see a message like the following:

2016-03-14 21:57:29,778 JIRA-EventThread-15 WARN anonymous 1317x538x1 afs7ra 192.168.10.2 /rest/remote-event-consumer/latest/events/JiraCommitEvent [c.a.j.p.devstatus.smartcommits.CommitEmailUserMappingService] Found more than one user by email jethomas@atlassian.com but no one is 'admin'.

In my instance, Bitbucket Server was sending the "admin" and "jethomas@atlassian.com" username and email combo, but that did not match any users in JIRA.

Jira issue key is not recognized

Bitbucket Server assumes that Jira Software issue keys are of the default format, which is two or more uppercase letters ([A-Z][A-Z]+), followed by a hyphen and the issue number (e.g. "TEST-123")

If custom Jira issue keys are used, these have to be configured in Bitbucket Server. Please refer to: Integrating with custom JIRA issue key in Bitbucket Server.

Other errors

These errors will all be logged at the debug level for the com.atlassian.jira.plugin.devstatus.smartcommits package.

Error 1:

An email address wasn't provided with the commit.
Changeset doesn't contain a commit ID. Unable to process commands.
We couldn't find a JIRA user to match the {0} email address.
There is more than one JIRA user with the {0} email address.
A command wasn't provided with the smart commit.
The {0} issue doesn't seem to exist.

2016-03-15 00:41:01,443 JIRA-EventThread-60 DEBUG jeff 41x1271x1 w89svp 192.168.10.2 /rest/remote-event-consumer/latest/events/JiraCommitEvent [c.a.j.p.devstatus.smartcommits.DefaultSmartCommitsService] Smart Commit processing resulted in errors: [Error[devstatus.smartcommits.commands.unknownissue:The VAG-1234 issue doesnt seem to exist.]]

Error 2: 


'{0}' isn't a command that can be used with a smart commit.
The commit is older than the maximum allowed age of {0} day(s) and so will be ignored.

By default, commits that are older than 21 days will not be processed for smart commits. This is configurable with the jira.development.status.smart.commits.max.age system property.


Error 3:

When executing a smart commit in Bitbucket, within the Bitbucket debug logs - no JIRA instance is showing up in the "consumable by" section of the published event.

Example log entry:

atlassian-bitbucket.log:2019-04-17 10:04:15,937 DEBUG [commit-indexing:thread-1]  c.a.s.i.j.i.e.RemoteEventPublisher Publishing remote event: com.atlassian.devstatus.vcs.JiraCommitEvent@5397b9c0[author=com.atlassian.devstatus.Person@688f8303,authorDate=Wed Apr 17 10:03:58 CDT 2019,commitDate=<null>,commitMessage=REDACTED-123 #comment TEST #time 1h,committer=<null>,mergeCommit=false,type=CREATE,initiator=com.atlassian.devstatus.EventInitiator@72039b99[emails=[test@test.test],username=REDACTED,displayName=REDACTED REDACTED,resource=http://redacted.redacted.redacted/users/redacted,avatar=http://www.gravatar.com/avatar/redacted.jpg?s=128&d=mm],issueKeys=[REDACTED-123],entity=com.atlassian.devstatus.EventEntity@d0fdc44[id=65c030748ffbf1f01d06e27aa1a12edb9363be60,displayId=65c030748ff,resource=http://redacted.redacted.redacted/projects/redacted/repos/redacted/commits/65c030748ffbf1f01d06e27aa1a12edb9363be60],sourceId=<null>,sourceUrl=<null>]
atlassian-bitbucket.log:2019-04-17 10:04:15,938 DEBUG [commit-indexing:thread-1]  c.a.s.i.j.i.e.RemoteEventPublisher Publishing remote event: com.atlassian.devstatus.IssueChangedEvent@63be412f[issueKeys=[REDACTED-123],sourceId=<null>,sourceUrl=<null>]
atlassian-bitbucket.log-2019-04-17 10:04:15,938 DEBUG [commit-indexing:thread-1]  c.a.s.i.i.DefaultCommitIndexingService [redacted/redacted[13]] Indexed 1 commits
atlassian-bitbucket.log-2019-04-17 10:04:15,938 DEBUG [AtlassianEvent::thread-9]  c.a.e.r.impl.RemoteEventListener Queueing RemoteEvent com.atlassian.devstatus.IssueChangedEvent@63be412f[issueKeys=[REDACTED-123],sourceId=<null>,sourceUrl=<null>]
atlassian-bitbucket.log-2019-04-17 10:04:15,938 DEBUG [AtlassianEvent::thread-9]  c.a.e.r.impl.RemoteEventDispatcher RemoteEvent com.atlassian.devstatus.IssueChangedEvent@63be412f[issueKeys=[REDACTED-123],sourceId=<null>,sourceUrl=<null>] consumable by []
Cause:

The cause of this issue is that the JIRA instance is being hosted by IIS, which is setting the Cache-control http header to "private". This interferes with the smart commit functionality. This issue is tracked in the bug BSERV-11779 - Getting issue details... STATUS . This can be tested by executing a verbose cURL command against the JIRA REST API endpoint /rest/remote-event-consumer/1/capabilities. For example, when running the following command from the BB Server:

curl -v <JIRA_BASE_URL>/rest/remote-event-consumer/1/capabilities
  • the expected Cache-Control header should look like this:

    Cache-Control: no-transform, max-age=600, stale-if-error=86400, stale-while-revalidate=86400
  • however, when using a proxy Server in front of Jira, this header might be overwritten:

    • as follows (when using IIS):

      Cache-Control: private
    • or as follows (when using other proxy servers):

      Cache-Control: no-cache
Resolution:

To resolve the issue - for the application pool associated with the site in IIS being used for Jira, change the '.NET CLR Version' attribute of the app pool to be "No Managed Code"


Error 4:

When executing a smart commit in Bitbucket, the smart commit doesn't show up in Jira instance - for example, comments, time, transitions etc., do not appear in Jira ticket

Diagnosis:

In the logs, JiraCommitEvent is not getting generated for that repository

Example log entry from atlassian-bitbucket.log for a repository where smart commits are working as expected

XXXX-XX-XX 12:05:51,105 DEBUG [AtlassianEvent::thread-1]  c.a.e.r.impl.RemoteEventDispatcher RemoteEvent com.atlassian.devstatus.vcs.JiraCommitEvent@64b30484[author=com.atlassian.devstatus.Person@3067c641,authorDate=XXXXXXXX ,commitDate=<null>,commitMessage=BLUE-1 #comment test comment,committer=<null>,mergeCommit=false,type=CREATE,initiator=com.atlassian.devstatus.EventInitiator@60c325a3[emails=[<emailaddress>],username=<username>,displayName=<displayname>,resource=http://localhost:XXXX/XXXX/users/<username>,avatar=http://www.gravatar.com/avatar/a92b6758XXXXXXXX85cde1fb7d.jpg?s=128&d=mm],issueKeys=[BLUE-1],entity=com.atlassian.devstatus.EventEntity@7484436d[id=05ab057ba91d6985XXXXXXXXXXX0d55be064c9d17,displayId=05abXXXXba91,resource=http://localhost:XXXX/XXXX/projects/MYP/repos/repo1/commits/05ab057ba91d6985XXXXXXXXXXX0d55be064c9d17],sourceId=<null>,sourceUrl=<null>] consumable by [RemoteApplicationWithCapabilities{applicationLinkId='092eb3b5-XXXX-XXXX-a3da-2f7c5103150e', selfUrl='http://localhost:XXXX/XXXX/rest/capabilities', id='null', name='null', type='jira', buildDate='<build date timestamp>', capabilities={update-devtool-summary-request=http://localhost:XXXX/XXXX/rest/dev-status/1.0/webhooks/update-summary, list-project-issuetypes=http://localhost:XXXX/XXXX/rest/api/2/issue/createmeta/{projectIdOrKey}/issuetypes?startAt=0&maxResults=50, atlassian-remote-event-diagnostics-v1=http://localhost:48201/j8201/rest/remote-event/1/status, list-issuetype-fields=http://localhost:48201/j8201/rest/api/2/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}?startAt=0&maxResults=50, aggregate-root-link=http://localhost:XXXX/XXXX/rest/capabilities/aggregate-root-link, confluence-jira-metadata-aggregate-cache-invalidation=http://localhost:XXXX/XXXX/, remote-link-aggregation=http://localhost:XXXX/XXXX/rest/remote-link-aggregation/1/capabilities, remote-sprint-link-events=http://localhost:XXXX/XXXX/, gh-epic-properties=http://localhost:XXXX/XXXX/rest/greenhopper/1.0/api/epicproperties, atlassian-remote-event-status=http://localhost:XXXX/XXXX/rest/remote-event/1/status, navigation=http://localhost:XXXX/XXXX/rest/capabilities/navigation, aggregate-root=http://localhost:XXXX/XXXX/rest/capabilities/aggregate-root, gh-remote-sprint-link=http://localhost:XXXX/XXXX/rest/greenhopper/1.0/api/sprints, content-links=http://localhost:XXXX/XXXX/rest/content-links/1.0/local/, atlassian-remote-event-consumer=http://localhost:XXXX/XXXX/rest/remote-event-consumer/1/capabilities, smart-commit-consumer=http://localhost:XXXX/XXXX/rest/smart-commits/1.0/config}}]

This log entry was missing for the repository where smart commits don't work

Cause:

The smart commits weren't being sent through is due to JiraCommitEvent not being triggered for the repository. 

Resolution:

Verify if the repository is a forked repository. JiraCommitEvent won't be triggered if the repository is a fork starting Bitbucket 4.8 as part of BSERV-8748 Performance problem in JIRA Dev Summary commit view with many forks. So, this behaviour is expected. 

Last modified on Aug 29, 2022

Was this helpful?

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