Skip to content

7.31.3 keeps making new releases #490

Description

@zjgoodman

The problem

We noticed today that our CICD generated 10+ new releases

image

After looking into it we've discovered that the problem is the newest version of SR itself. The current version of SR (7.31.3) keeps making new releases even if we don't push any new commits. Just running it on the clean master branch causes it to make a new release.

❯ pip list | grep python-semantic-release                                                                                                                        
python-semantic-release 7.31.3

❯ semantic-release publish --noop                                                                                                                                   
Current version: 14.0.0, Current release version: 14.0.0
warning: No operation mode. Should have bumped from 14.0.0 to 15.0.0

The previous version (7.31.2) works as expected

❯ pip list | grep python-semantic-release                                                                                                                    
python-semantic-release 7.31.2

❯ semantic-release publish --noop                                                                                                                                   
Current version: 14.0.0, Current release version: 14.0.0
No release will be made.

A clear and concise description of what the bug is.

Expected behavior

If I run semantic release without changing any of the code in master then I won't get a release. But the actual behavior is we do get a release. This is not the case for previous versions of SR.

Additional context

Here's the command with debug verbosity

❯ semantic-release publish --verbosity=DEBUG --noop  
debug: get_current_version_by_config_file()
debug: Parsing current version: path=PosixPath('src/myproject/__init__.py') pattern='__version__ *[:=] *["\\\'](\\d+\\.\\d+\\.\\d+(-dev\\.\\d+)?)["\\\']' num_matches=1
debug: Parsing current version: path=PosixPath('pyproject.toml') pattern='version *[:=] *["\\\'](\\d+\\.\\d+\\.\\d+(-dev\\.\\d+)?)["\\\']' num_matches=1
debug: Regex matched version: 14.0.0
debug: get_current_version_by_config_file -> 14.0.0
debug: get_current_release_version_by_commits()
debug: Checking commit 797c773f6be96b0224cdba6e05b1dad20b142ab7
debug: Version matches regex 14.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: get_current_release_version_by_commits -> 14.0.0
Current version: 14.0.0, Current release version: 14.0.0
debug: evaluate_version_bump('14.0.0', None)
debug: Reference v14.0.0 does not exist, considering entire history
debug: parse_commit_message('14.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 14.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('13.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 13.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('12.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 12.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('11.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 11.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('10.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 10.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('9.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 9.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('8.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 8.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('7.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 7.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('6.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 6.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('5.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 5.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('4.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 4.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('3.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 3.0.0
debug: 
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('2.0.0
debug: 
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 2.0.0

# -----------------------------
# skipping the next 140 commits
# -----------------------------

debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: root commit
debug: Commits found since last release: 140
debug: evaluate_version_bump -> major
debug: get_new_version('14.0.0', '14.0.0', 'major', False, True)
debug: get_new_version -> 15.0.0
debug: get_repository_owner_and_name()
debug: get_repository_owner_and_name -> ('mycompany/myorg', 'myproject')
debug: Running publish on branch master
debug: checkout(master)
debug: checkout -> Your branch is up to date with 'origin/master'.
warning: No operation mode. Should have bumped from 14.0.0 to 15.0.0

Activity

  1. bernardcooke53 commented on Aug 23, 2022

    @bernardcooke53
    Contributor

    @zjgoodman can you post your configuration please? Are the commits in your screenshot the full messages that you're releasing with, or is there more to them that isn't shown (like a message body)?

    I suspect https://github.com/relekang/python-semantic-release/blob/aad17b0bdaac088b7538d3d3e04622c15ab31e60/semantic_release/vcs_helpers.py#L40 is not producing the same message as your configuration does when PSR commits on a release, so it "thinks" it hasn't found a commit releasing this version. Combined with going back over the history, probably finding your last major release (v2?), taking that as max level bump and bumping major version.

    Are you running this in a CI on a cron trigger?

  2. zjgoodman commented on Aug 23, 2022

    @zjgoodman
    Author

    Hi thanks for looking into this!

    Are the commits in your screenshot the full messages that you're releasing with, or is there more to them that isn't shown (like a message body)?

    The commits do have a body but it's just the default SR body, as shown below.

    image

    can you post your configuration please?

    Below is the config for SR that I have in my pyproject.toml file.

    [tool.semantic_release]
    version_variable = [
        "src/myproject/__init__.py:__version__",
        "pyproject.toml:version"
    ]
    branch = "master"
    build_command = "poetry build"
    prerelease_tag = "dev"
    tag_commit = false
    hvcs = "gitlab"
    ignore_token_for_push = false
    upload_to_repository = true
    repository_name = "artifactory"
    repository_url = "https://myartifactory.com"
    upload_to_release = false

    Are you running this in a CI on a cron trigger?

    No this CI pipeline is triggered by commits. If you commit to the master branch it kicks off a pipeline. So what you're seeing with all these commits is that semantic release is running and determining that a new release should be made, then commits the release, which triggers a new pipeline, which runs semantic release and then the cycle repeats. On previous versions of semantic release, it determines that there's no need to make a new release and so it doesn't commit, so another pipeline doesn't get triggered.

  3. bernardcooke53 commented on Aug 23, 2022

    @bernardcooke53
    Contributor

    @zjgoodman - not sure if the tag worked properly - the issue was that trailing newlines in git commit history were breaking a stricter comparison introduced in #488. I've been able to fix this in a test repo - have replicated with your config etc

  4. zjgoodman commented on Aug 24, 2022

    @zjgoodman
    Author

    @bernardcooke53 I can confirm that the fix in 7.31.4 worked and the problem is resolved. Thanks for taking care of this

    7.31.3

    Not working (as reported in this bug)

    debug: Commits found since last release: 22
    debug: evaluate_version_bump -> minor
    debug: get_new_version('14.3.0', '14.3.0', 'minor', False, True)
    debug: get_new_version -> 14.4.0
    debug: get_repository_owner_and_name()
    debug: get_repository_owner_and_name -> ('myorg/myteam', 'myproject')
    debug: Running publish on branch master
    debug: checkout(master)
    debug: checkout -> Branch 'master' set up to track remote branch 'master' from 'origin'.
    warning: No operation mode. Should have bumped from 14.3.0 to 14.4.0
    

    7.31.4

    Working as expected

    debug: Commits found since last release: 0
    debug: get_new_version('14.3.0', '14.3.0', None, False, True)
    debug: get_new_version -> 14.3.0
    debug: get_repository_owner_and_name()
    debug: get_repository_owner_and_name -> ('myorg/myteam', 'myproject')
    debug: Running publish on branch master
    debug: checkout(master)
    debug: checkout -> Branch 'master' set up to track remote branch 'master' from 'origin'.
    No release will be made.
    
  5. added a commit that references this issue on Jun 15, 2024
    111b151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working properly

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions