jenkinsci/git-changelog-plugin

Get changelog between last two tags

Closed this issue · 13 comments

vadeg commented

It will be nice to have an ability to get changelog between last and previous tags.
For example. I want to email about new releases, but I don't want to include in email all tags and all commits from the beginning. Just commits between current tag and previous tag.

You may use from ${GIT_PREVIOUS_COMMIT} to ${GIT_COMMIT} as explained in the wiki.

@vadeg: For this purpose I created the first version of this plugin. So if you use the action called "Publish Git Changelog" the git-changelog library will automatically search for the latest tag.

The output is not as flexible as the output you can get with the "Git Changelog" task, though. See the documentation under "Jira Filter" in the wiki.

vadeg commented

@paulwellnerbou thank you for this plugin. It works fine, but has problem with the output.
Plugin adds to the output useless information like
No revs given, searching automatically for latest released tags... Found toRev tag changelog-test-1.0.3 Found fromRev tag changelog-test-1.0.2

and I can't convert this output to more readable form.

vadeg commented

@tomasbjerre thanks! I'll try.

@vadeg @tomasbjerre's output is way more flexible to customize. I am planning to join the two plugins, so that they are not completely separated, may for a 2.0 version...

@vadeg Not sure when this is going to happen though. Are you able to use @tomasbjerre's solution using the GIT_* variables for your use case?

vadeg commented

@paulwellnerbou, Nope. I have an error

Caused by: se.bjurr.gitchangelog.api.exceptions.GitChangelogRepositoryException: 34e971e6b46df02bb7cd404e80f053955e279fa2 not found in:
Repo: Repository[/var/lib/jenkins/workspace/test-changelog/.git]
    at se.bjurr.gitchangelog.internal.git.GitRepo.getRef(GitRepo.java:122)

git log output

863fd4c5053e94bc1848880c8a68ab6837c347cf [maven-release-plugin] prepare for next development iteration
2bbd5e4cde67a296ec74aaf9537b2203bb8246aa [maven-release-plugin] prepare release changelog-test-1.0.6
e80c6fd7998f2a0505b2468dcbb5cc32c13a9091 [maven-release-plugin] prepare for next development iteration
0ebfce1515557981417a6c6e35c7329b68d83225 [maven-release-plugin] prepare release changelog-test-1.0.5
34e971e6b46df02bb7cd404e80f053955e279fa2 [maven-release-plugin] prepare for next development iteration
3918eec2248d6f0d4169fd4448b399bf43e6e330 [maven-release-plugin] prepare release changelog-test-1.0.4
956d690dffc928ca1d088239d58ef4f3d561c619 [maven-release-plugin] prepare for next development iteration
fa4b2b8c18391594e30a814c3866c4693ae9a06c [maven-release-plugin] prepare release changelog-test-1.0.3

As you can see 34e971e6b46df02bb7cd404e80f053955e279fa2 is [maven-release-plugin] prepare for next development iteration

git show-ref output

863fd4c5053e94bc1848880c8a68ab6837c347cf refs/heads/master
e80c6fd7998f2a0505b2468dcbb5cc32c13a9091 refs/remotes/origin/master
00ad4006453c6ea0a6778f9a0d3e73ee37b76b20 refs/tags/changelog-test-1.0.0
f4726e584d159809cb0f933690406b540404ee46 refs/tags/changelog-test-1.0.1
84fe48563c939b1909ba1a22d30eb16b6d8307cf refs/tags/changelog-test-1.0.2
6f9efaba433501ce59dc89bbb76a3b18f4996686 refs/tags/changelog-test-1.0.3
33674902047df8604e60818565b64f965da82b45 refs/tags/changelog-test-1.0.4
5d1e9807c9811eadd8fd60b39ed5d9f7e6b79b5a refs/tags/changelog-test-1.0.5
95a3cf1b3caf977c1863147cf4c7d8bd2e40258d refs/tags/changelog-test-1.0.6

Can you post a screenshot of you jenkins settings?

In the Choose 'from' reference and Choose 'to' reference, you need to select Specific commit (Enter below). I suspect you have chosen A branch or tag (Enter below).

@vadeg is this the git output of the repository jenkins is using as well? (/var/lib/jenkins/workspace/test-changelog/.git)?
Is it working with the "Publish Changelog", although the output is not customizable?

@tomasbjerre Any idea?

vadeg commented

@paulwellnerbou yes.

@tomasbjerre thanks. It helps to solve problem above, but I get strange output.

My plugin settings
Git log output

I have the output like this

Maybe something wrong with the settings?

Can you include the commit-hashes in the git log?
And also what does the variables resolve to when building?
If you think its easier, you may try the command line tool.

No response, closing it.