{"id":21980004,"url":"https://github.com/jenkinsci/last-changes-plugin","last_synced_at":"2025-04-09T20:09:25.891Z","repository":{"id":37269858,"uuid":"63230428","full_name":"jenkinsci/last-changes-plugin","owner":"jenkinsci","description":"https://plugins.jenkins.io/last-changes","archived":false,"fork":false,"pushed_at":"2025-04-05T15:58:12.000Z","size":5604,"stargazers_count":32,"open_issues_count":14,"forks_count":31,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-09T20:09:17.337Z","etag":null,"topics":["adopt-this-plugin"],"latest_commit_sha":null,"homepage":"https://plugins.jenkins.io/last-changes/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenkinsci.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-13T08:51:52.000Z","updated_at":"2025-04-05T16:01:42.000Z","dependencies_parsed_at":"2024-06-20T11:00:54.077Z","dependency_job_id":"b77cffa5-4b36-4672-9ed0-2a3493ebaf3b","html_url":"https://github.com/jenkinsci/last-changes-plugin","commit_stats":{"total_commits":433,"total_committers":17,"mean_commits":"25.470588235294116","dds":0.25635103926097,"last_synced_commit":"567c7aad15632b956d49f08e26f492502c87142f"},"previous_names":[],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Flast-changes-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Flast-changes-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Flast-changes-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Flast-changes-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/last-changes-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103871,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adopt-this-plugin"],"created_at":"2024-11-29T17:09:01.882Z","updated_at":"2025-04-09T20:09:25.882Z","avatar_url":"https://github.com/jenkinsci.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Last Changes Plugin\n:toc: preamble\n:sectanchors:\n:sectlink:\n:numbered:\n:imagesdir: images\n:tip-caption: :bulb:\n:note-caption: :information_source:\n:important-caption: :heavy_exclamation_mark:\n:caution-caption: :fire:\n:warning-caption: :warning:\n\n[quote]\n____\nThe simplest way to know what has changed on your Jenkins builds!\n____\n\nLast Changes is a *Jenkin plugin* that shows _rich VCS diffs_ between builds.\n\nIMPORTANT: Only `Git` and `Svn` based projects are supported.\n\n== Introduction\n\nThe plugin uses https://diff2html.rtfpessoa.xyz/[diff2html^] to show last changes of a given build, example:\n\nimage::last-changes03.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/last-changes03.png]\n\nOr using side-by-side configuration:\n\nimage::last-changes05.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/last-changes05.png]\n\n\nNOTE: Last changes means `compare current repository revision with an old revision`. By default the plugin will diff current and previous revision.\n\n== Objectives\n\nThe main objective of this plugin is to have _fast_ access to what has changed on a Jenkins build.\n\nAnother interesting aspect is that it can easily help to find the `root cause` of a `failing build` by highlighting what has changed.\n\nAnd finally the plugin _shines_ in a https://en.wikipedia.org/wiki/Continuous_delivery[*continuous delivery*^] environment, where each _commit_ generates a release candidate.\n\n\n== How it works?\n\n. This plugin expects `.git` or `.svn` folders present on your build workspace and will use it to retrieve repository information .\n. While your job runs the plugin reads your build workspace to retrieve the current VCS revision;\n. The diff between `actual` and a `previous` revision will be stored; Note that the `previous revision` can be:\n+\n* A provided revision id;\n* Revision of `Last successful build`;\n* Revision of an specific build;\n* Revision of `Last tag`;\n+\nNOTE: By default previous revision is `current revision -1`.\n+\nTIP: You can use https://wiki.jenkins.io/display/JENKINS/Parameterized+Build[parameters] in `specificRevision` parameter. In case of git, expressions like `HEAD^{tree}` or `HEAD^^` can be used.\n. The `diff` for each build can be viewed later in html format.\n\nIMPORTANT: To get most from this plugin use `periodically SCM polling` to trigger your builds, http://www.nailedtothex.org/roller/kyle/entry/articles-jenkins-poll[more details here^].\n\n\n== Usage\n\nAfter installation just activate the post build action named *Publish Last Changes*.\n\n. Activate build action\n+\nimage:last-changes-activation.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/last-changes-activation.png]\n. Last changes menu should be available\n+\nimage:last-changes01.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/last-changes01.png]\n. Build changes history\n+\nimage:last-changes02.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/last-changes02.png]\n. Last changes menu is available for builds that published changes\n+\nimage:last-changes04.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/last-changes-config.png]\n\n\n[TIP]\n====\nSince version `2.3` the *commits between revisions* are listed as below:\n\nimage:commits.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/commits.png]\n\nYou can also see what has changed on a specific commit by clicking on it:\n\nimage:commit-changes.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/commit-changes.png]\n\n====\n\n== Configuration\n\nThe setup is done via `build configuration`:\n\nimage:last-changes-config.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/last-changes-config.png]\n\nThe possible values for *Since* attribute is `Previous revision` (the default), `Last successful build` and `Last tag`.\n\nIMPORTANT: If *SpecificRevision* parameter is provided then *Since* configuration will be ignored and the diff will be done with provided revision id.\n\nAdvanced configuration reflects https://github.com/rtfpessoa/diff2html#diff2html-configuration[diff2html options^]:\n\nimage:last-changes-config2.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/last-changes-config2.png]\n\n\n== Jenkins pipeline step\n\nFollowing is an example of pipeline step using this plugin:\n\n----\nnode {\n      stage ('Build') {\n           svn 'https://subversion.assembla.com/svn/cucumber-json-files/trunk/'\n           step([$class: 'LastChangesPublisher', since:'PREVIOUS_REVISION',specificRevision: '', format: 'LINE', matchWordsThreshold: '0.25', matching: 'NONE', matchingMaxComparisons: '1000', showFiles: true, synchronisedScroll: true])\n\n      }\n\n}\n----\n\n\n=== Pipeline DSL\n\nSince version `1.0.10` it is possible to use the _lastChanges()_ shortcut in pipeline DSL:\n\n----\nnode {\n     git 'https://github.com/jenkinsci/last-changes-plugin.git'\n     lastChanges() //will use defaults\n}\n----\n\nParameters should be declared as `key: 'value'` as example below:\n\n----\nnode {\n     git 'https://github.com/jenkinsci/last-changes-plugin.git'\n     lastChanges format:'SIDE', matching: 'WORD', specificRevision: '156e2508a31d8835ec4e5ba7e206ecd2e406f202'\n}\n----\n\nOr using https://jenkins.io/doc/book/pipeline/syntax/[declarative pipeline^]:\n\n----\npipeline {\n    agent any\n    stages {\n        stage('Checkout') {\n            steps {\n                git 'https://github.com/jenkinsci/last-changes-plugin.git'\n                lastChanges since: 'LAST_SUCCESSFUL_BUILD', format:'SIDE', matching: 'LINE'\n            }\n        }\n    }\n}\n----\n\nOr using build params for `specificRevision`:\n\n----\npipeline {\n    agent any\n    stages {\n        stage('Checkout') {\n            steps {\n                git 'https://github.com/jenkinsci/last-changes-plugin.git'\n                lastChanges format:'SIDE', matching: 'WORD', specificRevision: \"${REV}\"\n            }\n        }\n    }\n}\n----\n\nTIP: Refer to https://wiki.jenkins.io/display/JENKINS/Parameterized+Build[parameterized builds^] to use parameters.\n\n=== Pipeline scripting\n\nSince https://github.com/jenkinsci/last-changes-plugin/releases/tag/2.5[v2.5^] is possible to invoke LastChanges inside groovy script, instead of just declaring it \u003c\u003cPipeline DSL, as we saw above\u003e\u003e. See example below:\n\n```\nnode {\n      stage(\"checkout\") {\n        git url: 'https://github.com/jenkinsci/last-changes-plugin.git'\n      }\n\n      stage(\"last-changes\") {\n        def publisher = LastChanges.getLastChangesPublisher \"PREVIOUS_REVISION\", \"SIDE\", \"LINE\", true, true, \"\", \"\", \"\", \"\", \"\"\n              publisher.publishLastChanges()\n              def changes = publisher.getLastChanges()\n              println(changes.getEscapedDiff())\n              for (commit in changes.getCommits()) {\n                  println(commit)\n                  def commitInfo = commit.getCommitInfo()\n                  println(commitInfo)\n                  println(commitInfo.getCommitMessage())\n                  println(commit.getChanges())\n              }\n      }\n\n}\n```\n\nNOTE: See https://github.com/jenkinsci/last-changes-plugin/blob/master/src/main/java/com/github/jenkins/lastchanges/model[model classes^] to know what can be accessed in pipeline script. Note that only attributes https://github.com/jenkinsci/last-changes-plugin/blob/master/src/main/java/com/github/jenkins/lastchanges/model/LastChanges.java#L48[annotated with @Whitelisted^] are visible to be accessed in pipeline script.\n\nTIP: If you use declarative pipeline you can use https://jenkins.io/doc/book/pipeline/syntax/#script[script section^].\n\n\n== Download the diff\n\nYou can also download the diff as `DIFF` or `HTML`. The download links are on the `bottom right` corner of the page:\n\nimage::diff-download.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/diff-download.png]\n\n\n== Sending the diff as email\n\nUsing https://wiki.jenkins.io/display/JENKINS/Email-ext+plugin[email ext plugin^] and \u003c\u003cPipeline scripting\u003e\u003e we can send the diff as an email attachment, see example below:\n\n. Diff in *plain text*\n+\n----\npipeline {\n    agent any\n    stages {\n        stage('Checkout') {\n            steps {\n                git url: 'https://github.com/jenkinsci/last-changes-plugin'\n            }\n        }\n        stage(\"send diff\") {\n            steps {\n                script {\n                    def publisher = LastChanges.getLastChangesPublisher null, \"SIDE\", \"LINE\", true, true, \"\", \"\", \"\", \"\", \"\"\n                    publisher.publishLastChanges()\n                    def diff = publisher.getDiff()\n                    writeFile file: 'build.diff', text: diff\n                    emailext (\n                      subject: \"Jenkins - changes of ${env.JOB_NAME} #${env.BUILD_NUMBER}\",\n                      attachmentsPattern: '**/*.diff',\n                      mimeType: 'text/html',\n                      body: \"\"\"\u003cp\u003eSee attached diff of \u003cb\u003e${env.JOB_NAME} #${env.BUILD_NUMBER}\u003c/b\u003e.\u003c/p\u003e\n                        \u003cp\u003eCheck build changes on Jenkins \u003cb\u003e\u003ca href=\"${env.BUILD_URL}/last-changes\"\u003ehere\u003c/a\u003e\u003c/b\u003e.\u003c/p\u003e\"\"\",\n                      to: \"YOUR-EMAIL@gmail.com\"\n                    )\n\n               }\n\n            }\n        }\n    }\n}\n----\n. Diff in *Html format*\n+\n----\npipeline {\n    agent any\n    stages {\n        stage('Send html diff') {\n            steps {\n                git 'https://github.com/jenkinsci/last-changes-plugin.git'\n                script {\n                  def publisher = LastChanges.getLastChangesPublisher \"PREVIOUS_REVISION\", \"SIDE\", \"LINE\", true, true, \"\", \"\", \"\", \"\", \"\"\n                  publisher.publishLastChanges()\n                  def htmlDiff = publisher.getHtmlDiff()\n                  writeFile file: 'build-diff.html', text: htmlDiff\n                    emailext (\n                      subject: \"Jenkins - changes of ${env.JOB_NAME} #${env.BUILD_NUMBER}\",\n                      attachmentsPattern: '**/*build-diff.html',\n                      mimeType: 'text/html',\n                      body: \"\"\"\u003cp\u003eSee attached diff of build \u003cb\u003e${env.JOB_NAME} #${env.BUILD_NUMBER}\u003c/b\u003e.\u003c/p\u003e\n                        \u003cp\u003eCheck build changes on Jenkins \u003cb\u003e\u003ca href=\"${env.BUILD_URL}/last-changes\"\u003ehere\u003c/a\u003e\u003c/b\u003e.\u003c/p\u003e\"\"\",\n                      to: \"YOUR-EMAIL@gmail.com\" )\n                } //end script\n            }\n        }\n    }\n}\n----\n\n== Running it locally\n\nFollowing are the steps to `run, debug and test` this plugin on your machine:\n\n. Clone this repository\n+\n----\n\ngit clone http://github.com/jenkinsci/last-changes-plugin\n----\n. Import it on your IDE\n. Run the command *mvnDebug hpi:run -DskipTests*\n. Configure the remote debugging on your IDE to use port 8000, as in image below:\n+\nimage:last-changes-debug.png[link=https://raw.githubusercontent.com/jenkinsci/last-changes-plugin/master/images/last-changes-debug.png]\n\n. Access `http://localhost:8080/jenkins`\n\nNow create jobs using last-changes and debug them.\n\nFor testing run any class on `src/test/java` folder as JUnit test.\n\nNOTE: Tests with `IT` suffix will start a Jenkins instance before the test.\n\n[TIP]\n====\nTo generate the binary of the plugin run:\n\n----\nmvn clean package -DskipTests\n----\n\nIt will generate `last-changes.hpi` in target folder. You can install it on jenkins via upload in `jenkins/pluginManager`.\n====\n\n== Contributing\n\nSee https://github.com/jenkinsci/last-changes-plugin/wiki/Contributors-guide[contributors guide^].\n\n== Change Log\n\nPlease follow https://github.com/jenkinsci/last-changes-plugin/releases[releases page^] for details of each release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Flast-changes-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Flast-changes-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Flast-changes-plugin/lists"}