jenkinsci/copyartifact-plugin — pull request #47 by ikedam (2014-10-02 00:08:10+00:00)
Title: [JENKINS-16028] [JENKINS-18762] Adds EnvAction when it's needed

[JENKINS-16028] (https://issues.jenkins-ci.org/browse/JENKINS-16028)
[JENKINS-18762] (https://issues.jenkins-ci.org/browse/JENKINS-18762)

Copyartifact provides an environment variable "COPYARTIFACT_BUILD_NUMBER_XXXX" which indicates the build number of the build from which copyartifacts copied artifacts.
That variable is bound to the build using `CopyArtifact.EnvAction`.

`CopyArtifact.EnvAction` is added to a build when the build starts and if the build has `CopyArtifact` among its builders. (this is done in `CopyArtifact.CopyArtifactRunListener`)
This results following problems:
* Doesn't work for maven-projects as maven-projects uses copyartifact not as a builder but a pre-builder (which is unique attributes for maven-projects) and `CopyArtifact.CopyArtifactRunListener` fails to find `CopyArtifact`.
* Doesn't work if copyartifact is wrapped in [Conditional Buildstep] (https://wiki.jenkins-ci.org/display/JENKINS/Conditional+BuildStep+Plugin) as `CopyArtifact.CopyArtifactRunListener` fails to find `CopyArtifact` wrapped in another plugin.

This change makes copyartifact add `CopyArtifact.EnvAction` when it's needed, which should work correct also for above cases.