Skip to content
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

0.25.0 not committing changes to files other than .bumpversion.toml #220

Closed
Makeshift opened this issue Aug 7, 2024 · 6 comments · Fixed by #221
Closed

0.25.0 not committing changes to files other than .bumpversion.toml #220

Makeshift opened this issue Aug 7, 2024 · 6 comments · Fixed by #221

Comments

@Makeshift
Copy link

Makeshift commented Aug 7, 2024

  • bump-my-version version: 0.25.0
  • Python version: 3.11.8
  • Operating System: Docker image based on Ubuntu 22.04

Description

We use bump-my-version as part of our CI pipeline in GitHub Actions. We were installing the latest version, and we noticed that as of 0.25.0, bump-my-version is only committing changes to the .bumpversion.toml file and not changes to other files, despite claiming to in the log.

What I Did

$ bump-my-version bump patch -vv

In the resulting log, I can see that it does find and replace the version in each file that it's meant to (or at least it logs that it does - I don't have access to the filesystem it's making changes on during this log, so I can't actually see if it's made that change):

File helm/charts/datapump-sharetraffic/Chart.yaml: replace `appVersion:         
{current_version}                                                               
version: {current_version}                                                      
` with `appVersion: {new_version}                                               
version: {new_version}                                                          
`                                                                               
  Serializing the current version                                               
    Serializing version '<bumpversion.Version:major=7, minor=4, patch=12>'      
      Using serialization format '{major}.{minor}.{patch}'                      
      Serialized to '7.4.12'                                                    
  Serializing the new version                                                   
    Serializing version '<bumpversion.Version:major=7, minor=4, patch=13>'      
      Using serialization format '{major}.{minor}.{patch}'                      
      Serialized to '7.4.13'                                                    
  Rendering search pattern with context                                         
    No RegEx flag detected. Searching for the default pattern: 'appVersion:\    
7\.4\.12\                                                                       
version:\ 7\.4\.12\                                                             
'                                                                               
  Found 'appVersion:\ 7\.4\.12\                                                 
version:\ 7\.4\.12\                                                             
' at line 20: appVersion: 7.4.12                                                
version: 7.4.12                                                                 
                                                                                
  Changing file helm/charts/datapump-sharetraffic/Chart.yaml:                   
    *** before helm/charts/datapump-sharetraffic/Chart.yaml                     
    --- after helm/charts/datapump-sharetraffic/Chart.yaml                      
    ***************                                                             
    *** 17,21 ****                                                              
                                                                                         
    ! appVersion: 7.4.12                                                        
    ! version: 7.4.12                                                           
    --- 17,21 ----                                                              
                                                                                         
    ! appVersion: 7.4.13                                                        
    ! version: 7.4.13                                                           
                                        

At the end of the log, I can see that it is adding it to git:

Adding changes in file 'helm/charts/datapump-sharetraffic/Chart.yaml' to Git  

However, the subsequent commit does not contain any changes to this file.

For reference, here's the config in use:

[tool.bumpversion]
commit = true
message = "Bump Version v{current_version} -> v{new_version}"
# Stop git from trying to clean up our commit message
commit_args = "--cleanup=verbatim"
tag = true
tag_name = "{new_version}"
current_version = "7.4.13"

[[tool.bumpversion.files]]
filename = "pom.xml"
search = "<revision>{current_version}</revision>"
replace = "<revision>{new_version}</revision>"

[[tool.bumpversion.files]]
glob = "helm/charts/*/Chart.yaml"
search = """
appVersion: {current_version}
version: {current_version}
"""
replace = """
appVersion: {new_version}
version: {new_version}
"""

Reverting back to 0.24.3 fixes the issue for us.

I'm currently having some trouble with my local dev environment so I can't provide as much detail as I'd like (eg whether it's actually making any changes to the filesystem), but will try to provide more detail if needed.

@coordt
Copy link
Member

coordt commented Aug 7, 2024

First, thank you for the detailed report. The bump to 0.25.0 was to check for the config file being part of the repository.
Can you confirm that your config file is a part of the repository?

Meanwhile, I will check the tests and write a regression test if necessary.

@coordt
Copy link
Member

coordt commented Aug 7, 2024

@Makeshift Can you look in the verbose logging if one of the following lines appears:

  • No configuration file found to update.
  • Processing config file:
  • Configuration file is outside of the repo. Not going to change.
  • You must have a .toml suffix to update the config file:

If you see only Processing config file: and none of the others, that will focus my efforts in one direction.

If you see any of the other lines, it explains why it didn't update the config file.

@coordt
Copy link
Member

coordt commented Aug 7, 2024

@Makeshift OK, I just realized that I misread your entire bug report. I thought it was changing all files except the config.

So, for additional clarification, were the changes to the configuration included in the commit?

@Makeshift
Copy link
Author

Makeshift commented Aug 7, 2024

@coordt To confirm, when we run bump-my-version 0.25.0, it seems to only be committing changes to the .bumpversion.toml file and is not committing the version changes in any other file.

0.25.0 results in commits that look like this:
image

And 0.24.3 results in commits that (correctly) look like this:
image

I've fixed my local setup and can now replicate this issue locally. bump-my-version is updating all of the files, but does not appear to be staging the files, so they aren't committed.

If I run bump-my-version bump patch locally, I get a commit containing just the changes to .bumpversion.toml, and the rest of the files are left unstaged:

$ git status
On branch upgrade-test
nothing to commit, working tree clean
$ bump-my-version bump patch
$ git log -n1
commit 5d422be9db2c4a69573c60ff0600883d5bf1964e (HEAD -> upgrade-test, tag: 7.4.17)
Author: Connor Bell (Makeshift) <[email protected]>
Date:   Wed Aug 7 17:23:00 2024 +0100

    Bump Version v7.4.16 -> v7.4.17
$ git status
On branch upgrade-test
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   helm/charts/alb-ip-ws-coreapiservice/Chart.yaml
        modified:   helm/charts/alb-ip-ws-socialapiservice/Chart.yaml
...

In the verbose log file, it states that it is adding these files to git, but it isn't:

Adding changes in file 'helm/charts/alb-ip-ws-coreapiservice/Chart.yaml' to Git  

@coordt coordt linked a pull request Aug 7, 2024 that will close this issue
@coordt
Copy link
Member

coordt commented Aug 7, 2024

@Makeshift I've created a test that I think mimics your situation.

This test passes.

Can you review the test to see where I may have got it wrong?

If it looks good, I can add additional logging in this branch and you can custom install it locally to get more information.

@coordt
Copy link
Member

coordt commented Aug 7, 2024

@Makeshift Sorry, I found the missing part: I wasn't checking if the files were committed, only changed.

Nevermind the previous comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants