Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Commit

Permalink
add scriptContent for job_attribute inject_env_vars_pre_scm (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgcarroll authored and JustMcAfee committed Mar 29, 2017
1 parent 522d00a commit 212c6f4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jenkins_pipeline_builder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ automating Job & Pipeline creation from the YAML files checked-in with your appl
spec.add_dependency 'activesupport', '~> 4.2.6'
spec.add_dependency 'minitar'

spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'bundler', '~> 1.14.6'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'bump'
Expand Down
1 change: 1 addition & 0 deletions lib/jenkins_pipeline_builder/extensions/job_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@
propertiesFilePath params[:file] if params[:file]
propertiesContent params[:content] if params[:content]
loadFilesFromMaster false
scriptContent params[:script_content] if params[:script_content]
end
on true
keepJenkinsSystemVariables true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,18 @@
end
end
end

context 'inject_env_vars_pre_scm' do
before :each do
JenkinsPipelineBuilder.registry.registry[:job][:inject_env_vars_pre_scm].installed_version = '1.93.1'
end

it 'generates correct config' do
env_vars = { inject_env_vars_pre_scm: { script_content: 'echo foo' } }
JenkinsPipelineBuilder.registry.traverse_registry_path('job', env_vars, @n_xml)
properties = @n_xml.root.children.first
expect(properties.name).to match 'EnvInjectJobProperty'
expect(properties.css('scriptContent').first.content).to eq 'echo foo'
end
end
end

0 comments on commit 212c6f4

Please sign in to comment.