Checkout: Build fails with checkout v2

Created on 14 Dec 2019  路  17Comments  路  Source: actions/checkout

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.

documentation

Most helpful comment

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

All 17 comments

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.

@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?

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

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

@AArnott the fetch-depth parameter can be used

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

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

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

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

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

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

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.

@bastimeyer i agree. You should +1 this proposal https://github.com/actions/checkout/pull/155 :)

@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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bk2204 picture bk2204  路  3Comments

grst picture grst  路  3Comments

KOLANICH picture KOLANICH  路  4Comments

aaronsteers picture aaronsteers  路  3Comments

bnb picture bnb  路  3Comments