Skip to content

Commit

Permalink
Merge pull request #218 from dalisch/scm_export
Browse files Browse the repository at this point in the history
Automate configuration of SCM export properties in a project
  • Loading branch information
jyaworski committed Mar 30, 2016
2 parents c601be7 + 74e40a8 commit 5083a17
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
13 changes: 12 additions & 1 deletion manifests/config/project.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
$node_executor_settings = {},
$projects_dir = undef,
$resource_sources = $rundeck::resource_sources,
$scm_import_properties = $rundeck::scm_import_properties,
$scm_import_properties = {},
$scm_export_properties = {},
$ssh_keypath = undef,
$user = $rundeck::user,
) {
Expand Down Expand Up @@ -85,6 +86,7 @@
$project_dir = "${projects_dir_real}/${name}"
$properties_file = "${project_dir}/etc/project.properties"
$scm_import_properties_file = "${project_dir}/etc/scm-import.properties"
$scm_export_properties_file = "${project_dir}/etc/scm-export.properties"

file { $project_dir :
ensure => directory,
Expand All @@ -110,6 +112,15 @@
replace => false,
}

file { $scm_export_properties_file:
ensure => present,
content => template('rundeck/scm-export.properties.erb'),
owner => $user,
group => $group,
require => File["${project_dir}/etc"],
replace => false,
}

file { "${project_dir}/var":
ensure => directory,
owner => $user,
Expand Down
1 change: 0 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@
$truststore_password = 'adminadmin'

$resource_sources = {}
$scm_import_properties = {}
$gui_config = {}

$preauthenticated_config = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@
'scm.import.username' => '',
'scm.import.roles.count' => '3',
'scm.import.trackedItems.count' => '0'
},
'scm_export_properties' => {
'scm.export.enabled' => 'false',
'scm.export.config.format' => 'yaml',
'scm.export.config.dir' => '/var/lib/rundeck/projects/project_1/scm',
'scm.export.config.url' => 'git.repo.com/project_1.jobs.git',
'scm.export.config.branch' => 'master',
'scm.export.config.pathTemplate' => '{job.project}/${job.group}${job.name}-${job.id}.${config.format}',
'scm.export.config.strictHostKeyChecking' => 'no',
'scm.export.config.gitPasswordPath' => '',
'scm.export.config.sshPrivateKeyPath' => 'keys/${project}/users/scm/${user.login}.private',
'scm.export.roles.count' => '2',
'scm.export.roles.1' => 'user',
'scm.export.type' => 'git-export',
'scm.export.username' => '${user.username}',
'scm.export.config.committerName' => '${user.fullName}',
'scm.export.config.committerEmail' => '${user.email}'
}
}
}
Expand All @@ -47,5 +64,11 @@
expect(content).to include("#{key} = #{value}")
end
end
project_hash['project_1']['scm_export_properties'].each do |key, value|
it 'should generate valid content for scm-export.properties' do
content = catalogue.resource('file', '/var/lib/rundeck/projects/project_1/etc/scm-export.properties')[:content]
expect(content).to include("#{key} = #{value}")
end
end
end
end
1 change: 0 additions & 1 deletion spec/defines/config/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
:file_copier_provider => 'jsch-scp',
:resource_sources => {},
:scm_import_properties => {},
:node_executor_provider => 'jsch-ssh',
:user => 'rundedck',
:group => 'rundeck'
Expand Down
3 changes: 3 additions & 0 deletions templates/scm-export.properties.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%- @scm_export_properties.sort.each do |k,v| -%>
<%= k %> = <%= v %>
<%- end -%>

0 comments on commit 5083a17

Please sign in to comment.