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

GitLab CI build fails with No ancestor could be found between any of HEAD and master, origin/master, upstream/master, main, origin/main, upstream/main #200

Open
BryanHuntNV opened this issue Oct 21, 2023 · 4 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@BryanHuntNV
Copy link

When running under GitLab CI, the plugin executes yarn version and I get the error:

No ancestor could be found between any of HEAD and master, origin/master, upstream/master, main, origin/main, upstream/main

I can run yarn version in the project just fine locally, but if I add that command to the GitLab CI job (and not use the plugin), I can reproduce the error. I suspect the problem is related to GitLab CI checking out the project in a detached head state.

I haven't been able to find a solution, so I may just write my own plugin that uses jq to update the package version.

@BryanHuntNV
Copy link
Author

It occurred to me today that a better solution might be to just parse the JSON, update the version and write it back out.

@hongaar
Copy link
Owner

hongaar commented Oct 24, 2023

It's not very clear from the yarn docs, but one of the advantages of using yarn version is that it updates workspace: references in monorepos. See https://yarnpkg.com/cli/version/apply for more information.

Depending on your use-case, manually updating the version in package.json through a plugin may work, I'm not sure how though...

If we can solve this for everyone on GitLab it would be good. Not running GitLab atm but if you have more details I can help investigate.

@hongaar
Copy link
Owner

hongaar commented Jan 17, 2024

Can you try setting the GIT_STRATEGY to clone:

variables:
  GIT_STRATEGY: clone

See also https://docs.gitlab.com/ee/ci/runners/configure_runners.html#git-strategy

@BryanHuntNV
Copy link
Author

I added

variables:
  GIT_STRATEGY: clone

to my .gitlab-ci.yml and I get the same error.

@hongaar hongaar reopened this Jan 26, 2024
@hongaar hongaar added good first issue Good for newcomers help wanted Extra attention is needed labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants