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

Lerna Publish should first check if publishing is possible #1177

Closed
ibratoev opened this issue Jan 3, 2018 · 4 comments · Fixed by #1317
Closed

Lerna Publish should first check if publishing is possible #1177

ibratoev opened this issue Jan 3, 2018 · 4 comments · Fixed by #1317
Labels

Comments

@ibratoev
Copy link

ibratoev commented Jan 3, 2018

Currently, Lerna publish starts publishing to npm and git without checking for potential git problems like git remote branch being ahead.

This can lead to consistency issues.

In our scenario, we run a CI build on each push to master that calls: lerna publish --exact --cd-version minor --yes. If we merge 2 PRs quickly the CI build is stuck. What happens:

  • After we merge 2 PRs quickly -> publish is called for the first build -> npm packages are published successfully with the new version but the git push fails.
  • On the next build -> publish is called -> it uses the same version as the previous build because git push failed last time -> npm publishing fails because the same version already exists.

Expected Behavior

npm packages should not be published if git remote branch is ahead.

Current Behavior

npm packages are published even though git push is impossible.

Possible Solution

Check if git push is possible before npm publish. Consider a flag if the build should fail.

lerna.json

{
  "lerna": "2.5.1",
  "packages": [
    "packages/*"
  ],
  "version": "1.17.0",
  "npmClient": "yarn",
  "useWorkspaces": true
}

Your Environment

Executable Version
lerna --version 2.5.1
npm --version 3.10.10
yarn --version 1.3.2
node --version v6.11.5
@vzaidman
Copy link

vzaidman commented Jan 7, 2018

I'd also suggest to do npm whoami to see if the npm publishing stage is possible.

@evocateur
Copy link
Member

#1317 fixed the "upstream ahead of local clone" problem, we still don't have preflight npm checks (such as npm whoami, etc).

@evocateur evocateur reopened this Mar 13, 2018
evocateur added a commit that referenced this issue Mar 13, 2018
@stale
Copy link

stale bot commented Dec 27, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 27, 2018
@stale stale bot closed this as completed Jan 3, 2019
@lock
Copy link

lock bot commented Apr 3, 2019

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants