Skip to content

Commit

Permalink
Try to fix some test failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Harvey-Smith committed Nov 27, 2017
1 parent 31812fb commit fbb160e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/jenkins_api_client/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1659,8 +1659,8 @@ def artifact_exists?(job_name, build_number = 0)
#
def find_artifacts(job_name, build_number = nil)
response_json = get_build_details(job_name, build_number)
relative_build_path = artifact_path(build_details: response_json).map do |p|
URI.escape("#{response_json['url']}/artifact/#{relative_build_path}")
artifact_path(build_details: response_json).map do |p|
URI.escape("#{response_json['url']}artifact/#{relative_build_path}")
end
end

Expand Down Expand Up @@ -1923,12 +1923,16 @@ def artifact_path(params)

build_details = get_build_details(job_name, build_number) if build_details.nil?
artifacts = build_details['artifacts']
artifact_paths = []

if artifacts && artifacts.any?
return artifacts.find_all{ |a| a.key?('relativePath') }
else
artifact_paths = artifacts.find_all{ |a| a.key?('relativePath') }
end

if artifact_paths.empty?
raise "No artifacts found."
end
artifact_paths
end
end
end
Expand Down

0 comments on commit fbb160e

Please sign in to comment.