question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Canary published version does NOT have commit sha

See original GitHub issue

Canary publish doesn’t generate unique version number with commit sha.

Expected Behavior

According to the doc, lerna publish --canary --dist-tag=alpha should release alpha version with commit sha in it. Suppose current package verison is 0.1.4 and commit version is 3d6bee55, then the canary release version should be foo@0.1.5-alpha.3d6bee55. This is to ensure each canary build is unique.

Current Behavior

The console output is like below. Note there is a 124+ (which may vary for differnt commit) ahead of the commit sha.

Successfully published:
 - foo@0.1.5-alpha.124+3d6bee55
lerna success published 1 package

The canary publish actually published foo@0.1.5-alpha.124 instead of foo@0.1.5-alpha.124+3d6bee55. The commit sha is not included. The 124 number looks like commit count but I’m not sure. Anyway, this makes canary release version not unique.

Steps to Reproduce (for bugs)

It is reproduced in lerna v3.4.3 and v3.10.7 with below command.

lerna publish --canary --npm-tag=alpha

Context

Our CI/CD system have a automatic canary build for each development branch. Since multiple developers might work based off same trunk branch, it is highly possible that automatic canary build fail due to version conflict with other development branches. It is mandatory to have each canary build have a unqiue npm version.

Your Environment

Executable Version
lerna --version 3.4.3 & 3.10.7
npm --version 6.4.1
node --version 8.12.0
OS Version
MacOS 10.13.6

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
q9fcommented, Aug 18, 2021

Is there a way to reopen this issue? I am having this problem also. With the + it does not carry over when published, but it does with a . The answers above do not solve this issue.

for an example:

4.0.0-alpha+c03a92a needs to be 4.0.0-alpha.c03a92a

👍 it would be nice to be able to change + to . so npm does not strip that out.

7reactions
ivanortegaalbacommented, Mar 23, 2020

Hi @anicholls @constantin-v I just found the same issue releasing my canaries per PR build. I want to release all the packages per PR build and for that I use:

yarn run publish --force-publish --canary $PR_NUMBER --yes

This was working well in v2 because the hash was appended with a dot:

+ dex-plot-suggestion@1.0.12-alpha.41+0c814f194
- dex-plot-suggestion@1.0.12-alpha.41.0c814f194

The issue I’ve is when someone adds some changes on the PR the version released sent to the registry is:

dex-plot-suggestion@1.0.12-alpha.41

The first time this is run on the CI works well because this version doesn’t exist yet, but with the next commit on the PR the CI run again the same command and this fails because the package already exist on the registry.

I’ve solved that with:

yarn run publish --force-publish --canary --preid $(git rev-parse HEAD) --yes

But I don’t think is a good solution. Any idea how I can move forward?

Thank you in advance

Read more comments on GitHub >

github_iconTop Results From Across the Web

When does a change enter canary/dev? - Google Groups
Let's say I've made a change to Chrome (https://chromium.googlesource.com/chromium/src.git) and I'd like to know the first canary/dev release that contained ...
Read more >
Canary Deployments - GitLab Docs
A popular Continuous Deployment strategy, where a small portion of the fleet is updated to the new version of your application.
Read more >
Lerna and Turborepo with Gitlab CI/CD - Delightful Engineering
Any commits to branches named anything other than main (working branches) will publish canary versions of packages if they have related ...
Read more >
`release` - Intuit - GitHub Pages
Flag Type Description ‑‑base‑branch String Branch to treat as the base branch ‑‑prerelease Boolean Publish a prerelease on GitHub.
Read more >
lerna canary how to pump up version correctly - Stack Overflow
I'm trying to do lerna publish --canary. I'm seeing the "number" after "alpha" is not bumped up (look at the 2nd and 3rd...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found