-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Invalid canary versions for certain SHAs #1118
Comments
This is kinda-sorta a duplicate of #277. I can certainly appreciate the pain. Does JFrog support "properly" incrementing pre-release versions (basically, shunting the git sha into the "build metadata" slot)?
We can get those from some fancy |
While |
Yep, you're right! I brainfarted on the spec. |
I just published |
Thanks, that's good to know. |
@mleonh I think it depends which version of Artifactory you are running. We're stuck on v4.8.0 at the moment and see lots of:
Pre-release versions can have multiple identifiers, but the spec says that any numeric identifiers cannot start with a leading Build metadata on the other hand can contain multiple identifiers but does not have the numeric item restriction, so But... Build metadata is ignored when calculating version precedence so On my current project we're using build numbers for version precedence and git commits for metadata, so something like:
We have to put the Our publish step looks like this:
Maybe lerna could add an option for which character to use to separate the commit id from the version number? Then we could do something like:
and end up with:
|
This is causing us problems as well. Is it acceptable to modify: lerna/commands/publish/index.js Line 331 in 5863564
By adding a non-numeric character such as a |
@corsen2000 that may be a breaking change if there are other tools out there parsing the tag created by lerna and assuming the |
@achingbrain would it be alright to just skip the extra argument for setting the commit separator and instead, just always append the short commit hash as the first segment of the build metadata string?
Therefore, I believe the only safe place for the commit hash is appended after |
Therefore, how do we manage the If we move the hash after Should Lerna just expect you to set the canary version using the same Or would you expect Lerna to infer the version on its own so that you only need to set |
Personally I like the idea of setting the entire pre-release string using Though, perhaps, the CLI argument name is not intuitive. While canary is how we use these releases, we're really setting the pre-release string in a Semantic Version 2 string. |
PR is pending here - #1507 |
BREAKING CHANGE: * `--preid` now defaults to "alpha" during prereleases: The previous default for this option was undefined, which led to an awkward "1.0.1-0" result when passed to `semver.inc()`. The new default "alpha" yields a much more useful "1.0.1-alpha.0" result. Any previous prerelease ID will be preserved, just as it was before. * `--no-verify` is no longer passed to `git commit` by default, but controlled by the new `--commit-hooks` option: The previous behavior was too overzealous, and the new option operates exactly like the corresponding [npm version](https://docs.npmjs.com/cli/version#commit-hooks) option of the same name. As long as your pre-commit hooks are properly scoped to ignore changes in package.json files, this change should not affect you. If that is not the case, you may pass `--no-commit-hooks` to restore the previous behavior. Fixes #277 Fixes #936 Fixes #956 Fixes #961 Fixes #1056 Fixes #1118 Fixes #1385 Fixes #1483 Fixes #1494
BREAKING CHANGE: * `--preid` now defaults to "alpha" during prereleases: The previous default for this option was undefined, which led to an awkward "1.0.1-0" result when passed to `semver.inc()`. The new default "alpha" yields a much more useful "1.0.1-alpha.0" result. Any previous prerelease ID will be preserved, just as it was before. * `--no-verify` is no longer passed to `git commit` by default, but controlled by the new `--commit-hooks` option: The previous behavior was too overzealous, and the new option operates exactly like the corresponding [npm version](https://docs.npmjs.com/cli/version#commit-hooks) option of the same name. As long as your pre-commit hooks are properly scoped to ignore changes in package.json files, this change should not affect you. If that is not the case, you may pass `--no-commit-hooks` to restore the previous behavior. Fixes lerna#277 Fixes lerna#936 Fixes lerna#956 Fixes lerna#961 Fixes lerna#1056 Fixes lerna#1118 Fixes lerna#1385 Fixes lerna#1483 Fixes lerna#1494
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. |
Expected Behavior
--canary
should always generate valid version strings (in accordance with the generally accepted semver rules).Current Behavior
--canary
generates invalid versions if the current SHA's first eight characters are numeric and the first digit is zero. For example,1.1.0-alpha.21636f26
is valid, but1.1.0-alpha.08213312
isn't – see rule 9 of the specification ("Numeric identifiers MUST NOT include leading zeroes").Note that this is not just an issue of just being pedantic – we're using JFrog's Artifactory, and without going into too much detail, it really, really doesn't like encountering a version string like that. We're publishing a lot of packages, multiple times a day, and we're hitting this issue quite regularly.
Possible Solution
Change the template string in
PublishCommand
/getCanaryVersion()
to be:${nextVersion}-${preid}${hash}
, or${nextVersion}-${preid}.commit${hash}
, or something similar.Steps to Reproduce
--canary
Your Environment
lerna --version
npm --version
yarn --version
node --version
The text was updated successfully, but these errors were encountered: