Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Sep 13, 2018
1 parent 4b410da commit fea2826
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 23 deletions.
53 changes: 32 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,13 @@

Creates a changelog, or release notes, based on Git commits between 2 revisions.

It implements basically the features of [git-changelog](https://github.com/paulwellnerbou/git-changelog) and [git-changelog-lib](https://github.com/tomasbjerre/git-changelog-lib).

The plugin is also documented in the [Jenkins wiki](https://wiki.jenkins-ci.org/display/JENKINS/Git+Changelog+Plugin).

## Usage
# Usage

You can use this plugin either
* As a post-build action. You may want to use variables provided by the [Git Plugin](https://wiki.jenkins.io/display/JENKINS/Git+Plugin) to create a changelog from `GIT_PREVIOUS_SUCCESSFUL_COMMIT` to `GIT_COMMIT` or perhaps just `GIT_PREVIOUS_COMMIT` to `GIT_COMMIT`.
* To crate a summary on Jenkins job containing changelog or releasenotes.
* To create a file in workspace containing changelog or releasenotes.
* To create a MediaWiki page containing changelog or releasenotes.
* To produce a file containing the jira filter and some informative lines.
* To provide replacement text for the [Token Macro Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin), to send emails, for example.
* As a pipeline step.
* To get a traversable data structure, context, that makes up the changes between two revisions.
* To get a rendered string, a custom Mustache template rendered with the context. Also based on changes between two revisions.

This is also documented in [Jenkins wiki](https://wiki.jenkins-ci.org/display/JENKINS/Git+Changelog+Plugin).
You can use this plugin either in a **pipeline** or as a **post-build action**.

# Pipeline
## Pipeline

The plugin is compatible with the [pipeline plugin](https://jenkins.io/doc/book/pipeline/getting-started/) and can be configured to support many use cases. You probably want to adjust it using the [Snippet Generator](https://jenkins.io/doc/book/pipeline/getting-started/#snippet-generator).

Expand Down Expand Up @@ -65,7 +52,7 @@ You can make the changelog prettier by:

Check the [Snippet Generator](https://jenkins.io/doc/book/pipeline/getting-started/#snippet-generator) to see all features!

## Pipeline with context
### Pipeline with context

Here is an example that clones a repo, gathers all jiras and adds a link to jira in the description of the job. The context contains much more then this and is [documented here](https://github.com/tomasbjerre/git-changelog-lib).

Expand All @@ -91,7 +78,7 @@ node {
}
```

## Pipeline with string
### Pipeline with string

Here is an example that clones a repo and publishes the changelog on job page. The template and context is [documented here](https://github.com/tomasbjerre/git-changelog-lib).

Expand Down Expand Up @@ -149,11 +136,27 @@ Changelog of Git Changelog.
}
```

# Using a Post-build Action
## Post-build action

When the plugin is installed, it will add some new post build actions in Jenkins job configuration.

## Jira Filter
* **Git Changelog** - Implements features from [git-changelog-lib](https://github.com/tomasbjerre/git-changelog-lib).
* **Publish Git Changelog** - Implements features from [git-changelog](https://github.com/paulwellnerbou/git-changelog).
* **Publish JIRA Filter** - Implements features from [git-changelog](https://github.com/paulwellnerbou/git-changelog).

There are duplicated features here because this plugin is a merge of 2 plugins!

### Git Changelog

A couple of revisions are configured along with some other optional features. A editable template is available for the user to tweak.

![Select references](/doc/imgs/git-changelog-references.png)

The changelog is created from parsing Git and rendering the template with a context derived from the configured revisions.

![Tweak template](/doc/imgs/git-changelog-file.png)

### Publish JIRA Filter
The following documentation explains to set up the JIRA Filter post-build action. Using the basic changelog post-build action
is even easier, as it does not need any further configuration.

Expand All @@ -170,10 +173,18 @@ If you leave the file input empty, the information will be logged into the jenki
If you specify a filename, you can use other plugins like [HTML Publisher Plugin](https://wiki.jenkins-ci.org/display/JENKINS/HTML+Publisher+Plugin)
to save the files as jenkins report.

# Using as Token Macro Replacement Provider
### Publish Git Changelog

A couple of revisions are configured and an output file will be created with the changes between them.

![](/doc/imgs/publish-git-changelog.png)

### Using as Token Macro Replacement Provider

Having installed the [Token Macro Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin) plugin (which will be the case, as it is a dependency of this plugin), following macros for replacement are provided: <code>GITCHANGELOGJIRA</code> and <code>GITCHANGELOG</code>.

The **Publish Git Changelog** provides macro `GITCHANGELOGJIRA` and **Publish JIRA Filter** provides macro `GITCHANGELOG`. The **Git Changelog** post-build step does not provide a macro, instead use pipelines!

If you use these macros in any plugin supporting token macro replacements, this will be replaced with either the Jira URL or the changelog.

The [Email-ext plugin](https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin) supports token macros, so you can include this URL
Expand Down
Binary file added doc/imgs/git-changelog-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs/git-changelog-references.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs/publish-git-changelog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions outputfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Commits between 86ebeb88aa7a97bf1878d4799f6b76027ebd35e5 and d8a31bd9402b1063f77cb723f494ee330299a961:
* d8a31bd Updating fmt-plugin
* 6e0cf42 [maven-release-plugin] prepare for next development iteration
* cfde52b [maven-release-plugin] prepare release pull-request-notifier-for-bitbucket-3.22
* 9c6ed9e Only stripping username from HTTP clone URL #229
* 81c0f47 [maven-release-plugin] prepare for next development iteration
* b29d76a [maven-release-plugin] prepare release pull-request-notifier-for-bitbucket-3.21
* 5a43e52 Avoiding printing password in log #284
* f423f9f Merge pull request #285 from omerfarukdogan/patch-1

Fix visible "pr-triggerbutton"* 81c7b9d Fix visible "pr-triggerbutton"

"pr-triggerbutton" button wouldn't get removed if the pull request wasn't in OPEN state.* e8a50c6 [maven-release-plugin] prepare for next development iteration
* abda495 [maven-release-plugin] prepare release pull-request-notifier-for-bitbucket-3.20
* 6532327 Merge pull request #271 from jwoolston/issue-229-development

#229 Proposed URI reconstruction to remove username from PULL_REQUEST…* 8b3d22b #229 Proposed URI reconstruction to remove username from PULL_REQUEST_{TO_FROM}_{HTTP,SSH}_CLONE_URL

Signed-off-by: Jared Woolston <Jared.Woolston@gmail.com>
* d8b1d48 [maven-release-plugin] prepare for next development iteration
* 98a3fc2 [maven-release-plugin] prepare release pull-request-notifier-for-bitbucket-3.19
* db0f61a Using Findbugs 3.0.0

* Because latest gives error on mvn deploy.
* 92ad3da Merge pull request #269 from mhitchens/ie-remove-bug

uses jQuery.remove() for greater protability* 97a2d28 Bitbucket 5.7.0
* 5674266 uses jQuery.remove() for greater protability

Internet Explorer's HTMLButtonElement doesn't support a .remove() function, but jQuery can remove the element across browsers.* 73e8e00 Doc
* 4c004e3 [maven-release-plugin] prepare for next development iteration
* 379e454 [maven-release-plugin] prepare release pull-request-notifier-for-bitbucket-3.18
* 117a2e4 Support for delete-event #259
* e3ab153 Doc
* c39bce3 [maven-release-plugin] prepare for next development iteration
* fbf0d59 [maven-release-plugin] prepare release pull-request-notifier-for-bitbucket-3.17
* 2665e48 Adding HTTP 1.1 support #257

Hopefully solves OpenShift integration problem.
* cdc5e60 Doc
* bdd9123 [maven-release-plugin] prepare for next development iteration
* 635b379 [maven-release-plugin] prepare release pull-request-notifier-for-bitbucket-3.16

3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<plugin>
<groupId>se.bjurr.gitchangelog</groupId>
<artifactId>git-changelog-maven-plugin</artifactId>
<version>1.40</version>
<version>1.55</version>
<executions>
<execution>
<id>GenerateGitChangelog</id>
Expand All @@ -59,7 +59,6 @@
<gitHubApi>https://api.github.com/repos/jenkinsci/git-changelog-plugin</gitHubApi>
<gitHubToken>${GITHUB_OAUTH2TOKEN}</gitHubToken>
<gitHubIssuePattern>#([0-9]*)</gitHubIssuePattern>
<filePath>CHANGELOG.md</filePath>
<templateContent>
<![CDATA[
# Git Changelog Plugin Changelog
Expand Down

0 comments on commit fea2826

Please sign in to comment.