Is it possible that Bitrise don't pull a file I have pushed to upstream (PR)?

My questions needs more explanation.
I am working on an Android application and I want to integrate Jacoco to get code coverage report.
So, I created a jacoco.gradle file in root of my project.

I created a PR and Bitrise caught it and started my work flow.
I have an step in my workflow that run this command testGrabtaxiDebugUnitTestCoverage.
This step fails with this error message:
Task 'testGrabtaxiDebugUnitTestCoverage' not found in root project 'src'.

As this is strange to me (because I have no problem when I run the command on my laptop), I added an script before this step in order to tell me what files and folders are under root. This is my script:

#!/bin/bash
# fail if any commands fails
set -e
# debug log
set -x

# write your script here
echo "Current dir: " $PWD
git branch
ls -al

It prints out all files and folders I have in root except jacoco.gradle file. This is very weird to me. Is there any reason I don’t get the file? Any idea would be appreciated. Thanks.

Did you try to do a clean git clone of the repository, into a new / temporary directory, and check whether the file is there? These kind of issues are usually related to gitignore, that the file is not included in the repository, or not on that branch.

Thanks Viktor for your answer.

I tried to run my workflow via Bitrise CLI. It worked fine without issue.
So, I closed my PR and created a new PR. I didn’t face the issue and I could see my jacoco.gradle file is there this time and build passed.

1 Like

It might have been a GitHub issue then (I suspect you use GitHub). In case of a pull request build, the Git Clone step does not clone your pull request source branch, but instead it clones the “pre merge” branch (if available). The point of pull request builds is to test the state of the code which will be after the pull request is merged.

In case of GitHub, this “pre merge” branch is supplied by GitHub directly, so the Git Clone step pretty much just does a normal git clone, but instead of using the pull request’s source or target branch, it uses the special GitHub refs/pull/ branch (Checking out pull requests locally - GitHub Docs), generated by GitHub, which is a hidden/temporary branch with a pre-merged state of the code.

In case of other providers (e.g. Bitbucket or GitLab) this pre-merge might have to happen in a different way (doing actual git merge of the branches during the Git Clone step) if the service does not provide this special “pre-merge” branch.

If you’d have any questions, or if you’d have the issue again, just let us know!

2 Likes

An extra info: Just had experienced this for multiple times in the last couple of days, my PR repo did not updated like OP’s, however it only happens when there is merge conflict in the PR.

Hope this helps.

1 Like