Gitlab merge request failure on git-clone step (if PR is sent from a private fork)

Bitrise Build Issue Report template

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.

Environment:

Where did the issue happen?

If on Bitrise.io: which stack? If not on Bitrise.io: on what operating system? (Plus any other information you can share)

On Bitrise.io: Xcode 9.2.x, on macOS 10.12 (Sierra)

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

E.g.: Git Clone Repository v4.0.10

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 environment.

Build log

2 Likes

Hi @ituaijagbone,

Can you please enable the “manual merge” mode? It seems you disabled that in your primary workflow:

    - git-clone@4.0.10:
        inputs:
        - manual_merge: 'no'

Change it back to the default 'yes', that should help.

If it wouldn’t, or if you’d have any questions just let us know! :wink:

P.S.: on the web UI / in the Workflow Editor the Manual merge option of the Git Clone step can be found in the Clone Config input category / group. Select the Git Clone step then expand Clone Config category, the last option is Manual merge.

@viktorbenei I have set the Manual merge option to Yes. I still get the same error:

Thanks for the report & for all the infos @ituaijagbone! We’ll try to debug & fix this as quick as possible, in the meantime if possible please send your gitlab PRs from the same repo or from a public fork (this issue only happens if the PR is sent from a private fork on gitlab).

Thanks @viktorbenei. I will create PR from the same repo for the time being.

1 Like

I’ll just add to this issue. Every test workflow is failing because git-clone fails.
We’re running from a private gitlab, which bitrise has access and webhooks are in place.
There’s no fork here. Just 1 repo, and Pull Request from one branch to another.
Every Pull-Request to master we’re (trying to) run our test workflow and it fails.

the clone config is defaul: - git-clone: {}

error log:

git "init"
Initialized empty Git repository in /bitrise/src/.git/
git "remote" "add" "origin" "git@<our_gitlab_instance/our_repo>"
git "fetch" "origin" "master"
Warning: Permanently added '<url and IP>' (ECDSA) to the list of known hosts.
From <our_gitlab_instance/our_repo>
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
git "checkout" "master"
Already on 'master'
Branch master set up to track remote branch master from origin.
git "merge" "origin/master"
Already up-to-date.
commit hash: <some hash>
git "fetch" "origin" "hotfix/crash_3"
fatal: Couldn't find remote ref hotfix/crash_3
ERROR: manual merge, error: fetch failed, error: exit status 128

I hope it helps.

Hi @sb_ronaldopace,

Thanks for the infos but your issue seems to be unrelated. The original issue is specific for fork based PRs, where the PR source is in a private fork repo.
Can you please ping our support via the onsite chat, or create a new / separate issue here?

I am still facing the same issue. I am getting this response in the log
exit status 128
ERROR: checkout (expTest): Fetch failed, error: exit status 128
| |
±–±--------------------------------------------------------------±---------+
| x | git-clone@4.0.10 (exit code: 1) | 5.42 sec |

@ashiq please fill out a new #issues:build-issues report so that we can help you as quickly as possible! :slight_smile: