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

2.0.0-beta.22 breaks cross-repo deploy to GitHub Pages #7744

Closed
5 of 7 tasks
yechs opened this issue Jul 8, 2022 · 18 comments · Fixed by #7750
Closed
5 of 7 tasks

2.0.0-beta.22 breaks cross-repo deploy to GitHub Pages #7744

yechs opened this issue Jul 8, 2022 · 18 comments · Fixed by #7750
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@yechs
Copy link

yechs commented Jul 8, 2022

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

Updating to docusaurus v2.0.0-beta.22 breaks my deployment to GitHub Pages.

The relevant commandline error follows:

[INFO] `git commit -m "Deploy website - based on 6f67bb9205e05e2d37ba6368e30774c48e6db78d"` code: 0
To github.com:yechs/website.git
 ! [remote rejected] master -> master (shallow update not allowed)
error: failed to push some refs to 'github.com:yechs/website.git'
[INFO] `git push --force origin master` code: 1
[ERROR] Deployment of the build output failed.
[ERROR] Error: Running "git push" command failed. Does the GitHub user account you are using have push access to the repository?
    at runDeploy (/Users/yeshu/Coding/Personal/website/node_modules/@docusaurus/core/lib/commands/deploy.js:168:19)
    at async Command.deploy (/Users/yeshu/Coding/Personal/website/node_modules/@docusaurus/core/lib/commands/deploy.js:189:13)
error Command failed with exit code 1.

According to the command line output, it looks like a shallow update problem. However, the weird thing is, docusaurus has been doing shallow clone deployments for almost a year now and has never failed before.
Relevant PR: #5748

Logs

If you want a full log, there is one available from GitHub Actions (https://github.com/yechs/website/runs/7256462347)

And here is the successful log running yarn deploy on v2.0.0-beta.21 three days ago (https://github.com/yechs/website/runs/7204294330)

Reproduction

Just to rule out the variables of GitHub Actions or GitHub changing their behavior:

I've ran yarn deploy locally on v2.0.0-beta.22 and it failed with the same message.
I have also manually reverted back to v2.0.0-beta.21 and ran yarn deploy, which functioned perfectly normal. (Note that it is doing the same shallow clone)

Reproducible demo

https://github.com/yechs/website/

Steps to reproduce

  1. Run yarn deploy
  2. Observe that it fails
  3. git checkout 193d6e0 to go back to docusaurus v2.0.0-beta.21
  4. Run yarn to install dependencies
  5. Run yarn deploy
  6. Observe that it succeeds

Expected behavior

Deployment continues to function as in v2.0.0-beta.21

Actual behavior

Deployment fails. See log from GitHub Actions.

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used:
    • v2.0.0-beta.22
  • Environment name and version (e.g. Chrome 89, Node.js 16.4):
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS):
    • Ubuntu (GitHub Actions) with Node v16
    • MacOS with Node v16.15.1
    • Arch Linux with Node v16.14.2

Self-service

  • I'd be willing to fix this bug myself.
@yechs yechs added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Jul 8, 2022
@Josh-Cena Josh-Cena added status: needs more information There is not enough information to take action on the issue. and removed status: needs triage This issue has not been triaged by maintainers labels Jul 9, 2022
@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Jul 9, 2022

Looks like a bug with #7702? Could you try running 0.0.0-5163?

@Josh-Cena Josh-Cena removed the status: needs more information There is not enough information to take action on the issue. label Jul 9, 2022
@yechs
Copy link
Author

yechs commented Jul 9, 2022

Yes deploying with 0.0.0-5163 is fine. Could be related to this issue

@yechs
Copy link
Author

yechs commented Jul 9, 2022

I have taken a look at the PR content. It may be possible that by copying over local .git/config, the remote origin url is also copied over.

However, I'm deploying to a different repo other than the source repo, which has a different "origin" url. This causes a problem. When coping over the git config file, the destination origin is also overwritten. Hence, git will push to a different repository and naturally fail.

@Josh-Cena
Copy link
Collaborator

cc @ghostsquad Any ideas?

@yechs
Copy link
Author

yechs commented Jul 9, 2022

In my humble opinion, it would be counter-intuitive to copy git configs during deployment.

It should be up to the CI to set up the desired git configuration environment, either via environment variables or, in the case of more advanced configs such as gpg signing key, via global configuration

@yechs yechs changed the title 2.0.0-beta.22 breaks deploy to GitHub Pages (shallow update not allowed) 2.0.0-beta.22 breaks cross-repo deploy to GitHub Pages Jul 9, 2022
@ghostsquad
Copy link
Contributor

The problem is that I don't want to just deploy via CI. A local deployment should be valid as well. Let me look at the error...

@Josh-Cena
Copy link
Collaborator

A local deployment should be valid as well.

You can always change your deploy script in package.json.

@ghostsquad
Copy link
Contributor

I can submit a pull request to add a git configuration map to the main config file that is used for this operation. It would allow arbitrary configuration to be applied after the clone operation.

@ghostsquad
Copy link
Contributor

A local deployment should be valid as well.

You can always change your deploy script in package.json.

literally the only thing I need to change is some simple stuff like my email, gpg key, etc. It shouldn't be necessary to reproduce the entirety of what's already being done just to inject some git config.

@yechs
Copy link
Author

yechs commented Jul 9, 2022

literally the only thing I need to change is some simple stuff like my email, gpg key, etc. It shouldn't be necessary to reproduce the entirety of what's already being done just to inject some git config.

Here is an email thread from the Git developers that may be interesting for you to read. (https://lore.kernel.org/git/xmqqwnm12xv7.fsf@gitster.g/T/)

It would be a lot simpler to just use environment variables.
There exists built-in variables for setting user.email and user.name. Then, ALL config fields can be set via the GIT_CONFIG_KEY_<n> and GIT_CONFIG_VALUE_<n> env vars (read manual)
So, for the signingkey, you can set GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=user.signingkey GIT_CONFIG_VALUE_0=<your keyID>

Alternatively, you can also use the conditional includes feature of git config.

Both methods seem to be more intuitive (i.e. less hacks) solutions to your problem.
In the worst case, you can always use patch-packages to patch the deployment commands for your own.

ghostsquad added a commit to ghostsquad/docusaurus that referenced this issue Jul 9, 2022
This reverts commit ee376d1.

All git config fields can be set via the GIT_CONFIG_KEY_<n> and GIT_CONFIG_VALUE_<n> env vars.

Ref: https://git-scm.com/docs/git-config#Documentation/git-config.txt-GITCONFIGCOUNT

Alternatively, you can also use the conditional includes feature of git config.

Ref: https://git-scm.com/docs/git-config#_conditional_includes

resolves facebook#7744
@ghostsquad
Copy link
Contributor

@yechs I think you are right. I'll file a revert for this.

ghostsquad added a commit to ghostsquad/docusaurus that referenced this issue Jul 9, 2022
This reverts commit ee376d1.

All git config fields can be set via the GIT_CONFIG_KEY_<n> and GIT_CONFIG_VALUE_<n> env vars.

Ref: https://git-scm.com/docs/git-config#Documentation/git-config.txt-GITCONFIGCOUNT

Alternatively, you can also use the conditional includes feature of git config.

Ref: https://git-scm.com/docs/git-config#_conditional_includes

fixes facebook#7744
@silverqx
Copy link

I have upgraded to the beta22 now and I can't deploy too, exactly the same problem.

@yechs
Copy link
Author

yechs commented Jul 10, 2022

I have upgraded to the beta22 now and I can't deploy too, exactly the same problem.

I guess you'll have to wait until #7750 gets merged and hopefully they'll release a hotfix soon enough

@slorber
Copy link
Collaborator

slorber commented Jul 12, 2022

Until next bugfix release, you should be able to use the latest canary version

@silverqx
Copy link

I will wait for the beta.23 release.

@silverqx
Copy link

Fixed in rc1, deploying works well again thx

@veris-amoghbanta
Copy link

Still getting this error in 2.0.1.

[ERROR] Deployment of the build output failed.
[ERROR] Error: Running "git push" command failed. Does the GitHub user account you are using have push access to the repository?
    at runDeploy (.../node_modules/@docusaurus/core/lib/commands/deploy.js:158:19)
    at async Command.deploy (.../node_modules/@docusaurus/core/lib/commands/deploy.js:179:13)

joshklop added a commit to NethermindEth/juno that referenced this issue Aug 5, 2022
Version 2.0.1 breaks the github actions deploy. Based on the issue
below, docusaurus was working on 2.0.0-rc1. This commit downgrades
docusuarus to the latter version.

See: facebook/docusaurus#7744
joshklop added a commit to NethermindEth/juno that referenced this issue Aug 5, 2022
Version 2.0.1 breaks the github actions deploy. Based on the issue
below, docusaurus was working on 2.0.0-rc.1. This commit downgrades
docusuarus to the latter version.

See: facebook/docusaurus#7744
joshklop added a commit to NethermindEth/juno that referenced this issue Aug 5, 2022
Version 2.0.1 breaks the github actions deploy. Based on the issue
below, docusaurus was working on 2.0.0-rc.1. This commit downgrades
docusuarus to the latter version.

See: facebook/docusaurus#7744
@silverqx
Copy link

silverqx commented Aug 5, 2022

I have deployed two times using v2.0.1 and don't have any problems.

IronGauntlets pushed a commit to NethermindEth/juno that referenced this issue Aug 18, 2022
Version 2.0.1 breaks the github actions deploy. Based on the issue
below, docusaurus was working on 2.0.0-rc.1. This commit downgrades
docusuarus to the latter version.

See: facebook/docusaurus#7744
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants