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

showDependencies for ${CHANGES} doesn't seem to work

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I'm using the email-ext plugin and it works great except for this problem with "showDependencies".

      This is how I use it (I only use global configs for all jobs in email-ext, just triggers are set per job):
      ${CHANGES, showPaths=true, showDependencies=true}

      I have a 'build' project A that triggers 'unit test' project B, C and D. B, C and D are shown as "Downstream Projects" on project A's "Status" page.

      B and C are started by standard "Build other projects" post-build action of A.
      D is started by "Build other projects (extended)" post-build action of A if Build result is "Equal or over SUCCESS" and with "Trigger only if downstream project has SCM changes" - that is available due to https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin, version 2.21.

      When project B fails due to a change in project A's SCM, in the email I don't see the commits from project A that resulted in this failure, although "showDependencies" is true.

      Did I misunderstand what "showDependencies" is meant for or misused it? If that's not its purpose, then please consider this a feature req. to add the ability to have the changes from A above in email.

      Thanks.

      BTW: from token docs, it seems to me that you can't use "showDependencies" with ${CHANGES_SINCE_LAST_SUCCESS}, just with ${CHANGES}. Is that true? Cause that would be exactly what I want.

        Attachments

          Activity

          costescuandrei Andrei Costescu created issue -
          costescuandrei Andrei Costescu made changes -
          Field Original Value New Value
          Description I'm using the email-ext plugin and it works great except for this problem with "showDependencies".

          This is how I use it (I only use global configs for all jobs in email-ext, just triggers are set per job):
          ${CHANGES, showPaths=true, showDependencies=true}

          I have a 'build' project A that triggers 'unit test' project B, C and D. B, C and D are shown as "Downstream Projects" on project A's "Status" page.

          B and C are started by standard "Build other projects" post-build action of A.
          D is started by "Build other projects (extended)" post-build action of A if Build result is "Equal or over SUCCESS" and with "Trigger only if downstream project has SCM changes" - that is available due to https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin, version 2.21.

          When project B fails due to a change in project A's SCM, in the email I don't see the commits from project A that resulted in this failure, although "showDependencies" is true.

          Did I misunderstand what "showDependencies" it's mean for or misused it? If that's not it purpose, then please consider this a feature req. to add the ability to have the changes from A above in email.

          Thanks.

          BTW: from token docs, it seems to me that you can't use "showDependencies" with ${CHANGES_SINCE_LAST_SUCCESS}, just with ${CHANGES}. Is that true? Cause that would be exactly what I want.
          I'm using the email-ext plugin and it works great except for this problem with "showDependencies".

          This is how I use it (I only use global configs for all jobs in email-ext, just triggers are set per job):
          ${CHANGES, showPaths=true, showDependencies=true}

          I have a 'build' project A that triggers 'unit test' project B, C and D. B, C and D are shown as "Downstream Projects" on project A's "Status" page.

          B and C are started by standard "Build other projects" post-build action of A.
          D is started by "Build other projects (extended)" post-build action of A if Build result is "Equal or over SUCCESS" and with "Trigger only if downstream project has SCM changes" - that is available due to https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin, version 2.21.

          When project B fails due to a change in project A's SCM, in the email I don't see the commits from project A that resulted in this failure, although "showDependencies" is true.

          Did I misunderstand what "showDependencies" it's mean for or misused it? If that's not its purpose, then please consider this a feature req. to add the ability to have the changes from A above in email.

          Thanks.

          BTW: from token docs, it seems to me that you can't use "showDependencies" with ${CHANGES_SINCE_LAST_SUCCESS}, just with ${CHANGES}. Is that true? Cause that would be exactly what I want.
          costescuandrei Andrei Costescu made changes -
          Description I'm using the email-ext plugin and it works great except for this problem with "showDependencies".

          This is how I use it (I only use global configs for all jobs in email-ext, just triggers are set per job):
          ${CHANGES, showPaths=true, showDependencies=true}

          I have a 'build' project A that triggers 'unit test' project B, C and D. B, C and D are shown as "Downstream Projects" on project A's "Status" page.

          B and C are started by standard "Build other projects" post-build action of A.
          D is started by "Build other projects (extended)" post-build action of A if Build result is "Equal or over SUCCESS" and with "Trigger only if downstream project has SCM changes" - that is available due to https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin, version 2.21.

          When project B fails due to a change in project A's SCM, in the email I don't see the commits from project A that resulted in this failure, although "showDependencies" is true.

          Did I misunderstand what "showDependencies" it's mean for or misused it? If that's not its purpose, then please consider this a feature req. to add the ability to have the changes from A above in email.

          Thanks.

          BTW: from token docs, it seems to me that you can't use "showDependencies" with ${CHANGES_SINCE_LAST_SUCCESS}, just with ${CHANGES}. Is that true? Cause that would be exactly what I want.
          I'm using the email-ext plugin and it works great except for this problem with "showDependencies".

          This is how I use it (I only use global configs for all jobs in email-ext, just triggers are set per job):
          ${CHANGES, showPaths=true, showDependencies=true}

          I have a 'build' project A that triggers 'unit test' project B, C and D. B, C and D are shown as "Downstream Projects" on project A's "Status" page.

          B and C are started by standard "Build other projects" post-build action of A.
          D is started by "Build other projects (extended)" post-build action of A if Build result is "Equal or over SUCCESS" and with "Trigger only if downstream project has SCM changes" - that is available due to https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin, version 2.21.

          When project B fails due to a change in project A's SCM, in the email I don't see the commits from project A that resulted in this failure, although "showDependencies" is true.

          Did I misunderstand what "showDependencies" is meant for or misused it? If that's not its purpose, then please consider this a feature req. to add the ability to have the changes from A above in email.

          Thanks.

          BTW: from token docs, it seems to me that you can't use "showDependencies" with ${CHANGES_SINCE_LAST_SUCCESS}, just with ${CHANGES}. Is that true? Cause that would be exactly what I want.
          Hide
          slide_o_mix Alex Earl added a comment -

          CHANGES_SINCE_LAST_SUCCESS actually uses CHANGES for some things, I think showDependencies should work fine for CHANGES_SINCE_LAST_SUCCESS. Let me review the code for showDependencies, that was implemented before I took over the plugin.

          Show
          slide_o_mix Alex Earl added a comment - CHANGES_SINCE_LAST_SUCCESS actually uses CHANGES for some things, I think showDependencies should work fine for CHANGES_SINCE_LAST_SUCCESS. Let me review the code for showDependencies, that was implemented before I took over the plugin.
          Hide
          costescuandrei Andrei Costescu added a comment -

          Thanks for checking.

          Show
          costescuandrei Andrei Costescu added a comment - Thanks for checking.
          Hide
          slide_o_mix Alex Earl added a comment -

          This is what it does for showDependencies, I'm not real familiar with this code, so I can't comment on what exactly it should do

          for (Entry<AbstractProject, DependencyChange> e : build.getDependencyChanges(previousBuild).entrySet()) {
              buf.append("\n=======================\n");
              buf.append("\nChanges in ").append(e.getKey().getName())
                  .append(":\n");
              for (AbstractBuild<?, ?> b : e.getValue().getBuilds()) {
                  for (ChangeLogSet.Entry entry : b.getChangeSet()) {
                      Util.printf(buf, format, new ChangesSincePrintfSpec(entry, pathFormat, dateFormatter));
                  }
              }
          }
          
          Show
          slide_o_mix Alex Earl added a comment - This is what it does for showDependencies, I'm not real familiar with this code, so I can't comment on what exactly it should do for (Entry<AbstractProject, DependencyChange> e : build.getDependencyChanges(previousBuild).entrySet()) { buf.append( "\n=======================\n" ); buf.append( "\nChanges in " ).append(e.getKey().getName()) .append( ":\n" ); for (AbstractBuild<?, ?> b : e.getValue().getBuilds()) { for (ChangeLogSet.Entry entry : b.getChangeSet()) { Util.printf(buf, format, new ChangesSincePrintfSpec(entry, pathFormat, dateFormatter)); } } }
          slide_o_mix Alex Earl made changes -
          Summary [Email ext plugin] showDependencies for ${CHANGES} doesn't seem to work showDependencies for ${CHANGES} doesn't seem to work
          Hide
          dirk_hain Dirk Hain added a comment -

          I am running into a similar issue with

          Jenkins: 1.548
          email-ext: 2.37.2

          However, for me the email-ext plugin will return changes with dependencies IF the build ends with a FAILURE. If the build is unstable the changes will not be populated. Here are the settings I am using:

          ${CHANGES, showDependencies=true, format="[%a] %d, %r: %m
          n %p
          n"}

          Show
          dirk_hain Dirk Hain added a comment - I am running into a similar issue with Jenkins: 1.548 email-ext: 2.37.2 However, for me the email-ext plugin will return changes with dependencies IF the build ends with a FAILURE. If the build is unstable the changes will not be populated. Here are the settings I am using: ${CHANGES, showDependencies=true, format=" [%a] %d, %r: %m n %p n"}
          Hide
          slide_o_mix Alex Earl added a comment -

          showDependencies uses the following code:

          for (Entry<AbstractProject, DependencyChange> e : build.getDependencyChanges(previousBuild).entrySet()) {
              buf.append("\n=======================\n");
              buf.append("\nChanges in ").append(e.getKey().getName()).append(":\n");
              for (AbstractBuild<?, ?> b : e.getValue().getBuilds()) {
                  for (ChangeLogSet.Entry entry : b.getChangeSet()) {
                      Util.printf(buf, format, new ChangesSincePrintfSpec(entry, pathFormat, dateFormatter));
                  }
              }
          }
          

          AbstractBuild.getDependencyChanges returns an EMPTY Map if there is no Fingerprinter.FingerprintAction for the project. The showDependencies is all based on core Jenkins classes, so you'd need to determine if your projects are meeting the requirements for the dependency graph being populated.

          Show
          slide_o_mix Alex Earl added a comment - showDependencies uses the following code: for (Entry<AbstractProject, DependencyChange> e : build.getDependencyChanges(previousBuild).entrySet()) { buf.append( "\n=======================\n" ); buf.append( "\nChanges in " ).append(e.getKey().getName()).append( ":\n" ); for (AbstractBuild<?, ?> b : e.getValue().getBuilds()) { for (ChangeLogSet.Entry entry : b.getChangeSet()) { Util.printf(buf, format, new ChangesSincePrintfSpec(entry, pathFormat, dateFormatter)); } } } AbstractBuild.getDependencyChanges returns an EMPTY Map if there is no Fingerprinter.FingerprintAction for the project. The showDependencies is all based on core Jenkins classes, so you'd need to determine if your projects are meeting the requirements for the dependency graph being populated.
          Hide
          dirk_hain Dirk Hain added a comment -

          Thanks for your comment, Alex. I checked the dependency graph and it is populated correctly. However, in the job that has the test failures I am copying test artifacts around. Not sure if that is the problem, I enabled fingerprinting of the copied artifacts to no avail. The fact that the dependent changes are shown correctly IF the job does not complete (no tests run) but does not show dependent changes IF the job completes unstable (tests are run with some failing) indicates that the root cause could be the copying of files. I will try to investigate further and see if I can get it working.

          Show
          dirk_hain Dirk Hain added a comment - Thanks for your comment, Alex. I checked the dependency graph and it is populated correctly. However, in the job that has the test failures I am copying test artifacts around. Not sure if that is the problem, I enabled fingerprinting of the copied artifacts to no avail. The fact that the dependent changes are shown correctly IF the job does not complete (no tests run) but does not show dependent changes IF the job completes unstable (tests are run with some failing) indicates that the root cause could be the copying of files. I will try to investigate further and see if I can get it working.
          Hide
          dirk_hain Dirk Hain added a comment -

          Ok, I was able to resolve the issue by creating a correct chain of fingerprinting across my builds. The piece that was missing was that the build where I was not able to see dependent changes did not have a copy of the artifacts in the workspace. Although that particular build does not require the artifacts Jenkins needs them in the workspace to establish the connection that the build is dependent on a previous build that created the artifact. Since Jenkins does not support fingerprinting outside the workspace directory it is easiest just to use the "Copy artifacts from another build" option and tick the fingerprinting option.

          Show
          dirk_hain Dirk Hain added a comment - Ok, I was able to resolve the issue by creating a correct chain of fingerprinting across my builds. The piece that was missing was that the build where I was not able to see dependent changes did not have a copy of the artifacts in the workspace. Although that particular build does not require the artifacts Jenkins needs them in the workspace to establish the connection that the build is dependent on a previous build that created the artifact. Since Jenkins does not support fingerprinting outside the workspace directory it is easiest just to use the "Copy artifacts from another build" option and tick the fingerprinting option.
          Hide
          slide_o_mix Alex Earl added a comment -

          I think we can close this issue then, anyone opposed?

          Show
          slide_o_mix Alex Earl added a comment - I think we can close this issue then, anyone opposed?
          Hide
          dirk_hain Dirk Hain added a comment -

          Cool with me.

          Show
          dirk_hain Dirk Hain added a comment - Cool with me.
          Hide
          slide_o_mix Alex Earl added a comment -

          Please read Dirk's comments on how he got showDependencies=true to work.

          Show
          slide_o_mix Alex Earl added a comment - Please read Dirk's comments on how he got showDependencies=true to work.
          slide_o_mix Alex Earl made changes -
          Resolution Not A Defect [ 7 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Hide
          costescuandrei Andrei Costescu added a comment -

          Ok, I'll try it out.

          Show
          costescuandrei Andrei Costescu added a comment - Ok, I'll try it out.
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 152615 ] JNJira + In-Review [ 194287 ]

            People

            Assignee:
            slide_o_mix Alex Earl
            Reporter:
            costescuandrei Andrei Costescu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: