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

fix(version): pass --atomic to git push #2393

Merged
merged 1 commit into from Dec 27, 2019
Merged

Conversation

weareoutman
Copy link
Contributor

Fix #2392

Description

Pass --atomic to git push. See git's doc

Motivation and Context

As #2392 said.

How Has This Been Tested?

Tested manually.

% git push --follow-tags --atomic --no-verify origin master
error: atomic push failed for ref refs/heads/master. status: 2

fatal: the remote end hung up unexpectedly\nTo git.easyops.local:anyclouds/next-libs.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@git.easyops.local:anyclouds/next-libs.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@weareoutman
Copy link
Contributor Author

It's weird that CI is failed with:

Summary of all failing tests
FAIL commands/publish/__tests__/publish-canary.test.js (12.797s)
  ● publish --canary sequential › 3. source
    Command failed: git describe --always --long --dirty --first-parent --match package-1@*
    fatal: .git/index: index file open failed: Permission denied
      at makeError (node_modules/execa/index.js:174:9)
      at node_modules/execa/index.js:278:16
          at runMicrotasks (<anonymous>)
Test Suites: 1 failed, 37 passed, 38 total
Tests:       1 failed, 254 passed, 255 total
Snapshots:   54 passed, 54 total

Seems this PR has nothing to do with it.

@evocateur
Copy link
Member

Yeah, the Windows tests are flaky due to environmental issues. I kicked it again and it passed. /shrug

@evocateur evocateur merged commit ec0f92a into lerna:master Dec 27, 2019
@evocateur
Copy link
Member

Thanks!

@amirburbea
Copy link

We need an option to disable this as azure devops git apparently does not support atomic push

lerna info execute Skipping releases
lerna info git Pushing tags...
lerna ERR! Error: Command failed: git push --follow-tags --atomic --no-verify origin master
lerna ERR! fatal: the receiving end does not support --atomic push
lerna ERR!
lerna ERR!     at makeError (C:\Workspace\beacon\node_modules\execa\index.js:174:9)
lerna ERR!     at C:\Workspace\beacon\node_modules\execa\index.js:278:16
lerna ERR! lerna Command failed: git push --follow-tags --atomic --no-verify origin master
lerna ERR! lerna fatal: the receiving end does not support --atomic push
lerna ERR! lerna

@evocateur
Copy link
Member

@amirburbea That's fair. Probably should be resilient to this type of failure and re-attempt without the --atomic flag, since the local version of git won't always correspond to the remote's.

@evocateur
Copy link
Member

@amirburbea Fixed in v3.20.1

@amirburbea
Copy link

Wow! That's fast. Thanks.

@wickedest
Copy link

wickedest commented Dec 30, 2019

Are you sure that's fixed in v3.20.1? I am seeing that version fail: "error: unknown option `atomic'"

@paulocmoreno
Copy link
Contributor

@evocateur, I am sorry to mention you in a closed issue but today I updated to lerna 3.20.2 and the error below broken my build. I want to give you more context to reconsider the amirburbea's suggestion to add an option to disable the atomic flag.

lerna ERR! Error: Command failed: git push --follow-tags --no-verify --atomic origin master
lerna ERR! fatal: the receiving end does not support --atomic push
lerna ERR! fatal: the remote end hung up unexpectedly

This error occurred in a Windows 2019 Server using Azure Pipelines. At line 6f0e2bb#diff-4a3a3aa992c599b130c66225bed2e8f4R16 lerna searchs for "atomic" on stderr. This is the expected default behavior of git but it can be changed using the environment variable GIT_REDIRECT_STDERR. This is a valid option for git and it is used to workaround a new behavior of Windows Server 2019 where it handles messages on stderr as errors. More details about this in https://github.com/microsoft/azure-pipelines-image-generation/issues/740 and dahlbyk/posh-git#109. In practice, lerna is not more compatible with Azure Pipelines on Windows Server 2019 and the suggested option can restore this compatibility. For now, I have reverted to an older version of lerna. Thanks for your attention and for this great project.

@evocateur
Copy link
Member

@paulocmoreno Ok, I suppose we should check process.env.GIT_REDIRECT_STDERR before testing the output? A PR would be very appreciated.

@paulocmoreno
Copy link
Contributor

@evocateur I created #2467 for your consideration. Thanks for your attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use --atomic when running git push in lerna version
5 participants