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

Copy artifacts via permalink doesn't work from a promotion action

XMLWordPrintable

      Hi,

      we've encountered a problem when working with the promoted builds plugin and copy artifacts to copy via permalink.
      the failure is due to copying 0 artifacts while not being optional.

      i've debugged and fixed it in a private patch, and the suggested fix appears to be working and is shown below.

      details follow.

      the promotion plugin apparently introduces a fictitious project type "PromotionProcess" and it's corresponding build element "Promotion".
      when you define actions with the "promote this build when ..." checkbox they are actually transformed into build steps of the relevant PromotionProcess instance.
      this means that if you choose to Archive Artifacts as the promotion Action, they are stored not in the build of the project, but in the Promotion (build) of the tied PromotionProcess of the actual job.
      later on, copy artifact tries to copy via permalink. permalinks always point to builds, and the permalink published by the "promote builds" plugin references the actual job build and not the tied Promotion build. so when you try to copy the artifacts with it, the artifacts are not found - they're not there, it's the wrong build.
      the solution is to modify the code in class PromotionProcess in method asPermalink()
      replace the "return build;" statement with...

      final List<Promotion> promotionBuilds = a.getPromotionBuilds(PromotionProcess.this);
      if (!promotionBuilds.isEmpty()) {
      return promotionBuilds.iterator().next();
      }

      for example.

      thanks,
      Nathan.

            Unassigned Unassigned
            nathang nathan grunzweig
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: