Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promotion plugin config support #172

Merged
merged 2 commits into from
Mar 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/jenkins_api_client/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,27 @@ def get_promotions(job_name)
result
end

# Get a job's promotion config
#
# @param [String] job_name
# @param [String] process The process name
# @return [String] Promote config
def get_promote_config(job_name, process)
@logger.info "Getting promote config for job '#{job_name}' process '#{process}'"
@client.get_config("/job/#{job_name}/promotion/process/#{process}/config.xml")
end

# Set a job's promotion config
#
# @param [String] job_name
# @param [String] process The process name
# @param [String] Job config
# @return nil
def set_promote_config(job_name, process, config)
@logger.info "Setting promote config for job '#{job_name}' process '#{process}' to #{config}"
@client.post_config("/job/#{job_name}/promotion/process/#{process}/config.xml", config)
end

#A Method to find artifacts path from the Current Build
#
# @param [String] job_name
Expand Down
14 changes: 14 additions & 0 deletions spec/unit_tests/job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,20 @@
end
end

describe "#get_promote_config" do
it "accepts name and process and returns promotion config" do
@client.should_receive(:get_config).with('/job/testjob/promotion/process/promo/config.xml')
@job.get_promote_config('testjob', 'promo')
end
end

describe "#set_promote_config" do
it "accepts name, process and config." do
@client.should_receive(:post_config).with('/job/testjob/promotion/process/promo/config.xml', 'xml')
@job.set_promote_config('testjob', 'promo', 'xml')
end
end

describe '#scm_git' do
before do
@job.send(:scm_git, {
Expand Down