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

View File

@ -18,6 +18,7 @@ Application:
keyname: $.instanceConfiguration.keyPair
availabilityZone: $.instanceConfiguration.availabilityZone
assignFloatingIp: true
systemConfigRepo: $.appConfiguration.systemConfigRepo
Forms:
- appConfiguration:
@ -81,6 +82,13 @@ Forms:
descriptionTitle: User public ssh key
description: >
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
type: org.openstack.ci_cd_pipeline_murano_app.ZuulNodepoolHelper
label: Zuul and Nodepool
@ -88,6 +96,7 @@ Forms:
descriptionTitle: Zuul and Nodepool
description: >
Specify Zuul and Nodepool parameters if needed.
- instanceConfiguration:
fields:
- name: title

View File

@ -16,6 +16,7 @@ Require:
org.openstack.ci_cd_pipeline_murano_app.Jenkins:
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.SystemConfig:
org.openstack.ci_cd_pipeline_murano_app.utils.CiCdUtils:
org.openstack.ci_cd_pipeline_murano_app.ZuulNodepoolHelper:
org.openstack.ci_cd_pipeline_murano_app.Zuul:

View File

@ -22,6 +22,8 @@ Properties:
Contract: $.class(ci_cd_pipeline_murano_app:OpenLDAP)
userSSH:
Contract: $.string()
systemConfigRepo:
Contract: $.class(puppet:SystemConfig)
Methods:
initialize:
@ -60,7 +62,12 @@ Methods:
- $._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)
- If: $.ldap != null

View File

@ -7,6 +7,7 @@ Application:
warUrl: $.appConfiguration.warUrl
ldap: $.appConfiguration.OpenLDAP
userSSH: $.appConfiguration.userSSH
systemConfigRepo: $.appConfiguration.systemConfigRepo
instance:
?:
type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance
@ -54,6 +55,13 @@ Forms:
descriptionTitle: User public ssh key
description: >-
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:
fields:
- name: title

View File

@ -29,6 +29,8 @@ Properties:
Contract: $.string()
gitEmail:
Contract: $.string()
systemConfigRepo:
Contract: $.class(puppet:SystemConfig)
Methods:
initialize:
@ -52,7 +54,12 @@ Methods:
- $.instance.deploy()
- $._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)
- $resources: new(sys:Resources)

View File

@ -10,6 +10,7 @@ Application:
dockerplugin: $.appConfiguration.dockerplugin
gitUser: $.appConfiguration.gitUser
gitEmail: $.appConfiguration.gitEmail
systemConfigRepo: $.appConfiguration.systemConfigRepo
instance:
?:
type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance
@ -56,6 +57,13 @@ Forms:
required: false
description: >-
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
type: org.openstack.ci_cd_pipeline_murano_app.Gerrit
required: false

View File

@ -29,6 +29,8 @@ Properties:
Contract: $.string().notNull()
password:
Contract: $.string().notNull()
systemConfigRepo:
Contract: $.class(puppet:SystemConfig)
Methods:
.init:
@ -54,7 +56,12 @@ Methods:
- $._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)
- $._environment.reporter.report($this, 'Waiting while Jenkins is being deployed...')

View File

@ -10,6 +10,7 @@ Application:
username: $.openstackConfiguration.username
tenant: $.openstackConfiguration.tenant
password: $.openstackConfiguration.password
systemConfigRepo: $.appConfiguration.systemConfigRepo
instance:
?:
type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance
@ -37,6 +38,13 @@ Forms:
Select to true to assign floating IP automatically
initial: true
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
type: org.openstack.ci_cd_pipeline_murano_app.Jenkins
label: Jenkins

View File

@ -1,13 +1,26 @@
Namespaces:
=: org.openstack.ci_cd_pipeline_murano_app.puppet
std: io.murano
sys: io.murano.system
puppet: org.openstack.ci_cd_pipeline_murano_app.puppet
Extends: std:Application
Name: SystemConfig
Properties:
projectConfigRepo:
name:
Contract: $.string().notNull()
Default: 'System Config'
projectConfigUrl:
Contract: $.string().notNull()
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:
installOnTheNode:
Arguments:
@ -15,7 +28,10 @@ Methods:
Contract: $.class(puppet:PuppetInstance)
Body:
- $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.putHieraData({'project_config_repo' => $this.projectConfigRepo})
- $instance.putHieraData({'project_config_repo' => $this.projectConfigUrl})
- $instance.installPuppetModule('reidmv/yamlfile')

View File

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

View File

@ -1,16 +1,37 @@
#!/bin/bash
URL="$1"
BRANCH="$2"
PATCH_ID="$3"
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
cd system-config
./install_modules.sh
pushd $repository_name
./install_modules.sh
cp -r modules/ /etc/puppet/
cp -r modules/ /etc/puppet/
# Should be installed on the each node to use
# domain2dn function
puppet module install datacentred-ldap
# Should be installed on the each node to use
# domain2dn function
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]
Classes:
org.openstack.ci_cd_pipeline_murano_app.puppet.SystemConfig: SystemConfig.yaml
UI: ui.yaml
Logo: logo.png
Require:
org.openstack.ci_cd_pipeline_murano_app.puppet.Puppet:

View File

@ -17,6 +17,8 @@ Properties:
Contract: $.class(puppet:PuppetInstance).notNull()
gerrit:
Contract: $.class(Gerrit)
systemConfigRepo:
Contract: $.class(puppet:SystemConfig)
Methods:
.init:
Body:
@ -47,7 +49,12 @@ Methods:
- $.instance.deploy()
- $._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)
- $._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
name: $.appConfiguration.name
gerrit: $.appConfiguration.Gerrit
systemConfigRepo: $.appConfiguration.systemConfigRepo
instance:
?:
type: org.openstack.ci_cd_pipeline_murano_app.puppet.PuppetInstance
@ -22,6 +23,13 @@ Forms:
type: string
label: Application Name
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
type: org.openstack.ci_cd_pipeline_murano_app.Gerrit
description: Gerrit Server