Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33301

git-changelog: specifying references

    XMLWordPrintable

Details

    Description

      Hi!

      It would be very helpful if the plugin could serve for generating changelog since last build / last successful build and so on.

      It would include specifying 'from' reference as 'last successful build' / ... and 'to' reference as 'current build'.

      Does it make sense? If I could be helpful with solving this ticket, please let me know.

      Attachments

        Activity

          Hi Martin,

          sure, this may make sense. But there is already a functionality in Jenkins showing you the changelog since the last build (not sure if you can tell him since last successful build though).
          I will have a look into this anyhow.

          This plugin is a combination of Thomas' and mine code, so there are two post build steps doing similar stuff, with different configuration and totally separated code behind, there is "Git changelog", "Publish git changelog" and "Publish JIRA filter".

          Which post build action are you using?

          paulwellnerbou Paul Wellner Bou added a comment - Hi Martin, sure, this may make sense. But there is already a functionality in Jenkins showing you the changelog since the last build (not sure if you can tell him since last successful build though). I will have a look into this anyhow. This plugin is a combination of Thomas' and mine code, so there are two post build steps doing similar stuff, with different configuration and totally separated code behind, there is "Git changelog", "Publish git changelog" and "Publish JIRA filter". Which post build action are you using?
          trainmaster Martin Kulich added a comment -

          Hi Paul,
          I know of the functionality Jenkins provides, however, it's not customizable in terms of specifying custom log format. I hoped I could use your plugin for that

          I'm using "Git changelog" post-build action as it seems the most customizable.

          trainmaster Martin Kulich added a comment - Hi Paul, I know of the functionality Jenkins provides, however, it's not customizable in terms of specifying custom log format. I hoped I could use your plugin for that I'm using "Git changelog" post-build action as it seems the most customizable.
          paulwellnerbou Paul Wellner Bou added a comment - - edited

          Sure, it is possible to do that.

          I will try to contact Tomas Bjerre, as this is his code. Although it would be cool to share at least part of the forms.
          If I find the time, I will have a look into it.

          paulwellnerbou Paul Wellner Bou added a comment - - edited Sure, it is possible to do that. I will try to contact Tomas Bjerre, as this is his code. Although it would be cool to share at least part of the forms. If I find the time, I will have a look into it.
          tomasbjerre Tomas Bjerre added a comment - - edited

          Are you using the Git Plugin? If so, you should be able to use the environment variables. Specify from commit as ${GIT_PREVIOUS_COMMIT} and to commit as ${GIT_COMMIT}

          https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin

          tomasbjerre Tomas Bjerre added a comment - - edited Are you using the Git Plugin? If so, you should be able to use the environment variables. Specify from commit as ${GIT_PREVIOUS_COMMIT} and to commit as ${GIT_COMMIT} https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin

          tomasbjerre: Sure, but that would not affect the "last build" or "last successful build".
          I am quite sure you can do this with a groovy script and https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin, at least as workaround, somehow.

          paulwellnerbou Paul Wellner Bou added a comment - tomasbjerre : Sure, but that would not affect the "last build" or "last successful build". I am quite sure you can do this with a groovy script and https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin , at least as workaround, somehow.
          tomasbjerre Tomas Bjerre added a comment -

          trainmaster: Is your problem solved with setting from GIT_PREVIOUS_COMMIT and to GIT_COMMIT?

          paulwellnerbou: I dont understand what you mean here. He wrote "It would include specifying 'from' reference as 'last successful build' / ... and 'to' reference as 'current build'.
          ". And the from/to fields are expanded (https://github.com/jenkinsci/git-changelog-plugin/blob/master/src/main/java/org/jenkinsci/plugins/gitchangelog/perform/GitChangelogPerformer.java#L157) so the variables from Git Plugin should be available. I interpret the issue as if he wants to have this changelog on the current build, which is the one building GIT_COMMIT.

          tomasbjerre Tomas Bjerre added a comment - trainmaster : Is your problem solved with setting from GIT_PREVIOUS_COMMIT and to GIT_COMMIT? paulwellnerbou : I dont understand what you mean here. He wrote "It would include specifying 'from' reference as 'last successful build' / ... and 'to' reference as 'current build'. ". And the from/to fields are expanded ( https://github.com/jenkinsci/git-changelog-plugin/blob/master/src/main/java/org/jenkinsci/plugins/gitchangelog/perform/GitChangelogPerformer.java#L157 ) so the variables from Git Plugin should be available. I interpret the issue as if he wants to have this changelog on the current build, which is the one building GIT_COMMIT.

          tomasbjerre: Maybe I am wrong: The GIT_PREVIOUS_COMMIT will expand to the previous commit (meaning HEAD^1), or to the commit of the last build of this same jenkins project? If the latter is the case, you would still have to find out the commit of the last successful build, if the last build wasn't.

          paulwellnerbou Paul Wellner Bou added a comment - tomasbjerre : Maybe I am wrong: The GIT_PREVIOUS_COMMIT will expand to the previous commit (meaning HEAD^1), or to the commit of the last build of this same jenkins project? If the latter is the case, you would still have to find out the commit of the last successful build, if the last build wasn't.
          tomasbjerre Tomas Bjerre added a comment -

          GIT_PREVIOUS_COMMIT is the previous built commit, so perhaps HEAD^1 but it can be any parent.

          Ok I see, i interpreted it as if he needed to have from as "successful" OR "not successful". Which is == true for GIT_PREVIOUS_COMMIT. He may use GIT_PREVIOUS_SUCCESSFUL_COMMIT to be sure that he uses the last successful.

          tomasbjerre Tomas Bjerre added a comment - GIT_PREVIOUS_COMMIT is the previous built commit, so perhaps HEAD^1 but it can be any parent. Ok I see, i interpreted it as if he needed to have from as "successful" OR "not successful". Which is == true for GIT_PREVIOUS_COMMIT. He may use GIT_PREVIOUS_SUCCESSFUL_COMMIT to be sure that he uses the last successful.

          Ok, thats great, didn't know this, will use this as well.
          Thanks.

          paulwellnerbou Paul Wellner Bou added a comment - Ok, thats great, didn't know this, will use this as well. Thanks.
          trainmaster Martin Kulich added a comment -

          Hi guys,
          thank you both for your comments. I will definitely try the way Tomas suggests, I wasn't aware of the variables.

          Maybe it would be helpful to mention it in docs?

          Thanks again!

          trainmaster Martin Kulich added a comment - Hi guys, thank you both for your comments. I will definitely try the way Tomas suggests, I wasn't aware of the variables. Maybe it would be helpful to mention it in docs? Thanks again!
          hujirong Jirong Hu added a comment -

          GIT_PREVIOUS_SUCCESSFUL_COMMIT is not available, I only see these in my Windows environment:

          GIT_BRANCH=origin/master
          GIT_COMMIT=a781fbc49bda7083ebc05e28cee60de4e4258b17
          GIT_PREVIOUS_COMMIT=a781fbc49bda7083ebc05e28cee60de4e4258b17
          GIT_URL=http://github.ooop.com/DevOps/Sample.git

          And I am having this issue: http://stackoverflow.com/questions/36016043/how-to-set-up-git-changelog-in-jenkins

          hujirong Jirong Hu added a comment - GIT_PREVIOUS_SUCCESSFUL_COMMIT is not available, I only see these in my Windows environment: GIT_BRANCH=origin/master GIT_COMMIT=a781fbc49bda7083ebc05e28cee60de4e4258b17 GIT_PREVIOUS_COMMIT=a781fbc49bda7083ebc05e28cee60de4e4258b17 GIT_URL= http://github.ooop.com/DevOps/Sample.git And I am having this issue: http://stackoverflow.com/questions/36016043/how-to-set-up-git-changelog-in-jenkins
          tomasbjerre Tomas Bjerre added a comment -

          I guess you are refering to the printout from "GIt Publisher". Try to use the variables in "Git Changelog" task.

          tomasbjerre Tomas Bjerre added a comment - I guess you are refering to the printout from "GIt Publisher". Try to use the variables in "Git Changelog" task.
          hujirong Jirong Hu added a comment - - edited

          tomasbjerre, All right, I figured out. I am using "Publish Git changelog", and there is another one called "Git changelog". Thanks.

          hujirong Jirong Hu added a comment - - edited tomasbjerre , All right, I figured out. I am using "Publish Git changelog", and there is another one called "Git changelog". Thanks.
          tomasbjerre Tomas Bjerre added a comment -

          No problem =)

          tomasbjerre Tomas Bjerre added a comment - No problem =)

          People

            trainmaster Martin Kulich
            trainmaster Martin Kulich
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: