Gitlab merge request issue on git-clone step

Bitrise Build Issue Report template

Description of the issue

I configured a trigger to run a build on Gitlab merge requests.
The build gets triggered but the git-clone step gives an error :
ERROR: auto merge, error: there is no Pull Request branch and can’t download diff file

Environment:

Where did the issue happen?

Android & Docker, on Ubuntu 16.04

Which build Step causes the issue and which version of the step?

id: git-clone
version: 4.0.5

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : Every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : On the first merge request I submitted after the webhook was setup

Local reproduction

I don’t have a local environnement.

Build log

Hi @RBonaventure,

Thanks for reporting the issue here!

Can you please normalize the git clone URL on the Settings tab of the app?

It seems right now you have a URL like this, with ssh:// prefix and port number included:

ssh://git@X.com:23/Y/Z.git

can you please normalize this into the simplified format, without the prefix & without the port number:

git@X.com:Y/Z.git

For the actual value please check the Git Clone step’s log, the PRRepositoryCloneURL line. There you can see the normalized value which was provided by your GitLab server.

Simply set that on the Settings tab, and I think the Git Clone step then can detect that the PR is from the same repo.

The issue seems that the step right now thinks these are two separate private repos, where it has to fallback to alternative approaches to determine the diffs (which right now is only implemented for GitHub and Bitbucket). But in reality it’s the same repo, so this shouldn’t even be necessary.

I’ll also create a bug report for the step, to make it able to match these URLs and detect these are the same.

If you’d have any questions just let us know! :slight_smile:

Hi @RBonaventure,

We released a fix for the issue in version 4.0.9. From this version the repository url can be in the form of ssh://git@hostname:port/owner/repository.git

1 Like

Awesome, thanks !

1 Like

Hi @viktorbenei and @kdobmayer , I am currently having this issues with my builds. When I create a merge(pull) request on gitlab, the webhook triggers the build however the build fails at due to:

git "init"
Initialized empty Git repository in /Users/vagrant/git/.git/
git "remote" "add" "origin" "git@gitlab.com:X/Y.git"
git "fetch" "origin" "master"
Warning: Permanently added 'gitlab.com,xx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.
From gitlab.com:X/Y
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
ERROR: auto merge, error: there is no Pull Request branch and can't download diff file
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | git-clone@4.0.10 (exit code: 1)                               | 9.14 sec |
+---+---------------------------------------------------------------+----------+

I am making a merge request from a private repo to another private repo. I have used the generate SSH keypair to copy the ssh public key from bitrise to both private repos and I still get the above.

To note, when I create a merge request within the same repo, it works as expected.

Hi @ituaijagbone,

Your issue doesn’t seem to be related to the original issue reported here - please create a new one at http://discuss.bitrise.io/c/issues/build-issues and we’ll check it ASAP! :slight_smile: