[CI/CD][Jenkins] Jenkins user added

Change-Id: Id3c2e5c1bf03734e649fc04a7845611ad3ddf073
This commit is contained in:
Alexey Khivin 2016-04-29 18:21:50 +03:00
parent fb2759c79d
commit c0113c32f7
6 changed files with 52 additions and 11 deletions

View File

@ -109,3 +109,6 @@ Methods:
- $this.ldap.deploy()
- $this.gerrit.deploy()
- $this.jenkins.deploy()
- $ssh_private_key: $gerritInstance.getHieraValue('gerrit_ssh_rsa_key_contents')
- $this.jenkins.configureUser($ssh_private_key)

View File

@ -127,3 +127,13 @@ Methods:
Body:
- $.reportDestroyed()
- $.setAttr(deployed, false)
configureUser:
Arguments:
- key:
Contract: $.string().notNull()
Body:
- $this.instance.setHieraValue('gerrit_ssh_rsa_key_contents', $key)
- $resources: new(sys:Resources)
- $template: $resources.yaml('JenkinsUser.template')
- $.instance.agent.call($template, $resources, 100)

View File

@ -0,0 +1,17 @@
FormatVersion: 2.1.0
Version: 1.0.0
Name: Configure User
Body: |
return deploy().stdout
Scripts:
deploy:
Type: Application
Version: 1.0.0
EntryPoint: jenkins_user.sh
Files: ['jenkins_user.sh', 'jenkins_user.pp']
Options:
captureStdout: true
captureStderr: true

View File

@ -0,0 +1,8 @@
node default {
$ssh_key = hiera('gerrit_ssh_rsa_key_contents', undef)
if $ssh_key {
class { 'jenkins::jenkinsuser':
ssh_key => $ssh_key
}
}
}

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
puppet apply jenkins_user.pp

View File

@ -74,17 +74,6 @@ Methods:
- $._environment.reporter.report($this,
'Puppet module {0} installed on {1}'.format( $module, $.openstackId))
setHieraValue:
Arguments:
- key:
Contract: $.string().notNull()
- value:
Contract: $.string().notNull()
Body:
- $._environment.reporter.report($this,
'Put value {0} = {1}'.format( $key, $value))
- $.setYamlValue('/etc/puppet/hieradata/murano.yaml', $key, $value)
setHieraConfigValue:
Arguments:
- key:
@ -122,3 +111,14 @@ Methods:
key => $key))
- $value: $.agent.call($template, $resources)
- Return: $value
setHieraValue:
Arguments:
- key:
Contract: $.string().notNull()
- value:
Contract: $.string().notNull()
Body:
- $._environment.reporter.report($this,
'Put value {0} = {1}'.format( $key, $value))
- $.setYamlValue('/etc/puppet/hieradata/murano.yaml', $key, $value)