Class: JenkinsApi::Client::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/recipes/deploy/strategy/jenkins_artifact.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_artifact_url_by_build(build, &finder) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/capistrano/recipes/deploy/strategy/jenkins_artifact.rb', line 7

def self.get_artifact_url_by_build(build, &finder)
  finder ||= ->(_) { true }
  matched_artifact   = build['artifacts'].find(&finder)
  raise 'Specified artifact not found in current build !!' unless matched_artifact
  relative_build_path = matched_artifact['relativePath']
  jenkins_path          = build['url']
  artifact_path         = URI.escape("#{jenkins_path}artifact/#{relative_build_path}")
  return artifact_path
end

Instance Method Details

#get_last_successful_build(job_name) ⇒ Object



17
18
19
20
# File 'lib/capistrano/recipes/deploy/strategy/jenkins_artifact.rb', line 17

def get_last_successful_build(job_name)
  @logger.info "Obtaining last successful build number of #{job_name}"
  @client.api_get_request("/job/#{path_encode(job_name)}/lastSuccessfulBuild")
end