12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/gocd/history/history_fetcher.rb', line 12
def self.fetch_raw_job_history(job, runs=100)
params = {pipelineName: job.pipeline, stageName: job.stage, jobName: job.name, limitPipeline: 'latest', limitCount: runs}
params = URI.encode_www_form(params)
request = {
method: :get,
url: "#{GOCD.server.url}/go/properties/search?#{params}",
user: GOCD.credentials.username,
password: GOCD.credentials.password,
}
begin
res = RestClient::Request.execute(request)
response = res.body unless res.nil?
rescue => e
error = <<-ERROR
Could not fetch history for #{job.pipeline}::#{job.stage}::#{job.name}
Response received from server: #{e}
ERROR
response = nil
puts error
end
response
end
|