Sergey Kraynev 3d62edef39 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
2016-07-20 18:47:15 +03:00

209 lines
6.9 KiB
YAML

Namespaces:
=: org.openstack.ci_cd_pipeline_murano_app
std: io.murano
ci_cd_pipeline_murano_app: org.openstack.ci_cd_pipeline_murano_app
puppet: org.openstack.ci_cd_pipeline_murano_app.puppet
net: org.openstack.ci_cd_pipeline_murano_app.utils.net
Name: CiCdEnvironment
Extends: std:Application
Properties:
ldap:
Contract: $.class(ci_cd_pipeline_murano_app:OpenLDAP)
Usage: Out
gerrit:
Contract: $.class(ci_cd_pipeline_murano_app:Gerrit)
Usage: Out
jenkins:
Contract: $.class(ci_cd_pipeline_murano_app:Jenkins)
Usage: Out
zuul:
Contract: $.class(ci_cd_pipeline_murano_app:Zuul)
Usage: Out
nodepool:
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:
Contract: $.string().notNull()
ldapRootPass:
Contract: $.string().notNull()
ldapRootEmail:
Contract: $.string().notNull()
ldapUser:
Contract: $.string()
ldapPass:
Contract: $.string()
ldapEmail:
Contract: $.string()
userSSH:
Contract: $.string()
instance_name:
Contract: $.string().notNull()
flavor:
Contract: $.string().notNull()
image:
Contract: $.string().notNull()
keyname:
Contract: $.string().notNull()
availabilityZone:
Contract: $.string().notNull()
Default: nova
assignFloatingIp:
Contract: $.bool().notNull()
Default: true
Methods:
.init:
Body:
- $._environment: $.find(std:Environment).require()
deploy:
Body:
- $._environment.reporter.report($this, 'Deploying CI/CD')
# OpenLDAP
- If: $this.ldap = null
Then:
- $ldapInstanceName: concat($.instance_name, '-ldap')
- $ldapInstance: new(puppet:PuppetInstance, $._environment,
name => $ldapInstanceName,
flavor => $.flavor,
image => $.image,
keyname => $.keyname,
availabilityZone => $.availabilityZone,
assignFloatingIp => $.assignFloatingIp)
- $this.ldap: new(ci_cd_pipeline_murano_app:OpenLDAP, $._environment,
name => 'OpenLDAP',
instance => $ldapInstance,
domain => 'infra.local',
ldapRootUser => $.ldapRootUser,
ldapRootPass => $.ldapRootPass,
ldapRootEmail => $.ldapRootEmail,
ldapUser => $.ldapUser,
ldapPass => $.ldapPass,
ldapEmail => $.ldapEmail)
# Gerrit
- If: $this.gerrit = null
Then:
- $gerritInstanceName: concat($.instance_name, '-gerrit')
- $gerritInstance: new(puppet:PuppetInstance, $._environment,
name => $gerritInstanceName,
flavor => $.flavor,
image => $.image,
keyname => $.keyname,
availabilityZone => $.availabilityZone,
assignFloatingIp => $.assignFloatingIp)
- $this.gerrit: new(ci_cd_pipeline_murano_app:Gerrit, $this,
name => 'Gerrit',
instance => $gerritInstance,
ldap => $this.ldap,
userSSH => $this.userSSH,
systemConfigRepo => $.systemConfigRepo)
# Jenkins
# set user and mail for accessing to Gerrit from Jenkins
- If: $this.jenkins = null
Then:
- $._environment.reporter.report($this,
'Jenkins credentials user={0}, password={1}'.format(
$.ldapUser, $.ldapPass))
- $jenkinsInstanceName: concat($.instance_name, '-jenkins')
- $jenkinsInstance: new(puppet:PuppetInstance, $._environment,
name => $jenkinsInstanceName,
flavor => $.flavor,
image => $.image,
keyname => $.keyname,
availabilityZone => $.availabilityZone,
assignFloatingIp => $.assignFloatingIp)
- $this.jenkins: new(ci_cd_pipeline_murano_app:Jenkins, $._environment,
name => 'Jenkins',
instance => $jenkinsInstance,
ldap => $this.ldap,
gerrit => $this.gerrit,
cfplugin => false,
gitUser => $.ldapUser,
gitEmail => $.ldapEmail,
systemConfigRepo => $.systemConfigRepo)
# Zuul
- If: $this.zuul = null and $this.zuulNodepoolHelper != null
Then:
- $zuulInstanceName: concat($.instance_name, '-zuul')
- $zuulInstance: new(puppet:PuppetInstance, $._environment,
name => $zuulInstanceName,
flavor => $.flavor,
image => $.image,
keyname => $.keyname,
availabilityZone => $.availabilityZone,
assignFloatingIp => $.assignFloatingIp)
- $this.zuul: new(ci_cd_pipeline_murano_app:Zuul, $._environment,
name => 'Zuul',
instance => $zuulInstance,
gerrit => $this.gerrit,
systemConfigRepo => $.systemConfigRepo)
# Nodepool
- If: $this.nodepool = null and $this.zuulNodepoolHelper != null
Then:
- $nodepoolInstanceName: concat($.instance_name, '-nodepool')
- $nodepoolInstance: new(puppet:PuppetInstance, $._environment,
name => $nodepoolInstanceName,
flavor => $.flavor,
image => $.image,
keyname => $.keyname,
availabilityZone => $.availabilityZone,
assignFloatingIp => $.assignFloatingIp)
- $this.nodepool: new(ci_cd_pipeline_murano_app:Nodepool, $._environment,
name => 'Nodepool',
instance => $nodepoolInstance,
jenkins => $this.jenkins,
zuul => $this.zuul,
authUrl => $this.zuulNodepoolHelper.authUrl,
username => $this.zuulNodepoolHelper.username,
tenant => $this.zuulNodepoolHelper.tenant,
password => $this.zuulNodepoolHelper.password,
systemConfigRepo => $.systemConfigRepo)
# Deploy all
- $applications:
- $this.ldap
- $this.gerrit
- $this.jenkins
- If: $this.zuulNodepoolHelper != null
Then:
- $applications: $applications.append($this.zuul, $this.nodepool)
- $applications.pselect($.deploy())
- $._environment.reporter.report($this, 'Adding hosts...')
- $hosts: new(net:Hosts)
- $applications.select($hosts.addHostByInstance($.instance))
- $applications.select($hosts.applyTo($.instance))
- $._environment.reporter.report($this, 'Hosts added.')
deleteNodepool:
Usage: Action
Body:
- If: $this.nodepool = null
Then:
- Return:
- $._environment.reporter.report($this, 'Deleting Nodepool...')
- $this.nodepool.releaseResources()
- $this.nodepool: null
- $._environment.reporter.report($this, 'Nodepool is deleted. Now you can safely delete environment.')