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

IvyTrigger is not triggering when modified (already existing) artifact is uploaded to remote artifactory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • ivytrigger-plugin
    • Jenkins 2.204.5, tested also on version 2.121.1
      IvyTrigger 0.34
      Artifactory 5.2.1

      IvyTrigger trigger output after uploading updated artifact to remote artifactory: 

      Resolving Ivy dependencies.
      	---------------------------------------------------------------------
      	|                  |            modules            ||   artifacts   |
      	|       conf       | number| search|dwnlded|evicted|| number|dwnlded|
      	---------------------------------------------------------------------
      	|        lib       |   1   |   1   |   0   |   0   ||   1   |   1   |
      	---------------------------------------------------------------------
      Resolved dependency tools#testNew;1.0.0-SNAPSHOT 
      ...Checking comparison to previous recorded dependencies.
      Checking previous recording dependency tools#testNew;1.0.0-SNAPSHOT
      ...Checking comparison to previous recorded artifacts.
      Polling complete. Took 0.94 sec.
      No changes.
      

      As new or updated artifact is present, ivy downloaded it (as seen in output - artifacts dwnlded 1), it can be also found on local file system, BUT job is not triggered (modification date comparison should follow, but it doesnt)

       

      Possibly, the reason could be using dependencyNode.isDownloaded() added in 0.34 version (in IvyTriggerEvaluator getMapDependencies method), which is not used to indicate whether the artifacts were downloaded, but the whole module (which is not)...so isDownloaded() is false even if artifact was downloaded, related ivy ticket (old, but described the same in the comment): https://issues.apache.org/jira/browse/IVY-320?jql=project%20%3D%20IVY%20AND%20text%20~%20%22downloaded%22

      Therefore, no comparison of modification date is performed. 

       

      ResultReport update after downloading artifacts, Ivy code snippet: 

      report.getConfigurationReport(dconf).addDependency(dependency,dReport);

      Information about download success of artifacts are stored in ArtifactDownloadReport, which is in dReport.

      Following code produces true, and could be used in plugin instead of dependencyNode.isDownloaded()

      resolveReport.getConfigurationReport(dependencyNode.getRootModuleConfigurations()[0]).getDownloadReports(moduleRevisionId)[0].isDownloaded());
      

      Also, if downloading from remote Artifactory, downloaded artifacts are considered NOT local, and modification date of ArtifactOrigin used is always 0. Related ticket: JENKINS-24950

      Instead, local file from ArtifactDownloadReport could be used:

      File localFile = resolveReport.getConfigurationReport(dependencyNode.getRootModuleConfigurations()[0]).getDownloadReports(moduleRevisionId)[0].getLocalFile; 
      
      localFile.getAbsolutePath();  // C:\...\Jenkins\...\testNew-1.0.0-SNAPSHOT.jar
      localFile.lastModified(); // 1585639081000
      

       

       

            stealthdj Tony Noble
            horec123 Peter Horecny
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: