
After patch Ia2498bdb0f7c310ec3d2c2f11f5d3fc08c8b352c there is possible to run check for yaml and shell syntax. This patch is oriented to fix some similar Warnings reported in yaml syntax check for CI/CD apps, like "(indentation)". Change-Id: Ie2d854e6feef6362ea07d6132e71072dae49b5d7
132 lines
4.7 KiB
YAML
132 lines
4.7 KiB
YAML
Namespaces:
|
|
=: org.openstack.ci_cd_pipeline_murano_app
|
|
std: io.murano
|
|
sys: io.murano.system
|
|
puppet: org.openstack.ci_cd_pipeline_murano_app.puppet
|
|
conf: io.murano.configuration
|
|
|
|
Name: Zuul
|
|
|
|
Extends: std:Application
|
|
|
|
Properties:
|
|
name:
|
|
Contract: $.string()
|
|
Default: Zuul
|
|
instance:
|
|
Contract: $.class(puppet:PuppetInstance).notNull()
|
|
gerrit:
|
|
Contract: $.class(Gerrit)
|
|
systemConfigRepo:
|
|
Contract: $.class(puppet:SystemConfig)
|
|
Methods:
|
|
.init:
|
|
Body:
|
|
- $._environment: $.find(std:Environment).require()
|
|
|
|
deploy:
|
|
Body:
|
|
- super($this, $.deploy())
|
|
- If: not $.getAttr(deployed, false)
|
|
Then:
|
|
- $._environment.reporter.report($this, 'Creating security group for Zuul')
|
|
- $securityGroupIngress:
|
|
- ToPort: 80
|
|
FromPort: 80
|
|
IpProtocol: tcp
|
|
External: true
|
|
- ToPort: 443
|
|
FromPort: 443
|
|
IpProtocol: tcp
|
|
External: true
|
|
- ToPort: 4730
|
|
FromPort: 4730
|
|
IpProtocol: tcp
|
|
External: true
|
|
- $._environment.securityGroupManager.addGroupIngress($securityGroupIngress)
|
|
|
|
- $._environment.reporter.report($this, 'Creating VM for Zuul "{0}"'.format($.instance.name))
|
|
- $.instance.deploy()
|
|
- $._environment.reporter.report($this, 'Zuul VM "{0}" with id {1} created'.format($.instance.name, $.instance.openstackId))
|
|
|
|
# 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...')
|
|
- $.gerrit.deploy()
|
|
|
|
- If: $.instance.assignFloatingIp
|
|
Then:
|
|
- $host: $.instance.floatingIpAddress
|
|
Else:
|
|
- $host: $.instance.ipAddresses[0]
|
|
|
|
- $.createConfiguration()
|
|
- $.instance.setHieraValue('zuul_host', $host)
|
|
|
|
- $resources: new(sys:Resources)
|
|
- $template: $resources.yaml('DeployZuul.template')
|
|
- $._environment.reporter.report($this, 'Zuul is deploying...')
|
|
- $.instance.agent.call($template, $resources)
|
|
|
|
- $._environment.reporter.report($this, 'Creating Zuul user in Gerrit')
|
|
- $zuul_pubkey: $.instance.getHieraValue('zuul_ssh_pubkey_contents')
|
|
- $.gerrit.createAccount('Non-Interactive Users', 'Zuul', 'zuul@lists.openstack.org', $zuul_pubkey, 'zuul')
|
|
|
|
- $linux: new(conf:Linux)
|
|
- $linux.runCommand($.instance.agent, 'service zuul start')
|
|
- $linux.runCommand($.instance.agent, 'service zuul-merger restart')
|
|
|
|
- $._switchProjectConfig()
|
|
- $._createPeriodicLayoutUpdate()
|
|
- $._environment.reporter.report($this, 'Zuul is available at http://{0}:80'.format($host))
|
|
- $.setAttr(deployed, true)
|
|
|
|
createConfiguration:
|
|
Body:
|
|
- $gerritInstance: $.gerrit.instance
|
|
- If: $gerritInstance.assignFloatingIp
|
|
Then:
|
|
- $gerritHost: $gerritInstance.floatingIpAddress
|
|
Else:
|
|
- $gerritHost: $gerritInstance.ipAddresses[0]
|
|
|
|
- $.instance.setHieraValue('gerrit_server', $gerritHost)
|
|
- $.instance.setHieraValue('gerrit_user', 'zuul')
|
|
- $.instance.setHieraValue('gerrit_ssh_host_key', $.gerrit.instance.getHieraValue('gerrit_ssh_rsa_pubkey_contents'))
|
|
|
|
_switchProjectConfig:
|
|
Body:
|
|
- $resources: new(sys:Resources)
|
|
- $linux: new(conf:Linux)
|
|
- $script: $resources.string('scripts/switch_to_local_project_config.sh')
|
|
- $._environment.reporter.report($this, '[Zuul] Switching to project-config from installed Gerrit...')
|
|
- $projectConfigURL: format(
|
|
'ssh://{0}@{1}:29418/open-paas/project-config',
|
|
$.instance.getHieraValue('gerrit_user'),
|
|
$.instance.getHieraValue('gerrit_server')
|
|
)
|
|
- $.instance.setHieraValue('project_config_repo', $projectConfigURL)
|
|
- $linux.runCommand($.instance.agent, $script)
|
|
|
|
_createPeriodicLayoutUpdate:
|
|
Body:
|
|
- $resources: new(sys:Resources)
|
|
- $linux: new(conf:Linux)
|
|
- $script: $resources.string('scripts/update_layout.sh')
|
|
- $._environment.reporter.report($this, '[Zuul] Creating autoupdating layout.yaml file...')
|
|
- $linux.putFile($.instance.agent, $script, '/usr/local/bin/update_layout.sh')
|
|
|
|
- $manifest: $resources.string('scripts/update_layout.pp')
|
|
- $this.instance.applyManifest($manifest, 60)
|
|
|
|
destroy:
|
|
Body:
|
|
- $.reportDestroyed()
|
|
- $.setAttr(deployed, false)
|