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

Different argLine for various branches (Production, Development, ...) to fully support maven-ci-friendly-versions #314

Open
mmusenbr opened this issue Sep 9, 2021 · 7 comments

Comments

@mmusenbr
Copy link

mmusenbr commented Sep 9, 2021

Hi, first of all, thanks for the awesome work on this plugin.

We currently use gitflow-maven-plugin via CI to perform our hotfix and release start/finish tasks. We switched to use Maven CI friendly versioning, and also use it for our dependencies.
This raises the need to set the changelist-property to empty for builds done on master/release, but NOT change it for builds on development branches, to make sure the correct dependencies (released/snapshot) are used.
Info: our provided maven repository cleans -SNAPSHOT builds, once a release build exists.

Would there be a need/want to support this? If yes, I may have time to support with an MR (after details are clarified of course).

regards m

@aleksandr-m
Copy link
Owner

@redeamer See discussion in #305. Why do you use separate property for holding -SNAPSHOT? PR-s are welcome. :)

@mmusenbr
Copy link
Author

Hi @aleksandr-m, thanks for the quick response. Because #305 does not cover the case, that dependency versions are also using the <changelist>-property. Like in the Maven CI Friendly Multi Module Dependencies Example.
Whe have the case that we have multiple modules, having the version number streamlined over the modules.

Let's take the following pom.xml in a hotfix 1.3.1 branch:

<version>${revision}${changelist}</version>
<properties>
  <revision>1.3.1</revision>
  <changelist>-SNAPSHOT</changelist>
</properties>

<dependencyManagement>
  <dependencies>
    <dependency>
      ...
      <artifactId>dep1</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>
</dependencyManagement>

Now let's assume the following revisions in the branches:

  • master: 1.3.0
  • hotfix/1.3.1: 1.3.1
  • dev: 1.4.0

On hotfix-finish the hotfix, master and development branch is checked out. When the hotfix and master branch is checked out and a mvn command is performed, we would need changelist='' passed, that dep1 is pulled without the -SNAPSHOT, because 1.3.0-SNAPSHOT does not exist anymore. But if dev is checked out and a mvn command is issued, we would need to have changelist not changed, to get 1.4.0-SNAPSHOT, because 1.4.0 does not exist yet.

Therefore we would need to support argLine per branch-type, to cover our use-case. I was thinking about a productionArgLine, developmentArgLine, hotfixArgLine, ....

@mmusenbr
Copy link
Author

While writing the previous comment I was also looking into the plugin's code, and we run into the issue does not happen in the mvnXXX-commands, but already in the getCurrentProjectVersion-calls. I would need to have a look, if we can avoid the fetching of the deps for those calls. Then it should work (as far as I can see it from the code).

@aleksandr-m
Copy link
Owner

@redeamer Why there is need to use separate changelist property at all? Can't you just add -SNAPSHOT to revision?

@mmusenbr
Copy link
Author

@aleksandr-m sorry for my late response, but I was off last week.
This is what we did before, but we streamlined all our projects to use Maven CI friendly versioning with the use of revision and changelist for all our projects. So this is unfortunately a settled decision. Otherwise we would switch to do it 'manually'.
I created a local version of the plugin which supports the options changelistProperty (to override 'changelist' as default), and the values via productionChangelistValue, developmentChangelistValue, ... which would add support for the variable changelist-property, but I am not entirely happy with my current solution, because it messes with the Properties and the argLine to change the values per branch.
If you are generally interested in support of branch based changelist (and maybe sha1 for completeness) I would created MR with the current solution, to have a base to talk.

mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Sep 21, 2021
@mmusenbr
Copy link
Author

mmusenbr commented Sep 21, 2021

@aleksandr-m Opened a PR #315

mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Sep 22, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Sep 22, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Sep 27, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Sep 27, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Sep 27, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Sep 27, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Sep 28, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Sep 28, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Oct 7, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Oct 7, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Oct 7, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Oct 7, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Oct 15, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Oct 15, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Oct 15, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Oct 15, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Dec 23, 2021
mmusenbr added a commit to mmusenbr/gitflow-maven-plugin that referenced this issue Dec 23, 2021
@simontunnat
Copy link

Is there anything I could do to help getting this feature merged? :)

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

3 participants