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

Build fails with checkout v2 #113

Closed
gitfool opened this issue Dec 14, 2019 · 17 comments
Closed

Build fails with checkout v2 #113

gitfool opened this issue Dec 14, 2019 · 17 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@gitfool
Copy link

gitfool commented Dec 14, 2019

See gitfool/Cake.Dungeon workflow builds for commit 7963aee:

Failing in with an obscure error:

Error: One or more errors occurred. (Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''.)
	Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''.
##[error]Process completed with exit code 1.

If I revert to checkout v1 it builds successfully again.

@ericsciple
Copy link
Contributor

Need more info.

Is something different between the layout when using v2 vs v1, that is causing your build step to fail?

Otherwise does your build require additional git history? V2 was optimized for the mainline and only fetches a single commit rather than all history.

Note, the error sounds related to reading an xml file.

@gitfool
Copy link
Author

gitfool commented Dec 16, 2019

@ericsciple sorry about that; more info revealed after enabling Cake diagnostic verbosity. I'm using GitVersion and it clearly doesn't like "shallow" checkout v2:

ERROR [12/16/19 2:20:28:11] An unexpected error occurred:
2019-12-16T02:20:28.1401577Z GitVersion.Exceptions.GitVersionException:
Can't find commit d8aabf404b69d615cba1c9f13e2ee975e6560c6d.
Please ensure that the repository is an unshallow clone with `git fetch --unshallow`.

Full error in log here. I'm not sure if GitVersion can do anything about this, so is there something that could be made configurable to help in checkout v2?

@ericsciple
Copy link
Contributor

@gitfool oh gotcha. V2 was optimized to fetch a single commit. If you need more history for the branch being fetched, then increase the fetch-depth (defaults to 1, set to 0 for all history)

Otherwise if you need all history, i think run: git fetch --unshallow will fetch all branches and tags (all commits)

I'll update the docs to include an example to fetch all history for all branches and tags.

@ericsciple ericsciple self-assigned this Dec 16, 2019
@ericsciple ericsciple added the documentation Improvements or additions to documentation label Dec 16, 2019
@ericsciple
Copy link
Contributor

Updated the docs: #115

@gitfool
Copy link
Author

gitfool commented Dec 28, 2019

@ericsciple note that git fetch --unshallow is not sufficient for GitVersion as tags are not fetched unless --tags is also specified, so the documentation is misleading.

As I just mentioned here, it would be much nicer to have a fetch-tags option in checkout v2. That way it uses the recommended defaults but can be tweaked to get v1 behaviour without losing other v2 benefits and without needing a separate run command.

@AArnott
Copy link

AArnott commented Jan 14, 2020

@ericsciple Can you please add a parameter to actions/checkout@v2 that instructs the original clone to fetch the full history of HEAD at least? Having a separate fetch step to get more commits seems overly burdensome for folks who wanted the @v1 behavior.

@ericsciple
Copy link
Contributor

@AArnott the fetch-depth parameter can be used

@AArnott
Copy link

AArnott commented Jan 15, 2020

Oh sheesh. I don't know how I missed that in the README. Thanks, @ericsciple.

@gitfool
Copy link
Author

gitfool commented Jan 18, 2020

@ericsciple the fetch-depth parameter is not sufficient in my case since it always specifies --no-tags. Could you please make this configurable too?

@ericsciple
Copy link
Contributor

i have some changes in mind, collecting some feedback from my immediate team and will publish a proposal soon

@gitfool
Copy link
Author

gitfool commented Feb 16, 2020

@ericsciple gentle nudge; have you made any progress on the above? 🙏

@ericsciple
Copy link
Contributor

@gitfool soliciting feedback on this PR. sorry for the delay, other things came up.

@gitfool
Copy link
Author

gitfool commented Feb 18, 2020

@ericsciple no worries. My use case is that I currently need to follow checkout with:

- name: Fetch unshallow
  run: git fetch --prune --tags --unshallow

in order to get full history as needed by GitVersion. Needless to say, I'd love to get rid of this extra step.

@bastimeyer
Copy link

Using v2 is very clunky right now when your build steps require the output of git describe --tags for example. I would appreciate an option that would let me fetch tags in addition to the fetch depth, without having to define a separate run step. Thank you.

@ericsciple
Copy link
Contributor

@bastimeyer i agree. You should +1 this proposal #155 :)

@GiorgioBertolotti
Copy link

@ericsciple no worries. My use case is that I currently need to follow checkout with:

  • name: Fetch unshallow
    run: git fetch --prune --tags --unshallow
    in order to get full history as needed by GitVersion. Needless to say, I'd love to get rid of this extra step.

That fixes my problem, thanks @gitfool

@gitfool
Copy link
Author

gitfool commented Nov 11, 2020

@GiorgioBertolotti that hack is no longer needed. See gitfool/Cake.Dungeon@9713d4f.

gitfool referenced this issue in cake-contrib/Cake.FileHelpers Feb 27, 2021
takato1314 pushed a commit to takato1314/automoqfixture_ext that referenced this issue Aug 23, 2021
Add `fetch-depth: 0` to the dotnet pipeline as indicated [here](actions/checkout#113 (comment)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants