MettleCI Workbench Commit fails when Bitbucket Jira issue commit checker is enabled

Problem

When the Bitbucket Commit checker for Jira issues feature is enabled for a Bitbucket repository, MettleCI Workbench is unable to commit the DataStage Job, even though one or more valid JIRA stories have been selected in the Commit dialog’s Work Item list.

An example Commit failure may read Update failed for [{commit reference}:pre-receive hook declined:REJECTED_OTHER_REASON]

E.g.

Diagnosis

Atlassian’s documentation states that the Commit Checker requires Bitbucket and Jira to be integrated using Atlassian’s Application Links feature (see screenshot below).

 

Bitbucket's “Commit checker for Jira issues” feature checks (via the Application Link) all Jira issue IDs that were referred to in commit payloads but will only approve references to those issues that the committing user specifically has access to. MettleCI Workbench doesn’t authenticate with Bitbucket via a user account. It does so using an SSH Key which is typically granted access to the DataStage-relevant Bitbucket Project or, occasionally, the Organization level. Therefore, Bitbucket’s Commit Checker can’t perform its validation and triggers the rejection of the attempted commit.

Solution

Adding the public key to a personal user account rather than utilising the access key on the repo essentially fixes the issue.

The answer is to create a service account of some sort and give it the public key of the MettleCI workbench.

Alternative Solution

It’s possible to add an exception where Commits which have certain text are ignored by the Commit Checker. By adding an exception for the text ‘#Comment’, it’s possible to avoid Workbench triggering the Commit Checker.

 

© 2015-2024 Data Migrators Pty Ltd.