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

When Updating JIRA Comments mentionedInCommitStrategy does not pick up on JIRA not specified on first line of commit

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • jira-ext-plugin
    • None

      The class AbstractParsingIssueStrategy uses:

      ChangeLogSet changeSets = build.getChangeSet();

      The class that represents the ChangeLogSet is:

      ChangeLogSet class: class hudson.plugins.git.GitChangeSetList

      which is output in the build.

       

      In the GitChangeSet class getMsg returns the title or the first line of the commit 

      @Exported
      public String getMsg() {
       return this.title;
      }

      Which is what is used in MentionedInCommitStrategy:

       

      @Override
      public List<JiraCommit> getJiraIssuesFromChangeSet(final ChangeLogSet.Entry change)
      {
       final List<JiraCommit> result = new ArrayList<>();
       final List<String> foundTickets = new ArrayList<>();
      
       for (String validJiraPrefix : Config.getGlobalConfig().getJiraTickets())
       {
       String msg = change.getMsg();
      ...
      

       

      The problem is our git commit standards specify having the JIRA at the end, for example:

       

      Upgraded Docker Image
      See JAS-1234
      

       

      so what is getting passed is the first line, and the mentionedInCommitStrategy does not pick up any JIRA.

      Perhaps if the ChangeLogSet.Entry class in jenkins cored exposed getComment this could be used instead in mentionedInCommitStrategy. 

       

       

          [JENKINS-49143] When Updating JIRA Comments mentionedInCommitStrategy does not pick up on JIRA not specified on first line of commit

          Ben Kletzine created issue -
          Ben Kletzine made changes -
          Description Original: Using the mentionedInCommitStrategy does not search the entire changelog from stash. The screenshot shows an example of where the JIRA issue is found but if the JIRA is on a seperate line it will not be found. I seen a related issue about the regex perhaps this is the culprit? I tried setting up a Logger in Jenkins but not getting any exceptions or errors. 

           

          The global configuration is correct, all the prefixes are defined. The JIRA ext plugin is correctly configured with the job dsl plugin code. 

           
          New: Using the mentionedInCommitStrategy does not search the entire changelog from stash. The screenshot shows an example of where the JIRA issue is found and works correclty but if the JIRA is on a seperate line it will not be found. I seen a related issue about the regex perhaps this is the culprit? I tried setting up a Logger in Jenkins but not getting any exceptions or errors. 

           

          The global configuration is correct, all the prefixes are defined. The JIRA ext plugin is correctly configured with the job dsl plugin code. 

           

          An example where the it won't work

           

          Added tests

          See JAS-1234

           

          Ben Kletzine added a comment -

          Just realized that maybe there is an issue with a git related plugin will also investigate 

          Ben Kletzine added a comment - Just realized that maybe there is an issue with a git related plugin will also investigate 
          Ben Kletzine made changes -
          Description Original: Using the mentionedInCommitStrategy does not search the entire changelog from stash. The screenshot shows an example of where the JIRA issue is found and works correclty but if the JIRA is on a seperate line it will not be found. I seen a related issue about the regex perhaps this is the culprit? I tried setting up a Logger in Jenkins but not getting any exceptions or errors. 

           

          The global configuration is correct, all the prefixes are defined. The JIRA ext plugin is correctly configured with the job dsl plugin code. 

           

          An example where the it won't work

           

          Added tests

          See JAS-1234

           
          New: The class AbstractParsingIssueStrategy uses:
          {code:java}
          ChangeLogSet changeSets = build.getChangeSet();{code}
          The class that represents the ChangeLogSet is:
          ChangeLogSet class: class hudson.plugins.git.GitChangeSetList
          which is output in the build.

           

          In the GitChangeSet class getMsg returns the title or the first line of the commit 
          {code:java}
          @Exported
          public String getMsg() {
           return this.title;
          }{code}
          Which is what is used in MentionedInCommitStrategy:

           
          {code:java}
          @Override
          public List<JiraCommit> getJiraIssuesFromChangeSet(final ChangeLogSet.Entry change)
          {
           final List<JiraCommit> result = new ArrayList<>();
           final List<String> foundTickets = new ArrayList<>();

           for (String validJiraPrefix : Config.getGlobalConfig().getJiraTickets())
           {
           String msg = change.getMsg();
          ...
          {code}
           

          The problem is our git commit standards specify having the JIRA at the end, for example:

           
          {code:java}
          Upgraded Docker Image
          See JAS-1234
          {code}
           

          so what is getting passed is the first line, and the mentionedInCommitStrategy does not pick up any JIRA.

          Perhaps if the ChangeLogSet.Entry class in jenkins cored exposed getComment this could be used instead in mentionedInCommitStrategy. 

           

           
          Ben Kletzine made changes -
          Summary Original: Using mentionInCommitStrategy does not search the entire changelog New: When Updating JIRA Comments mentionedInCommitStrategy does not pick up on JIRA not specified on first line of commit
          Ben Kletzine made changes -
          Description Original: The class AbstractParsingIssueStrategy uses:
          {code:java}
          ChangeLogSet changeSets = build.getChangeSet();{code}
          The class that represents the ChangeLogSet is:
          ChangeLogSet class: class hudson.plugins.git.GitChangeSetList
          which is output in the build.

           

          In the GitChangeSet class getMsg returns the title or the first line of the commit 
          {code:java}
          @Exported
          public String getMsg() {
           return this.title;
          }{code}
          Which is what is used in MentionedInCommitStrategy:

           
          {code:java}
          @Override
          public List<JiraCommit> getJiraIssuesFromChangeSet(final ChangeLogSet.Entry change)
          {
           final List<JiraCommit> result = new ArrayList<>();
           final List<String> foundTickets = new ArrayList<>();

           for (String validJiraPrefix : Config.getGlobalConfig().getJiraTickets())
           {
           String msg = change.getMsg();
          ...
          {code}
           

          The problem is our git commit standards specify having the JIRA at the end, for example:

           
          {code:java}
          Upgraded Docker Image
          See JAS-1234
          {code}
           

          so what is getting passed is the first line, and the mentionedInCommitStrategy does not pick up any JIRA.

          Perhaps if the ChangeLogSet.Entry class in jenkins cored exposed getComment this could be used instead in mentionedInCommitStrategy. 

           

           
          New: The class AbstractParsingIssueStrategy uses:
          {code:java}
          ChangeLogSet changeSets = build.getChangeSet();{code}
          The class that represents the ChangeLogSet is:
          {code:java}
          ChangeLogSet class: class hudson.plugins.git.GitChangeSetList{code}

           which is output in the build.

           

          In the GitChangeSet class getMsg returns the title or the first line of the commit 
          {code:java}
          @Exported
          public String getMsg() {
           return this.title;
          }{code}
          Which is what is used in MentionedInCommitStrategy:

           
          {code:java}
          @Override
          public List<JiraCommit> getJiraIssuesFromChangeSet(final ChangeLogSet.Entry change)
          {
           final List<JiraCommit> result = new ArrayList<>();
           final List<String> foundTickets = new ArrayList<>();

           for (String validJiraPrefix : Config.getGlobalConfig().getJiraTickets())
           {
           String msg = change.getMsg();
          ...
          {code}
           

          The problem is our git commit standards specify having the JIRA at the end, for example:

           
          {code:java}
          Upgraded Docker Image
          See JAS-1234
          {code}
           

          so what is getting passed is the first line, and the mentionedInCommitStrategy does not pick up any JIRA.

          Perhaps if the ChangeLogSet.Entry class in jenkins cored exposed getComment this could be used instead in mentionedInCommitStrategy. 

           

           
          Oleg Nenashev made changes -
          Link New: This issue relates to JENKINS-49202 [ JENKINS-49202 ]

          benkletzine so if issue resolved close it please. Because it was found by open issues

          Egor Voronyansky added a comment - benkletzine so if issue resolved close it please. Because it was found by open issues

            dalvizu Dan Alvizu
            benkletzine Ben Kletzine
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: