Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to run "git fetch" #622

Open
asbjornu opened this issue Jan 16, 2024 · 4 comments
Open

Failed to run "git fetch" #622

asbjornu opened this issue Jan 16, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@asbjornu
Copy link

asbjornu commented Jan 16, 2024

Bug description

As mentioned in #564 (comment), I'm experiencing the following problem when trying to build my Unity project with game-ci/unity-builder@v4:

Warning: Fetch --unshallow caught: Error: Failed to run "git fetch --unshallow".
 In-command error caught: Error: The process '/usr/bin/git' failed with exit code 128
Error: Failed to run "git fetch".
 In-command error caught: Error: The process '/usr/bin/git' failed with exit code 128

How to reproduce

I'm not sure how to reproduce this, but this is a WebGL build if that matters.

Expected behavior

game-ci/unity-builder shouldn't fail to run git fetch. I wonder why it is running git fetch at all. Can anyone please provide details as to why it is and possibly how to avoid it?

Additional information

The GitHub action configuration looks like the following:

      - uses: game-ci/unity-builder@v4
        env:
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
          UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
        with:
          allowDirtyBuild: true
          targetPlatform: WebGL
          versioning: Semantic
@asbjornu asbjornu added the bug Something isn't working label Jan 16, 2024
@asbjornu
Copy link
Author

Adding fetch-depth: 0 to actions/checkout seems to have fixed the problem. As that slows down the build, it would be nice to know why unity-builder is performing git fetch --unshallow and if anything can be done to disable that behavior.

@AndrewKahr
Copy link
Member

It's doing this to help it generate the version number in semantic mode. If you don't want to have it run the clone with depth 0 you should be able to set the versioning to custom and pass in your own version number and it should skip the shallow check.

@asbjornu
Copy link
Author

asbjornu commented Jan 19, 2024

I see. Perhaps it should be mentioned in the documentation that versioning: Semantic leads to a git fetch --unshallow? Some logging from within Versioning.isShallow() would also be useful.

static async isShallow() {
const output = await this.git(['rev-parse', '--is-shallow-repository']);
return output !== 'false\n';
}

It might perhaps be that git rev-parse --is-shallow-repository for some reason doesn't always produce the expected false\n output?

@asbjornu
Copy link
Author

asbjornu commented Jan 19, 2024

Oh, reading the code, I see that first a git fetch --unshallow is invoked. If it fails, it only leads to a warning. However, a regular git fetch is performed right after, and if that fails, it leads to an error.

static async fetch() {
try {
await this.git(['fetch', '--unshallow']);
} catch (error) {
core.warning(`Fetch --unshallow caught: ${error}`);
await this.git(['fetch']);
}
}

For some reason, the result from both fetch operations is The process '/usr/bin/git' failed with exit code 128, which isn't very helpful. It seems like the underlying error message is swallowed by the git() method passing shouldLog = false to System.run():

static async git(arguments_: string[], options = {}) {
return System.run('git', arguments_, { cwd: Input.projectPath, ...options }, false);
}

Whether logging should be performed here could possibly be a configurable option on the action, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants