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

Avoiding version update direct commit on develop / master #226

Closed
sndmails2arun opened this issue Apr 27, 2020 · 5 comments
Closed

Avoiding version update direct commit on develop / master #226

sndmails2arun opened this issue Apr 27, 2020 · 5 comments
Assignees

Comments

@sndmails2arun
Copy link

Few of the teams I work with has put in restrictions on their repo to reject any direct commits on the develop and master branches , and allow only merge commits to be pushed to remote.

So when I do feature-finish for eg. , if the feature version in pom is 1.0-feature1-SNAPHOT , it merges that in to develop, then update the version in develop to 1.0-SNAPSHOT with another commit. For us this commit would be rejected by our remote repo since it is not a merge commit.
I am not sure if there was a specific reason for doing it this way.

Possible solution:
If the commit to update the version is is done on the feature branch , and then it merges to develop, the end result will be same but just with a merge commit. So the logic would be , feature-finish > check current develop version and copy it > change the version on feature branch and commit > checkout develop > merge feature branch and commit

@aleksandr-m
Copy link
Owner

One downside of this is when the feature branch is kept after finish then version in it will be w/o feature name. Ideas?

@sndmails2arun
Copy link
Author

sndmails2arun commented May 11, 2020

Yea you are right. I did't think about that use case. I can think of couple of solutions

  1. If keepBranch flag is True, at -finish stage, check out a temp branch from the feature branch (say feature/my_awesome_feature_merge), update the develop's pom version into it, and then merge to develop. Leave the feature branch as is.
  2. Have this new flow available only if the keepBranch is False. If the flag is on, continue the existing logic. I feel this is not a good solution with this messy logic in code.
  3. Make the develop branch version update on the current feature branch, merge to develop. After that if the keepBranch flag is True, update the version on the feature branch back to its version and commit to the feature branch.
  4. Don't care to change the current behavior. If teams has restrictions on repo, that needs to be removed and implement some other audit mechanism to avoid accidental commits on the branch.

@aleksandr-m aleksandr-m self-assigned this May 14, 2020
@aleksandr-m
Copy link
Owner

@sndmails2arun Same here 👍 . Implemented the 3. Thanks for reporting and possible solutions!

@sndmails2arun
Copy link
Author

👍Thank you very much. You are awesome ! 👍

@aleksandr-m
Copy link
Owner

@sndmails2arun 1.15.0 is out!

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

No branches or pull requests

2 participants