jenkinsjenkins-pipelinejenkins-groovyjenkins-github-plugin

Calculate changelog against a commit in jenkins using git-plugin


I am using Jenkins Git-Plugin to checkout in my CI pipeline. I want to generate changelog between the COMMIT and a predefined REF_COMMIT.

Is there a way to achieve this using changelog-extensions? I can see there is option to calculate change log against branch (refs/remote/branch) but nothing written for commits.

Is there any other way i can show the changelogs as git-plugin does in the build without using this changelog-extenstions?


Solution

  • This is a git question per se, not a Jenkins question.

    The following may work for you:

    git whatchanged --no-abbrev -M "--format=commit %H%ntree %T%nparent %P%nauthor %aN <%aE> %ai%ncommitter %cN <%cE> %ci%n%n%w(76,4,4)%s%n%n%b" -n 1024 ${COMMIT} ^${REF_COMMIT}
    

    To use it in Jenkins, wrap the above in sh "..." while in script.