Move system-config url to properties

Make system-config url available for configuring by setting
it out of the class. Also add property for choosing which branch should
be used stable or master. By default it will be "master" branch with url
pointing on fuel-infra repository.

Also add UI form for SystemConfig package, which will be used later by
UI forms of Applications.

Change-Id: I52779d9b190ddee1de2243de812e3f7133584b6d
This commit is contained in:
Sergey Kraynev 2016-07-11 19:13:15 +03:00
parent 8fa3d4a4f7
commit 3d62edef39
16 changed files with 186 additions and 19 deletions

View File

@ -26,6 +26,9 @@ Properties:
Contract: $.class(ci_cd_pipeline_murano_app:Nodepool) Contract: $.class(ci_cd_pipeline_murano_app:Nodepool)
Usage: Out Usage: Out
systemConfigRepo:
Contract: $.class(puppet:SystemConfig)
zuulNodepoolHelper: zuulNodepoolHelper:
Contract: $.class(ci_cd_pipeline_murano_app:ZuulNodepoolHelper) Contract: $.class(ci_cd_pipeline_murano_app:ZuulNodepoolHelper)
ldapRootUser: ldapRootUser:
@ -104,7 +107,8 @@ Methods:
name => 'Gerrit', name => 'Gerrit',
instance => $gerritInstance, instance => $gerritInstance,
ldap => $this.ldap, ldap => $this.ldap,
userSSH => $this.userSSH) userSSH => $this.userSSH,
systemConfigRepo => $.systemConfigRepo)
# Jenkins # Jenkins
# set user and mail for accessing to Gerrit from Jenkins # set user and mail for accessing to Gerrit from Jenkins
@ -128,7 +132,8 @@ Methods:
gerrit => $this.gerrit, gerrit => $this.gerrit,
cfplugin => false, cfplugin => false,
gitUser => $.ldapUser, gitUser => $.ldapUser,
gitEmail => $.ldapEmail) gitEmail => $.ldapEmail,
systemConfigRepo => $.systemConfigRepo)
# Zuul # Zuul
- If: $this.zuul = null and $this.zuulNodepoolHelper != null - If: $this.zuul = null and $this.zuulNodepoolHelper != null
@ -144,7 +149,8 @@ Methods:
- $this.zuul: new(ci_cd_pipeline_murano_app:Zuul, $._environment, - $this.zuul: new(ci_cd_pipeline_murano_app:Zuul, $._environment,
name => 'Zuul', name => 'Zuul',
instance => $zuulInstance, instance => $zuulInstance,
gerrit => $this.gerrit) gerrit => $this.gerrit,
systemConfigRepo => $.systemConfigRepo)
# Nodepool # Nodepool
- If: $this.nodepool = null and $this.zuulNodepoolHelper != null - If: $this.nodepool = null and $this.zuulNodepoolHelper != null
@ -165,7 +171,8 @@ Methods:
authUrl => $this.zuulNodepoolHelper.authUrl, authUrl => $this.zuulNodepoolHelper.authUrl,
username => $this.zuulNodepoolHelper.username, username => $this.zuulNodepoolHelper.username,
tenant => $this.zuulNodepoolHelper.tenant, tenant => $this.zuulNodepoolHelper.tenant,
password => $this.zuulNodepoolHelper.password) password => $this.zuulNodepoolHelper.password,
systemConfigRepo => $.systemConfigRepo)
# Deploy all # Deploy all
- $applications: - $applications:

View File

@ -18,6 +18,7 @@ Application:
keyname: $.instanceConfiguration.keyPair keyname: $.instanceConfiguration.keyPair
availabilityZone: $.instanceConfiguration.availabilityZone availabilityZone: $.instanceConfiguration.availabilityZone
assignFloatingIp: true assignFloatingIp: true
systemConfigRepo: $.appConfiguration.systemConfigRepo
Forms: Forms:
- appConfiguration: - appConfiguration:
@ -81,6 +82,13 @@ Forms:
descriptionTitle: User public ssh key descriptionTitle: User public ssh key
description: > description: >
Please, provide user public ssh key. Please, provide user public ssh key.
- name: systemConfigRepo
type: org.openstack.ci_cd_pipeline_murano_app.puppet.SystemConfig
label: system-config Url
required: false
descriptionTitle: system-config Url
description: >
Please, provide url for system-config repository.
- name: zuulNodepoolHelper - name: zuulNodepoolHelper
type: org.openstack.ci_cd_pipeline_murano_app.ZuulNodepoolHelper type: org.openstack.ci_cd_pipeline_murano_app.ZuulNodepoolHelper
label: Zuul and Nodepool label: Zuul and Nodepool
@ -88,6 +96,7 @@ Forms:
descriptionTitle: Zuul and Nodepool descriptionTitle: Zuul and Nodepool
description: > description: >
Specify Zuul and Nodepool parameters if needed. Specify Zuul and Nodepool parameters if needed.
- instanceConfiguration: - instanceConfiguration:
fields: fields:
- name: title - name: title

View File

@ -16,6 +16,7 @@ Require:
org.openstack.ci_cd_pipeline_murano_app.Jenkins: org.openstack.ci_cd_pipeline_murano_app.Jenkins:
org.openstack.ci_cd_pipeline_murano_app.Gerrit: org.openstack.ci_cd_pipeline_murano_app.Gerrit:
org.openstack.ci_cd_pipeline_murano_app.puppet.Puppet: org.openstack.ci_cd_pipeline_murano_app.puppet.Puppet:
org.openstack.ci_cd_pipeline_murano_app.puppet.SystemConfig:
org.openstack.ci_cd_pipeline_murano_app.utils.CiCdUtils: org.openstack.ci_cd_pipeline_murano_app.utils.CiCdUtils:
org.openstack.ci_cd_pipeline_murano_app.ZuulNodepoolHelper: org.openstack.ci_cd_pipeline_murano_app.ZuulNodepoolHelper:
org.openstack.ci_cd_pipeline_murano_app.Zuul: org.openstack.ci_cd_pipeline_murano_app.Zuul:

View File

@ -22,6 +22,8 @@ Properties:
Contract: $.class(ci_cd_pipeline_murano_app:OpenLDAP) Contract: $.class(ci_cd_pipeline_murano_app:OpenLDAP)
userSSH: userSSH:
Contract: $.string() Contract: $.string()
systemConfigRepo:
Contract: $.class(puppet:SystemConfig)
Methods: Methods:
initialize: initialize:
@ -60,7 +62,12 @@ Methods:
- $._environment.reporter.report($this, 'Installing puppet modules...') - $._environment.reporter.report($this, 'Installing puppet modules...')
- $this.systemConfig: new(puppet:SystemConfig) # initialize System Config
- If: $.systemConfigRepo = null
Then:
- $this.systemConfig: new(puppet:SystemConfig)
Else:
- $this.systemConfig: $.systemConfigRepo
- $this.systemConfig.installOnTheNode($this.instance) - $this.systemConfig.installOnTheNode($this.instance)
- If: $.ldap != null - If: $.ldap != null

View File

@ -7,6 +7,7 @@ Application:
warUrl: $.appConfiguration.warUrl warUrl: $.appConfiguration.warUrl
ldap: $.appConfiguration.OpenLDAP ldap: $.appConfiguration.OpenLDAP
userSSH: $.appConfiguration.userSSH userSSH: $.appConfiguration.userSSH
systemConfigRepo: $.appConfiguration.systemConfigRepo
instance: instance:
?: ?:
type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance
@ -54,6 +55,13 @@ Forms:
descriptionTitle: User public ssh key descriptionTitle: User public ssh key
description: >- description: >-
Please, provide user public ssh key Please, provide user public ssh key
- name: systemConfigRepo
type: org.openstack.ci_cd_pipeline_murano_app.puppet.SystemConfig
label: system-config Url
required: false
descriptionTitle: system-config Url
description: >
Please, provide url for system-config repository.
- instanceConfiguration: - instanceConfiguration:
fields: fields:
- name: title - name: title

View File

@ -29,6 +29,8 @@ Properties:
Contract: $.string() Contract: $.string()
gitEmail: gitEmail:
Contract: $.string() Contract: $.string()
systemConfigRepo:
Contract: $.class(puppet:SystemConfig)
Methods: Methods:
initialize: initialize:
@ -52,7 +54,12 @@ Methods:
- $.instance.deploy() - $.instance.deploy()
- $._environment.reporter.report($this, 'Jenkins VM "{0}" with id {1} created'.format($.instance.name, $.instance.openstackId)) - $._environment.reporter.report($this, 'Jenkins VM "{0}" with id {1} created'.format($.instance.name, $.instance.openstackId))
- $this.systemConfig: new(puppet:SystemConfig) # initialize System Config
- If: $.systemConfigRepo = null
Then:
- $this.systemConfig: new(puppet:SystemConfig)
Else:
- $this.systemConfig: $.systemConfigRepo
- $this.systemConfig.installOnTheNode($this.instance) - $this.systemConfig.installOnTheNode($this.instance)
- $resources: new(sys:Resources) - $resources: new(sys:Resources)

View File

@ -10,6 +10,7 @@ Application:
dockerplugin: $.appConfiguration.dockerplugin dockerplugin: $.appConfiguration.dockerplugin
gitUser: $.appConfiguration.gitUser gitUser: $.appConfiguration.gitUser
gitEmail: $.appConfiguration.gitEmail gitEmail: $.appConfiguration.gitEmail
systemConfigRepo: $.appConfiguration.systemConfigRepo
instance: instance:
?: ?:
type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance
@ -56,6 +57,13 @@ Forms:
required: false required: false
description: >- description: >-
Specify OpenLDAP domain for authentication Specify OpenLDAP domain for authentication
- name: systemConfigRepo
type: org.openstack.ci_cd_pipeline_murano_app.puppet.SystemConfig
label: system-config Url
required: false
descriptionTitle: system-config Url
description: >
Please, provide url for system-config repository.
- name: Gerrit - name: Gerrit
type: org.openstack.ci_cd_pipeline_murano_app.Gerrit type: org.openstack.ci_cd_pipeline_murano_app.Gerrit
required: false required: false

View File

@ -29,6 +29,8 @@ Properties:
Contract: $.string().notNull() Contract: $.string().notNull()
password: password:
Contract: $.string().notNull() Contract: $.string().notNull()
systemConfigRepo:
Contract: $.class(puppet:SystemConfig)
Methods: Methods:
.init: .init:
@ -54,7 +56,12 @@ Methods:
- $._environment.reporter.report($this, 'Installing needed puppets for Nodepool...') - $._environment.reporter.report($this, 'Installing needed puppets for Nodepool...')
- $this.systemConfig: new(puppet:SystemConfig) # initialize System Config
- If: $.systemConfigRepo = null
Then:
- $this.systemConfig: new(puppet:SystemConfig)
Else:
- $this.systemConfig: $.systemConfigRepo
- $this.systemConfig.installOnTheNode($this.instance) - $this.systemConfig.installOnTheNode($this.instance)
- $._environment.reporter.report($this, 'Waiting while Jenkins is being deployed...') - $._environment.reporter.report($this, 'Waiting while Jenkins is being deployed...')

View File

@ -10,6 +10,7 @@ Application:
username: $.openstackConfiguration.username username: $.openstackConfiguration.username
tenant: $.openstackConfiguration.tenant tenant: $.openstackConfiguration.tenant
password: $.openstackConfiguration.password password: $.openstackConfiguration.password
systemConfigRepo: $.appConfiguration.systemConfigRepo
instance: instance:
?: ?:
type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance
@ -37,6 +38,13 @@ Forms:
Select to true to assign floating IP automatically Select to true to assign floating IP automatically
initial: true initial: true
required: false required: false
- name: systemConfigRepo
type: org.openstack.ci_cd_pipeline_murano_app.puppet.SystemConfig
label: system-config Url
required: false
descriptionTitle: system-config Url
description: >
Please, provide url for system-config repository.
- name: Jenkins - name: Jenkins
type: org.openstack.ci_cd_pipeline_murano_app.Jenkins type: org.openstack.ci_cd_pipeline_murano_app.Jenkins
label: Jenkins label: Jenkins

View File

@ -1,13 +1,26 @@
Namespaces: Namespaces:
=: org.openstack.ci_cd_pipeline_murano_app.puppet =: org.openstack.ci_cd_pipeline_murano_app.puppet
std: io.murano
sys: io.murano.system sys: io.murano.system
puppet: org.openstack.ci_cd_pipeline_murano_app.puppet puppet: org.openstack.ci_cd_pipeline_murano_app.puppet
Extends: std:Application
Name: SystemConfig Name: SystemConfig
Properties: Properties:
projectConfigRepo: name:
Contract: $.string().notNull()
Default: 'System Config'
projectConfigUrl:
Contract: $.string().notNull() Contract: $.string().notNull()
Default: 'https://review.fuel-infra.org/open-paas/project-config' Default: 'https://review.fuel-infra.org/open-paas/project-config'
systemConfigUrl:
Contract: $.string().notNull()
Default: 'https://review.fuel-infra.org/open-paas/system-config'
branchName:
Contract: $.string()
patchId:
Contract: $.string()
Methods: Methods:
installOnTheNode: installOnTheNode:
Arguments: Arguments:
@ -15,7 +28,10 @@ Methods:
Contract: $.class(puppet:PuppetInstance) Contract: $.class(puppet:PuppetInstance)
Body: Body:
- $resources: new(sys:Resources) - $resources: new(sys:Resources)
- $template: $resources.yaml('SystemConfig.template') - $template: $resources.yaml('SystemConfig.template').bind(dict(
url => $this.systemConfigUrl,
branch => $this.branchName,
patch_id => $this.patchId))
- $instance.agent.call($template, $resources) - $instance.agent.call($template, $resources)
- $instance.putHieraData({'project_config_repo' => $this.projectConfigRepo}) - $instance.putHieraData({'project_config_repo' => $this.projectConfigUrl})
- $instance.installPuppetModule('reidmv/yamlfile') - $instance.installPuppetModule('reidmv/yamlfile')

View File

@ -2,8 +2,17 @@ FormatVersion: 2.1.0
Version: 1.0.0 Version: 1.0.0
Name: Deploy Project Config Name: Deploy Project Config
Parameters:
url: $url
branch: $branch
patch_id: $patch_id
Body: | Body: |
return deploy().stdout return deploy(
'"{0}" "{1}" "{2}"'.format(
args.url,
args.branch,
args.patch_id)).stdout
Scripts: Scripts:
deploy: deploy:

View File

@ -1,16 +1,37 @@
#!/bin/bash #!/bin/bash
URL="$1"
BRANCH="$2"
PATCH_ID="$3"
logger Cloning openstack-ci system-config logger Cloning openstack-ci system-config
git clone https://review.fuel-infra.org/open-paas/system-config repository_name="$(basename "$URL")"
if [ -n "$PATCH_ID" ] ; then
git clone $URL
pushd $repository_name
patch_ref=`git ls-remote | grep $PATCH_ID | tail -1 | awk '{print $2}'`
if [ -z "$patch_ref" ] ; then
echo "Patch id $PATCH_ID is not correct."
exit 1
fi
git fetch $URL $patch_ref && git checkout "FETCH_HEAD"
popd
elif [ -n "$BRANCH" ] ; then
git clone $URL --branch $BRANCH
else
git clone $URL
fi
logger Installing openstack-ci system-config logger Installing openstack-ci system-config
cd system-config pushd $repository_name
./install_modules.sh ./install_modules.sh
cp -r modules/ /etc/puppet/ cp -r modules/ /etc/puppet/
# Should be installed on the each node to use # Should be installed on the each node to use
# domain2dn function # domain2dn function
puppet module install datacentred-ldap puppet module install datacentred-ldap
popd

View File

@ -0,0 +1,43 @@
Version: 2
Application:
?:
type: org.openstack.ci_cd_pipeline_murano_app.puppet.SystemConfig
name: $.appConfiguration.name
projectConfigUrl: $.appConfiguration.projectConfigUrl
systemConfigUrl: $.appConfiguration.systemConfigUrl
branchName: $.appConfiguration.branchName
patchId: $.appConfiguration.patchId
Forms:
- appConfiguration:
fields:
- name: name
type: string
label: Application Name
initial: System Config
description: >
Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and
underline are allowed
- name: systemConfigUrl
type: string
label: Url for System Config Repository
description: Provide URL for system config repository.
initial: https://review.fuel-infra.org/open-paas/system-config
required: true
- name: projectConfigUrl
type: string
label: Url for Project Config Repository
description: Provide URL for project config repository.
initial: https://review.fuel-infra.org/open-paas/project-config
required: true
- name: branchName
type: string
label: Branch Name
description: Provide branch, which should be used for for system-config repo.
required: false
- name: patchId
type: string
label: Patch Id
description: Provide Id of patchset, which will be used for system-config repo.
required: false

View File

@ -9,6 +9,7 @@ Author: 'Mirantis, Inc'
Tags: [CI] Tags: [CI]
Classes: Classes:
org.openstack.ci_cd_pipeline_murano_app.puppet.SystemConfig: SystemConfig.yaml org.openstack.ci_cd_pipeline_murano_app.puppet.SystemConfig: SystemConfig.yaml
UI: ui.yaml
Logo: logo.png Logo: logo.png
Require: Require:
org.openstack.ci_cd_pipeline_murano_app.puppet.Puppet: org.openstack.ci_cd_pipeline_murano_app.puppet.Puppet:

View File

@ -17,6 +17,8 @@ Properties:
Contract: $.class(puppet:PuppetInstance).notNull() Contract: $.class(puppet:PuppetInstance).notNull()
gerrit: gerrit:
Contract: $.class(Gerrit) Contract: $.class(Gerrit)
systemConfigRepo:
Contract: $.class(puppet:SystemConfig)
Methods: Methods:
.init: .init:
Body: Body:
@ -47,7 +49,12 @@ Methods:
- $.instance.deploy() - $.instance.deploy()
- $._environment.reporter.report($this, 'Zuul VM "{0}" with id {1} created'.format($.instance.name, $.instance.openstackId)) - $._environment.reporter.report($this, 'Zuul VM "{0}" with id {1} created'.format($.instance.name, $.instance.openstackId))
- $this.systemConfig: new(puppet:SystemConfig) # initialize System Config
- If: $.systemConfigRepo = null
Then:
- $this.systemConfig: new(puppet:SystemConfig)
Else:
- $this.systemConfig: $.systemConfigRepo
- $this.systemConfig.installOnTheNode($this.instance) - $this.systemConfig.installOnTheNode($this.instance)
- $._environment.reporter.report($this, 'Zuul is waiting while Gerrit is being deployed...') - $._environment.reporter.report($this, 'Zuul is waiting while Gerrit is being deployed...')

View File

@ -5,6 +5,7 @@ Application:
type: org.openstack.ci_cd_pipeline_murano_app.Zuul type: org.openstack.ci_cd_pipeline_murano_app.Zuul
name: $.appConfiguration.name name: $.appConfiguration.name
gerrit: $.appConfiguration.Gerrit gerrit: $.appConfiguration.Gerrit
systemConfigRepo: $.appConfiguration.systemConfigRepo
instance: instance:
?: ?:
type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance
@ -22,6 +23,13 @@ Forms:
type: string type: string
label: Application Name label: Application Name
initial: Zuul initial: Zuul
- name: systemConfigRepo
type: org.openstack.ci_cd_pipeline_murano_app.puppet.SystemConfig
label: system-config Url
required: false
descriptionTitle: system-config Url
description: >
Please, provide url for system-config repository.
- name: Gerrit - name: Gerrit
type: org.openstack.ci_cd_pipeline_murano_app.Gerrit type: org.openstack.ci_cd_pipeline_murano_app.Gerrit
description: Gerrit Server description: Gerrit Server