Repository navigation
Conversation
|
FYI @bochen2014 in lerna 3.x a check has been added to prevent publishing when behind the git remote: https://github.com/lerna/lerna/blob/master/commands/publish/index.js#L101 This sounds like it solves your issue in CI? |
|
Yeah, I don't want to fundamentally change the order of operations in a maintenance branch. Probably gonna switch lerna 3.x to be |
|
If you check before npm publish, there is still a chance that thing goes wrong. What if new commits come in after your check, but during you npm publish. I know npm publish is parallel,but it can still take a while and that give window for errors. I still believe git push should happen before npm publish. Is there a reason why it’s not designed that way? |
|
When an |
|
You are talking about all npm publish fail. What if 3 passed but 2 failed. Once published, you can’t unpublish them, git is not public,so next build would fail. Also, what if new commits come in during npm publish? We have 45 packages in our project so I am a bit concerned |
|
The answer is to only run one build at a time for branches that push commits back to origin. I don't know how else to contain the insanity, even pushing before |
|
|
Sorry, actually one build a time won’t solve the issue. If new commits in during npm publish, both build will fail |
|
The first build will fail because it doesn’t have latest code(even it pass check before) The second build would also fail because can’t publish the same npm package version again It’s not an issue of how many build to run at a time, it’s an issue of when do your commit. I.e if the build server is publishing, you can’t commit as it has just passed latest check, and think it has got the latest code |
|
so, |
|
I'm not sure what is relevant about your |
|
thanks for your reply. so in all, |
|
think about this, what if there is a commit merged in ( just merge in, not build ), right after what will happen? |
|
this problem is critical to us as it has happened twice so far (in 2 weeks time), the result is chaotic as we can't unpublished npm packages - I had to force publish twice, but the version info won't be liner. if this issue won't be fixed in lerna@3, i'm afraid that we will have to host our own version of lerna. |
|
We always have control over what commits are generated in CI. You can always do By the way, semantic-release seems to run its npm plugin before its github plugin during the publish phase, so it's not clear to me that your assertion is correct? |
|
"We always have control over what commits are generated in CI." I don't think we are talking about the same thing. lerna/commands/publish/index.js Line 101 in 2838260 another developer push some changes into master. what will happen?
I don't think this issue is related to lerna's commit message |
|
Lerna publish in CI _without_ `--canary` really blows right now, to be blunt. I’m saying spare yourself some pain and don’t use it right now, it’s clearly causing you way more pain than it is worth.
… On Apr 24, 2018, at 07:52, Bo Chen ***@***.***> wrote:
"We always have control over what commits are generated in CI."
I don't think we are talking about the same thing.
I'm talking about in a team develop environment, where multiple developers can check in or merge into master at anytime. If right after lerna runs this line
https://github.com/lerna/lerna/blob/2838260b7d0058249b2f0aee61e41d7de6bbe228/commands/publish/index.js#L101
another developer push some changes into master. what will happen?
I don't think this issue is related to lerna's commit message
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
Thanks for your advice, really appreciate it. Are you talking about lerna 2.x or 3.x? |
|
She’ll I create a PR in 3.x swapping npm publish and git push? I think I have explained enough, and it’s worth putting git push before npm publish |
|
I’ve started a branch off master separating `lerna version` from `lerna publish`, which effectively runs `git push` before `npm publish`. It’s kind of a giant task, however, and I won’t likely be done until next week (at the earliest).
In the meantime, I can cut a 2.x prerelease under a special dist-tag that reverses it for you, if you like. I can’t make it a normal 2.x release due to semver, but at least it would stop the bleeding.
… On Apr 24, 2018, at 18:07, Bo Chen ***@***.***> wrote:
She’ll I create a PR in 3.x swapping npm publish and git push?
I think I have explained enough, and it’s worth putting git push before non publish
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
thanks you so much, really appreciate your help! I have already bumped lerna to 3.x in our code base, as we recently noticed So, thanks for your offer but since we don't use lerna 2.x anymore, there is no need to create a new dist-tag. |
|
Thanks again for your patience @bochen2014, but I don't think we're going to land this on 2.x, it's a breaking change that I can't afford to make on what is in reality a maintenance branch. Let me know if lerna 3 needs changes to make this happen (I'm still working on the split of publish into version and publish phases...). Can you open a new issue about the incorrect exit code after a push failure, please? We should really figure that out, it's not ideal. |
|
thanks for your reply
|
|
Yes, we agreed that In the near future, calling |
|
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. |
this PR is to address 'double publish' issue. i.e. while one developer commits a change and is running
lerna publish, another developer commits a new change and starts runninglerna publishas well.At the moment both
lerna publishwill fail but packages will be published, rendering the project into a chaotic state. An realistic example is illustrated in #1385To solve this issue, ideally, we should wrap
npm publishandgit push with tagsinto an transaction and make it atomic. By puttinggit pushahead ofnpm publish, in the case wherelerna publishis not running based on latest code,git pushwill fail andnpm publishwon't be run, and therefore atomicity is better reflected.I believe this will have a huge benefit in production use of lerna