tomasbjerre / git-changelog-lib Goto Github PK
View Code? Open in Web Editor NEWGenerate changelog, and/or next version, with, or without, conventional commits from a GIT repository
License: Apache License 2.0
Generate changelog, and/or next version, with, or without, conventional commits from a GIT repository
License: Apache License 2.0
I am using the new 1.57 build. The settings in my pipeline was generated using the pipeline syntax. I do also have a subfolder which has my code, hence the cd Android command.
I am trying to create a change log using the pipeline feature but my file is coming back with incorrect or blank info depending on the commit points I use.
The important settings specifying the commit points are:
subDirectory: 'Android', useSubDirectory: true
fromReference: 'abf73bee6bc3aea0a7ae364dfde00a89973e1684', fromType: 'commit'
toReference: '5f881607a03fb96394dbac584cfa0cd77ecf187b', toType: 'commit'
The change log is blank. I included the git log in a .log file which was created by running the below command right after the change log was created.
sh '''cd Android
git log > git.log'''
git.log
Are we able to display multiple tags at the same commit? Right now it looks like if a commit has two tags, one of them is not displayed.
Version 1.32
Is it possible to use standard jenkins variables in the mustashe templates.
such as JOB_NAME?
or any of the other ones referenced here:
https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables
thanks.
Now length of hash is limited to 15 digits.
private static String toHash(String input) { return input.substring(0, 15); }
It would be hady to have ability to get full hash in addition to shortened or to have ability to change length of available hash.
For example for integration with git in TFS I need to have full hash value to have proper link to commit in TFS in changelog.
Is that possible to include the description and/or releases notes (using Gitlab) for annotated tags ?
hello
I was wondering if its possible or if its already implemented to get the URL form the git config so i can easily have it useable across multiple repos. either through copy and paste or in a script that is applied.
thank you for your time.
This is github issue #45 at github..com//issues/45
When i add a commit message "#45: some commit text" then commit is linked to the issue:
Is it possible to use this in an a generated changelog?
the example https://github.com/tomasbjerre/git-changelog-lib/blob/master/changelog.mustache seems to be hardcoded-linked to Jira issues.
I would like to link to github-issues instead.
Here is an example where commit-messages are linked to issues: k3b/APhotoManager#21
Currently only 30 issues can be found.
Make it faster!
It would be nice to integrate changelog with GitLab. The APIs and OAuth are not compatible with GitHub:
I can send a PR if needed.
Integration is in place, but authentication would be nice also
Hi !
Our company would like to use your lib for generating changelogs.
After a small analysis of the different kind of issues this library is able to parse in the commit messages (JIRA, GITHUB, CUSTOM), but the only one which would garanty to fetch developed features are the automated messages generated by github when a pull request is merged : "Merge pull request #XXX". Since users could forget to write their commit messages in a certain fashion.
It's already possible to detect such messages with CustomIssues, however, at this point we would need to fetch the pull request title. So the solution would be to develop a new kind of "SettingsIssueType".
I'd be very glad to contribute to develop this feature. I read the code, and it seems quite easy to extend for that request.
So here is some question:
My alternative is to fork and re-release a plugin, since we don't have internal gradle plugin repo.
Let me know asap please, and big up for this great lib !
cheers
Hello. Have some problem with changelog plugin. I have 5 repos in that path, plugin didn't find them
--- Git Changelog ---
gitchangelog.api.exceptions.GitChangelogRepositoryException: Did not find a GIT repo in C:\Program Files (x86)\Jenkins\jobs\qwerty\workspace\Dependencies
at se.bjurr.gitchangelog.internal.git.GitRepo.(GitRepo.java:69)
at se.bjurr.gitchangelog.api.GitChangelogApi.getChangelog(GitChangelogApi.java:73)
at se.bjurr.gitchangelog.api.GitChangelogApi.render(GitChangelogApi.java:97)
at org.jenkinsci.plugins.gitchangelog.perform.RemoteCallable.call(RemoteCallable.java:130)
at org.jenkinsci.plugins.gitchangelog.perform.RemoteCallable.call(RemoteCallable.java:29)
at hudson.FilePath.act(FilePath.java:1105)
at org.jenkinsci.plugins.gitchangelog.perform.GitChangelogPerformer.performerPerform(GitChangelogPerformer.java:29)
at org.jenkinsci.plugins.gitchangelog.GitChangelogRecorder.perform(GitChangelogRecorder.java:52)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
All tags may not be releases
Hello, I'm trying to add git-changelog to my project.
My project does not have a master
branch. I use version branches.
I get this crash when I run it: https://gist.github.com/mezz/b7efe8e440acc82105486c72c9dc5158
This seems to requite a master branch:
https://github.com/tomasbjerre/git-changelog-lib/blob/master/src/main/java/se/bjurr/gitchangelog/internal/git/GitRepo.java#L314-L315
Here is my project: https://github.com/mezz/JustEnoughItems
I tried setting fromCommit
to my first commit sha but it still crashes the same way.
This test gives 1 or 2 commits for the tag.
https://github.com/tomasbjerre/git-changelog-lib/blob/master/src/test/java/se/bjurr/gitchangelog/internal/git/GitRepoTest.java#L94
I’m getting an exception at
git-changelog-lib/src/main/java/se/bjurr/gitchangelog/internal/git/GitRepo.java
Did not find a GIT repo in /var/jenkins/workspace/EBP-Build-Test
java.lang.RuntimeException: Did not find a GIT repo in /var/jenkins/workspace/EBP-Build-Test
at se.bjurr.gitchangelog.internal.git.GitRepo.<init>(GitRepo.java:69)
at se.bjurr.gitchangelog.api.GitChangelogApi.getChangelog(GitChangelogApi.java:306)
at se.bjurr.gitchangelog.api.GitChangelogApi.render(GitChangelogApi.java:320)
at org.jenkinsci.plugins.gitchangelog.perform.GitChangelogPerformer.performerPerform(GitChangelogPerformer.java:107)
at org.jenkinsci.plugins.gitchangelog.GitChangelogRecorder.perform(GitChangelogRecorder.java:27)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
at hudson.model.Run.execute(Run.java:1763)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
The path is correct, corresponds to the workspace path and the .git folder is present, so I was wondering why this exception is popping up. Any idea ?
Jenkins version : 1.6.50
Plugin version: 1.7
Git client plugin 1.19.5
Git plugin 2.4.2
System Debian.
public GitRepo(File repo) {
try {
File repoFile = new File(repo.getAbsolutePath());
File gitRepoFile = new File(repo.getAbsolutePath() + "/.git");
if (gitRepoFile.exists()) {
repoFile = gitRepoFile;
}
FileRepositoryBuilder builder = new FileRepositoryBuilder()//
.findGitDir(repoFile)//
.readEnvironment();
if (builder.getGitDir() == null) {
throw new RuntimeException("Did not find a GIT repo in " + repo.getAbsolutePath());
}
this.repository = builder.build();
} catch (IOException e) {
throw propagate(e);
}
}
Any Idea ??
It would be great if you can filter the commits by the milestone they've got in their pull request.
I was hoping that it would be able to only show Merges to Master like you can do with the folowing git log command:
git log --dense --merges --simplify-merges --pretty=oneline --date-order --date=iso8601 {#tag}..HEAD
The merge summarises what the branch your merging back in to your master branch, makin the change log a lot denser and readable and quicker to use as a sort of in this release we had this changes.
Maybe even better is to just show the {merge} tag, that you can use then as a header and with sub tags for the commits as it is now.
These settings and such are not really what I used (removed some things), but they should replicate the problem
Fix for a BUG
This fixes a BUG, as well as another BUG.
# Changelog for X
## Next Release
### Bugs
* Fix for a BUG
* Fix for a BUG
* Fix for a BUG
{
"ignoreCommitsIfMessageMatches": "^\\[maven-release-plugin\\].*|^\\[Gradle Release Plugin\\].*|^Merge.*",
"readableTagName": "/([^/]+?)$",
"dateFormat": "YYYY-MM-dd HH:mm:ss",
"untaggedName": "Next release",
"noIssueName": "Other changes",
"timeZone": "UTC",
"removeIssueFromMessage": "false",
"customIssues": [
{ "name": "Bugs", "pattern": "BUG" }
]
}
# Changelog x
{{#tags}}
## {{name}}
{{#issueTypes}}
### {{name}}
{{#issues}}
{{#hasIssue}}
{{#hasLink}}
{{#commits}}
* {{{messageTitle}}}
{{/commits}}
{{/hasLink}}
{{^hasLink}}
{{#commits}}
* {{{messageTitle}}}
{{/commits}}
{{/hasLink}}
{{/hasIssue}}
{{^hasIssue}}
{{#commits}}
* {{{messageTitle}}}
{{/commits}}
{{/hasIssue}}
{{/issues}}
{{/issueTypes}}
{{/tags}}
In this scenario:
* a3f3de2 2016-03-08 Polish (Phillip Webb)
* 644ae2c 2016-03-08 Merge branch '1.3.x' (Phillip Webb)
|\
| * 5e722da 2016-03-08 (origin/1.3.x) Polish (Phillip Webb)
* | d7d2404 2016-03-08 Ensure that Tomcat does not report unstopped main thread when startup fails (Andy Wilkinson)
* | cc2f6f4 2016-03-08 Merge branch '1.3.x' (Stephane Nicoll)
When creating log from d7d2404 to 644ae2c. It will not include 5e722da!
So that, for example, all database changes can be grouped.
This should be on the top level as well as tags, athors, issues.
Not sure if this is currently possible, but I am trying to achieve a changelog with categories, where each category is an issue source (each category is a custom issue). For example, the result I want is along these lines:
# My changelog
Changelog of my project
## [Next release](url)
### GitHub
* An issue [#123](url) in commit [abc124]
* An issue [#124](url) in commit [abc125]
* An issue [#125](url) in commit [abc126]
* An issue [#126](url) in commit [abc127]
* An issue [#127](url) in commit [abc128]
### CustomIssue1
* A custom issue in commit[abc234]
* A custom issue in commit[abc235]
### Other changes
* ...
* ...
To achieve this, I think you need to add under tags
an item such as IssueTypes
, where each type then has a name
and issues
.
Alternatively, the concept of a category could be a completely independent thing which you specify manually.
What do you think? Is there an easier way to achieve this with the existing implementation?
ERROR: Step ‘Git Changelog’ aborted due to exception:
java.lang.NoClassDefFoundError: Could not initialize class se.bjurr.gitchangelog.internal.settings.Settings
at se.bjurr.gitchangelog.api.GitChangelogApi.(GitChangelogApi.java:430)
at se.bjurr.gitchangelog.api.GitChangelogApi.gitChangelogApiBuilder(GitChangelogApi.java:57)
at org.jenkinsci.plugins.gitchangelog.perform.RemoteCallable.call(RemoteCallable.java:56)
at org.jenkinsci.plugins.gitchangelog.perform.RemoteCallable.call(RemoteCallable.java:29)
at hudson.FilePath.act(FilePath.java:1083)
at org.jenkinsci.plugins.gitchangelog.perform.GitChangelogPerformer.performerPerform(GitChangelogPerformer.java:40)
at org.jenkinsci.plugins.gitchangelog.GitChangelogRecorder.perform(GitChangelogRecorder.java:52)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.model.Build$BuildExecution.post2(Build.java:186)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
at hudson.model.Run.execute(Run.java:1753)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:405)
Finished: FAILURE
This is more of a feature request than an issue. I think it would be swell if the user could provide a hunk of JSON that could be added somewhere in the mustache context for later use in the template. This would allow for user lambdas for dynamic filtering and other general extension when creating the change logs.
For example, using the command line interface, one might:
git-changelog-lib --repo "\my\repo" --from-commit cec9173674a57866f87506e87cfb1e49a435f2c3 --to-ref HEAD --user-context-file context.json --output-file test.txt
With context.json having:
{ foo: 'bar'}
And a mustache template referencing it:
{{#usercontext}}{{!This would be an implicit object where the contents of the user context would be placed by git-changelog-lib}} We have foo {{foo}}! {{/usercontext}}
Additionally, one-off variables could be passed in rather than having to require a separate file be provided:
git-changelog-lib --repo "\my\repo" --from-commit cec9173674a57866f87506e87cfb1e49a435f2c3 --to-ref HEAD --user-context-foo bar --output-file test.txt
My particular use case is wanting to include some information from my build in the change logs, specifically the release number, but it seems this could be useful for other purposes as well.
Thanks for any consideration.
Add a template that is used to populate the message in PR.
Hello
I would like the ability to get the difference for a submodule even if its from a point in the commit history.
Would this be possible. I did not see a way in any of the documentation.
I'm running gradle version of this library and when automation runs gitChangelog with thisset fromRef=master
I'm obtaining an Unreleased version of that commit when I was expecting obtaining an empty changelog, given master is a tag referring my last commit.
This is the changelog I use to get in this case:
Unreleased
Related issues:
Commits:
- 424eee812e127dd John McCoy 2018-01-19 14:04:15
Merge pull request #153 in TEST/test from ~JOHN.MCCOY/test:TEST-02to master
Hello,
how can i sort commit messages depending on same tags in the commit message?
----8<----8< begin message format----8<----8<
[scope] [type] titel
detailed information
some text [component]
some text [customer]
----8<----8< end message format----8<----8<
with
[scope]= Modul A or Modul B etc.
[type]=new or change or fix or test or refactoring or test etc.
[component]=component A or component B etc.
[customer]=customer A or customer B etc.
I would like to generate a sorted changelog
a) with full infomration for internal use
b) with fewer information for external use
For filtering messages there is the regex Pattern within ignoreCommitsIfMessageMatches and maybe issue#53 (How to filter a message body item?)
But how can commit messages be sorted with adaptive possibilities in the name and sequence of scope, type, component and customer?
example - format
scope (level 1)
type (level 2)
component (level 3)
customer (level 2)
example - log output
scope Modul A - heading Modul A
type new - heading type new
component A - heading component A
message 1
message 2
component B - heading component B
message 3
change - heading type change
component C - heading component C
message 4
fix - heading type fix
component A - heading component A
message 5
message 6
component B - heading component B
message 7
heading customers
customer A - heading customer A
message 8
message 9
customer B - heading customer A
message 10
Modul B - heading Modul B
fix - heading type fix
component C - heading component C
message 10
I use git-changelog-lib with git-changelog-command-line Tool.
Thank you very much
FO
pom.xml
<plugin>
<groupId>se.bjurr.gitchangelog</groupId>
<artifactId>git-changelog-maven-plugin</artifactId>
<version>1.50</version>
<executions>
<execution>
<id>GenerateGitChangelog</id>
<phase>generate-sources</phase>
<goals>
<goal>git-changelog</goal>
</goals>
<configuration>
<!-- A file on filesystem //-->
<file>CHANGELOG.md</file>
</configuration>
</execution>
</executions>
</plugin>
it created CHANGELOG.md ,but the log is from master branch instead of current branch
here is the debug.log with -d and -S enabled.
https://gist.github.com/dmodoomsirius/83db89e9ee38c4fde45d82d13e8458c3
Will push fix soon...
Hello,
how can i filter a message body item?
e.g. from message
--- 8< --- 8< begin message --- 8< --- 8<
titel
detailed information
(cherry picked from commit ....
--- 8< --- 8< end message --- 8< --- 8<
remove the following lines
could you please provide a method ignoreMessageBodyItemsIfItemMatches similary to method ignoreCommitsIfMessageMatches?
I would like to create 2 changelogs
Therefore, I can not globally disable git commit info (cherry picked from ... and comments in commit messages.
I use git-changelog-lib with git-changelog-command-line Tool.
Thank you very much
FO
When following parents. Should only follow parent p
if from
isMergedInto p
.
To avoid some dependencies for those who only use the lib.
Here is the scenario:
in Develop I add commit a
Create Release Branch v1.0
add commit b in release Branch
add commit c in Develop Branch (for v1.2)
add commit d in release Brach
Finish Release tag with v.10
merge to master & develop
When I generate the gitChangelog in develop branch
it puts commit b,c,d in v1.0 Whereas commit c has not yet released.
When I do a release 1.2 ( which has commit c and no other commit)
it doesn't even show up in the changlog
The only way commit c
can be seen in correct place is if i do
fromRef=1.0
toRef=1.2
i will see c
listed under 1.2. Not otherwise
task gitChangelogTask(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
filePath = "CHANGELOG.md";
templateContent = new File('changelog.mustache').getText('UTF-8');
customIssues = [
[ "Added", "(?i)(added)\\s*(?i)(JIRA-\\d{1,6})(.*)", "https://mycompanyjira.com/browse/\${PATTERN_GROUP_2}", "\${PATTERN_GROUP_3}"],
[ "Fixed", "(?i)(fixed)\\s*(?i)(JIRA-\\d{1,6})(.*)", "https://mycompanyjira.com/browse/\${PATTERN_GROUP_2}", "\${PATTERN_GROUP_3}"],
]
jiraIssuePattern = '(?!)' // to skip jira issues for now.
untaggedName = "Next Release";
ignoreCommitsWithoutIssue = true;
}
List of files in every commit.
So that classpath issues are avoided
create a ncie printer friendly page in Mediawiki
https://github.com/_git-repositories-cache/39470adafea7ddae99cc8d70bf6dc6ddf5db8a1e/commit/bd65ca284e633f6 is what bamboo is currently doing instead of BuiltBrokenModding/AI-Improvements@bd65ca284e633f6 when doing
<li> <a href="https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}" target=_blank> {{{message}}}</a>
At the moment the generated documentation work quite nice. However it tries to create links on the commit hahes. And it does not derive it or is configurable (at least clearly).
For example it generates a commit based on the has as folows:
https://github.com/tomasbjerre/git-changelog-lib/commit/6f8c1fb96a908b1
But in my case it should be:
https://bitbucket.org/{owner of repo}/{name of repo}/commits/
.
This could be dynamecly derived from the git url thats given:
[email protected]:{owner of repo}/{name of repo}.git (and yeah the commits part I guess should be configurable seeing github and bitbucket have a difrent method there.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.