-
Improvement
-
Resolution: Unresolved
-
Major
-
None
I try to get the artifacts from the last job where the job is the same as before (itself) without relying on leftovers in the workspace and without chaining the job to itself.
The job might fail or pass but I would need the artifacts from the last execution. However, when I pick the option permlink->lastBuild then this won't contain any artifacts because the current running job is already linked to lastBuild. Adding two CopyArtifact jobs one for permaLink->lastFailedBuild and one for permaLink->lastSuccessfulBuild collects twice the artifacts and I need to decide which to pick.
My current implementation within the job looks like:
- get build number of last failed build
open(ENV['JOB_URL']+"/lastFailedBuild/buildNumber") do |lastFailedBuildNumberPage|
lastFailedBuildNumberPage.each_line do |line|
@lastFailedBuildNumber = line.to_i
end
end - get build number of last successful build
open(ENV['JOB_URL']+"/lastSuccessfulBuild/buildNumber") do |lastSuccessfulBuildNumberPage|
lastSuccessfulBuildNumberPage.each_line do |line|
@lastSuccessfulBuildNumber = line.to_i
end
end - get artifacts from most recent build
if @lastFailedBuildNumber > @lastSuccessfulBuildNumber
open(ENV['JOB_URL']@lastFailedBuildNumber.to_s"/artifact/job.txt/view/") do |lastFailedArtifactsPage|
lastFailedArtifactsPage.each_line do |line|
@lastFailedArtifactsPage << line.chomp!
end
end
else
open(ENV['JOB_URL']@lastSuccessfulBuildNumber.to_s"/artifact/job.txt/view/") do |lastSuccessfulArtifactsPage|
lastSuccessfulArtifactsPage.each_line do |line|
@lastSuccessfulArtifacts << line.chomp!
end
end
end
Could this logic get implemented within the plugin?