Java – git process: how to configure the one click release process in Jenkins?

We use the standard git stream branching model (development, master, release, patch, etc.)

As part of our workflow, we want to set up "one click" publishing through Jenkins

I'm looking at jgitflow Maven plugin Can I set up this plugin to do a one click release from Jenkins? If so, what are the configuration options?

Especially, can I do such a thing?

Jenkins Job
Maven goals:    release-start release-finish -Dsomething -Delse

Is there any way to tell it to build automatically from the latest - snapshot version, for example, if the version is 1.2 3-snapshot, which will build release-1.2 three

Otherwise, is there a maven plug-in that builds a version based on the GIT stream branching model (that is, builds and creates a new release branch called release-x.y.z from development)

Solution

Although the answer is one year old, I would like to point out that jgitflow (v1.0-m5.1) can work with Maven batch mode at the same time

Therefore, to issue an artifact, you only need one command. You can execute:

mvn --batch-mode jgitflow:release-start jgitflow:release-finish

You do not need to set the developmentversion and releaseversion

Jgitflow will use the current version minus the - snapshot part as the version Then it increases the least significant digit and adds - snapshot again for the next development version Example 1.0 0-snapshot – > release: 1.0 0, next development version: 1.0 1-SNAPSHOT

To configure the Jenkins distribution, you need to configure something about GIT

Source control > git > other behavior options

>Delete repository force git cloning: just to make sure the workspace is clean > checkout to a specific local branch: your development branch

Finally, the distribution takes place locally on your Jenkins server, so you want to push the changes back to your git remote server

The easiest way to do this is to add a post build operation that executes the following bash command (the branch name may be different, and I used the jgitflow default):

git push origin develop master --tags

Note if Jenkins runs on windows, you must execute a batch script containing the same command (sometimes unavailable due to SSH problems in Windows) or configure git publisher accordingly

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>