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

Copy Artifact's fingerprinting creates second hudson.tasks.Fingerprinter_-FingerprintAction section with just the artifacts copied

    XMLWordPrintable

Details

    Description

      Automatic fingerprinting by Copy Artifact plugin leads to doubled hudson.tasks.Fingerprinter_-FingerprintAction entry in build.xml. One is original fingerprinting by the job (second in the provided file snip) - with all the desired files fingerprinted - and the other comes from Copy Artifact invocation (first in the file provided) that fingerprinted just the artifact copied in the operation.

      Observed wrong behavior:
      Outcome is that two 'See fingerprints' are shown on a build page (both with the same correct url) and the 'Recorded Fingerprints' page shows recorded fingerprints from the first tag only (in build.xml file order).

      Desired behavior:
      All fingerprints for the build are shown on the 'Recorded Fingerprints' page and there is only one 'See fingerprints' link on the build page. From the technical POV (completely not sure as I did no Jenkins dev before) Copy Artifacts' fingerprinting invocation should merge its results into the existing FingerprintAction.

      build.xml

          <hudson.tasks.Fingerprinter_-FingerprintAction>
            <build class="build" reference="../../.."/>
            <record>
              <entry>
                <string>setup-13.0.1-SNAPSHOT-main.zip</string>
                <string>b631114a7f7d32eeb2a6f0957d768593</string>
              </entry>
            </record>
          </hudson.tasks.Fingerprinter_-FingerprintAction>
          <hudson.tasks.Fingerprinter_-FingerprintAction>
            <build class="build" reference="../../.."/>
            <record>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>8fca7e0f1dddc22e7c04f32b90392a90</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>cdbe8262c397ac0c247e4b11cd513807</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>174868b4b6f47540731aaeff4d5152bb</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>7ecd1d6cb0b2f167a5fdb58cecd0807b</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>6bbda9e72234c4423b5fc73477e7767b</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>269e6262984ce79d18af54009485d9e8</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>b01e557b6568b89501a9f50e68e89744</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>646180a22ecbe46592b073ec6371eeac</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>7c564e97d354e6307ddd6d88e332e874</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>5f3848e6c268a402ea89c37fc5100118</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>d65852828ba49e738db4a2c433f9c902</string>
              </entry>
              <entry>
                <string>build\artifacts\[...snip...]</string>
                <string>7282d44469efae422994988876a0a4f6</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>9e691b924e586e4bbef5afd974b91355</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>d443b4b3e4dd6c92048d48d4afd26fcf</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>f3fe703d7e3323d56b366cd4f2aa2546</string>
              </entry>
              <entry>
                <string>build\target\dependency\[...snip...]</string>
                <string>6577c771a412742f053530efcc65fe12</string>
              </entry>
            </record>
          </hudson.tasks.Fingerprinter_-FingerprintAction>
      

      Attachments

        Issue Links

          Activity

            Ok, this seems more tricky. The problem occurs when CopyArtifact is done in a job invoked in a non-blocking manner from the main job:

              (A) main job
               (B) |-> parametrized trigger action as Build step
                (C) |-> Copy Artifacts from job (A)
            

            What I see in code is that FingerprintingCopyMethod:116 checks if there is FingerprintAction already for the Build or not and handles it fine:

            FingerprintAction fa = r.getAction(FingerprintAction.class);
            if (fa != null) fa.add(fingerprints);
            else            r.getActions().add(new FingerprintAction(r, fingerprints));
            

            On the other hand if CopyArtifact is called earlier for the Build, Fingerprinter task does not check if the FingerprintAction was present or not and adds the second instance (see Fingerprinter.java:136).

            Is it correct approach just to mimic the CopyArtifact behavior and check for previously added FingerprintAction?

            maciasello Maciej Ligenza added a comment - Ok, this seems more tricky. The problem occurs when CopyArtifact is done in a job invoked in a non-blocking manner from the main job: (A) main job (B) |-> parametrized trigger action as Build step (C) |-> Copy Artifacts from job (A) What I see in code is that FingerprintingCopyMethod:116 checks if there is FingerprintAction already for the Build or not and handles it fine: FingerprintAction fa = r.getAction(FingerprintAction.class); if (fa != null) fa.add(fingerprints); else r.getActions().add(new FingerprintAction(r, fingerprints)); On the other hand if CopyArtifact is called earlier for the Build, Fingerprinter task does not check if the FingerprintAction was present or not and adds the second instance (see Fingerprinter.java:136 ). Is it correct approach just to mimic the CopyArtifact behavior and check for previously added FingerprintAction?
            marcsanfacon Marc Sanfacon added a comment -

            I changed the priority from Critical to minor since I don't think this is blocking.

            I am no Jenkins dev expert either. I did this extension because I needed to create the fingerprints before the end of the build. The only thing this plugin does is called the fingerprint base methods in Jenkins.

            As you describes, maybe the fingerprint methods in Jenkins does not handle well the non-blocking calls?

            marcsanfacon Marc Sanfacon added a comment - I changed the priority from Critical to minor since I don't think this is blocking. I am no Jenkins dev expert either. I did this extension because I needed to create the fingerprints before the end of the build. The only thing this plugin does is called the fingerprint base methods in Jenkins. As you describes, maybe the fingerprint methods in Jenkins does not handle well the non-blocking calls?

            This may not be blocking, but in very large teams, having to explain this does not help me build trust in the Jenkins.

            deepchip Martin d'Anjou added a comment - This may not be blocking, but in very large teams, having to explain this does not help me build trust in the Jenkins.
            kutzi kutzi added a comment -

            I've you think that a change to Jenkins' core Fingerprinter would fix the issue, feel free to create a pull request with a fix.

            kutzi kutzi added a comment - I've you think that a change to Jenkins' core Fingerprinter would fix the issue, feel free to create a pull request with a fix.

            Code changed in jenkins
            User: Stefan Wolf
            Path:
            changelog.html
            core/src/main/java/hudson/tasks/Fingerprinter.java
            test/src/test/java/hudson/tasks/FingerprinterTest.java
            http://jenkins-ci.org/commit/jenkins/be7a97ee32b57dcb27b8fd6c908ebbe451220902
            Log:
            [FIXED JENKINS-17606] Reuse existing fingerprint action if present.
            Prevents multiple FingerprintActions.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stefan Wolf Path: changelog.html core/src/main/java/hudson/tasks/Fingerprinter.java test/src/test/java/hudson/tasks/FingerprinterTest.java http://jenkins-ci.org/commit/jenkins/be7a97ee32b57dcb27b8fd6c908ebbe451220902 Log: [FIXED JENKINS-17606] Reuse existing fingerprint action if present. Prevents multiple FingerprintActions.

            Code changed in jenkins
            User: Stefan Wolf
            Path:
            changelog.html
            core/src/main/java/hudson/tasks/Fingerprinter.java
            test/src/test/java/hudson/tasks/FingerprinterTest.java
            http://jenkins-ci.org/commit/jenkins/cd0b3c7afebdb6c2fb74ff0ed81656b8ebf02c77
            Log:
            Merge pull request #1113 from wolfs/fingerprint

            [FIXED JENKINS-17606] Reuse existing fingerprint action if present.

            Compare: https://github.com/jenkinsci/jenkins/compare/931d2960e9eb...cd0b3c7afebd

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stefan Wolf Path: changelog.html core/src/main/java/hudson/tasks/Fingerprinter.java test/src/test/java/hudson/tasks/FingerprinterTest.java http://jenkins-ci.org/commit/jenkins/cd0b3c7afebdb6c2fb74ff0ed81656b8ebf02c77 Log: Merge pull request #1113 from wolfs/fingerprint [FIXED JENKINS-17606] Reuse existing fingerprint action if present. Compare: https://github.com/jenkinsci/jenkins/compare/931d2960e9eb...cd0b3c7afebd
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #3192
            [FIXED JENKINS-17606] Reuse existing fingerprint action if present. (Revision be7a97ee32b57dcb27b8fd6c908ebbe451220902)

            Result = SUCCESS
            Stefan Wolf : be7a97ee32b57dcb27b8fd6c908ebbe451220902
            Files :

            • test/src/test/java/hudson/tasks/FingerprinterTest.java
            • changelog.html
            • core/src/main/java/hudson/tasks/Fingerprinter.java
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #3192 [FIXED JENKINS-17606] Reuse existing fingerprint action if present. (Revision be7a97ee32b57dcb27b8fd6c908ebbe451220902) Result = SUCCESS Stefan Wolf : be7a97ee32b57dcb27b8fd6c908ebbe451220902 Files : test/src/test/java/hudson/tasks/FingerprinterTest.java changelog.html core/src/main/java/hudson/tasks/Fingerprinter.java

            Code changed in jenkins
            User: Stefan Wolf
            Path:
            core/src/main/java/hudson/tasks/Fingerprinter.java
            test/src/test/java/hudson/tasks/FingerprinterTest.java
            http://jenkins-ci.org/commit/jenkins/1c847ccb5cdd92d36cc9344482247d6d86cff7df
            Log:
            [FIXED JENKINS-17606] Reuse existing fingerprint action if present.
            Prevents multiple FingerprintActions.

            (cherry picked from commit be7a97ee32b57dcb27b8fd6c908ebbe451220902)

            Conflicts:
            changelog.html
            core/src/main/java/hudson/tasks/Fingerprinter.java
            test/src/test/java/hudson/tasks/FingerprinterTest.java

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stefan Wolf Path: core/src/main/java/hudson/tasks/Fingerprinter.java test/src/test/java/hudson/tasks/FingerprinterTest.java http://jenkins-ci.org/commit/jenkins/1c847ccb5cdd92d36cc9344482247d6d86cff7df Log: [FIXED JENKINS-17606] Reuse existing fingerprint action if present. Prevents multiple FingerprintActions. (cherry picked from commit be7a97ee32b57dcb27b8fd6c908ebbe451220902) Conflicts: changelog.html core/src/main/java/hudson/tasks/Fingerprinter.java test/src/test/java/hudson/tasks/FingerprinterTest.java

            People

              wolfs Stefan Wolf
              maciasello Maciej Ligenza
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: