commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

No commits found to generate a pre-release

Open m1racoli opened this issue 4 years ago • 8 comments

Description

cz bump --prerelease rc should handle missing "bumpable" commits the same way as cz bump.

Steps to reproduce

  1. create a non-bumpable commit (i.e. ci or build)
  2. run cz bump --prerelease rc --dry-run

Current behavior

The command terminates with an error:

$ cz bump --prerelease rc --dry-run
[NO_COMMITS_FOUND]
No commits found to generate a pre-release.
To avoid this error, manually specify the type of increment with `--increment`

Desired behavior

It should behave like running cz bump without --prerelease flag.

$ cz bump --dry-run                
bump: version 1.2.1 → 1.2.1 [skip ci]
tag to create: v1.2.1
increment detected: None

Environment

  • commitizen version: 2.18.0
  • python version: 3.9.4
  • operating system: Darwin

m1racoli avatar Sep 03 '21 11:09 m1racoli

Thanks for reporting! This seems to be designed this way. See if this comment helps. https://github.com/commitizen-tools/commitizen/pull/307#issuecomment-731584249

Lee-W avatar Sep 06 '21 01:09 Lee-W

Ok, I see the issue at hand.

Our intention is to generate pre-releases automatically from the master branch in CI. If there are no corresponding changes it should just not do anything. Since we rely on commitizen to determine the kind of bump, it would be problematic to explicitly configure the increment.

hmmmm

m1racoli avatar Sep 06 '21 07:09 m1racoli

@Woile I kinda don't get the idea of the original design. Would there be any issue if we check the pre-release commits as usual?

https://github.com/commitizen-tools/commitizen/pull/307#issuecomment-731584249

Lee-W avatar Sep 07 '21 14:09 Lee-W

Luckily I added the issue to the comments, seems to be related to this issue: https://github.com/commitizen-tools/commitizen/issues/281

woile avatar Sep 07 '21 15:09 woile

Yep, got your idea. @m1racoli Do you think this one better explains the design? Or is there a better solution for this one

Lee-W avatar Sep 11 '21 02:09 Lee-W

Hmm ... I am not sure yet.

If any release (alpha, beta, rc, prod) would bump the version if and only if there is a version increasing commit then we would not have a problem, no?

I kinda expect the following behaviour when there is no version increasing commit:

alpha -> alpha: do nothing
alpha -> beta: only create beta tag
alpha -> rc: only create rc tag
alpha -> release: only create relase tag

beta -> alpha: do nothing
beta -> beta: do nothing
beta -> rc: only create rc tag
beta -> release: only create release tag

rc -> alpha: do nothing
rc -> beta: do nothing
rc -> rc: do nothing
rc -> release: only create release tag

release -> alpha: do nothing
release -> beta: do nothing
release -> rc: do nothing
release -> release: do nothing

Basically we need to consider the different types of releases in a hierarchical order and only create a tag when we increase the level of release. And we'll never increase the version if there is not version increasing commit.

I think it's quite common to first release something as RC and later release the same code as release. 🤔

Does this make sense?

m1racoli avatar Sep 16 '21 09:09 m1racoli

This makes sense to me. @Woile what do you think?

Lee-W avatar Sep 19 '21 03:09 Lee-W

Hi, i basically run into the same issue (not being able to release a RC as PROD). Is there a recommended workflow/workaround to go from RC to PROD without commits in between?

Thanks

nbrugger-tgm avatar Nov 21 '21 15:11 nbrugger-tgm