diff --git a/murano-apps/Zuul/package/Classes/Zuul.yaml b/murano-apps/Zuul/package/Classes/Zuul.yaml new file mode 100644 index 0000000..75bb889 --- /dev/null +++ b/murano-apps/Zuul/package/Classes/Zuul.yaml @@ -0,0 +1,86 @@ +Namespaces: + =: io.murano.opaas + std: io.murano + res: io.murano.resources + sys: io.murano.system + opaas: io.murano.opaas + puppet: io.murano.opaas.puppet + +Name: Zuul + +Extends: std:Application + +Properties: + name: + Contract: $.string() + Default: ZuulApp + instance: + Contract: $.class(puppet:PuppetInstance).notNull() + gerrit_server: + Contract: $.string().notNull() + gerrit_user: + Contract: $.string().notNull() + + #nodepool_server: + # Contract: $.string().notNull() + #jenkins_server: + # Contract: $.string().notNull() + +Methods: + .init: + Body: + - $._environment: $.find(std:Environment).require() + + deploy: + Body: + - $.super($.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.openstackId)) + - $.instance.deploy() + - $._environment.reporter.report($this, 'Zuul VM {0} is created'.format($.instance.openstackId)) + + - $this.projectConfig: new(puppet:ProjectConfig) + - $this.projectConfig.installOnTheNode($this.instance) + + - $.instance.setHieraValue('project_config_repo', 'https://review.fuel-infra.org/open-paas/project-config') + - $.instance.setHieraValue('gerrit_server', $.gerrit_server) + - $.instance.setHieraValue('gerrit_user', $.gerrit_user) + #- $.instance.setHieraValue('nodepool_server', $.nodepool_server) + #- $.instance.setHieraValue('jenkins_server', $.jenkins_server) + - $.instance.setHieraValue('gerrit_ssh_rsa_pubkey_contents', 'gerrit_ssh_rsa_pubkey_contents') + - $.instance.setHieraValue('zuul_ssh_private_key_contents', 'zuul_ssh_private_key_contents') + + - $resources: new(sys:Resources) + - $template: $resources.yaml('DeployZuul.template') + - $._environment.reporter.report($this, 'Zuul is deploying') + - $.instance.agent.call($template, $resources) + + - If: $.instance.assignFloatingIp + Then: + - $host: $.instance.floatingIpAddress + Else: + - $host: $.instance.ipAddresses[0] + - $._environment.reporter.report($this, 'Zuul is available at {0}:8080'.format($host)) + - $.setAttr(deployed, true) + + destroy: + Body: + - $.reportDestroyed() + - $.setAttr(deployed, false) diff --git a/murano-apps/Zuul/package/Resources/DeployZuul.template b/murano-apps/Zuul/package/Resources/DeployZuul.template new file mode 100644 index 0000000..a4818a6 --- /dev/null +++ b/murano-apps/Zuul/package/Resources/DeployZuul.template @@ -0,0 +1,16 @@ +FormatVersion: 2.1.0 +Version: 1.0.0 +Name: Deploy Zuul + +Body: | + return deploy().stdout + +Scripts: + deploy: + Type: Application + Version: 1.0.0 + EntryPoint: deploy.sh + Files: ['site.pp'] + Options: + captureStdout: true + captureStderr: true \ No newline at end of file diff --git a/murano-apps/Zuul/package/Resources/scripts/deploy.sh b/murano-apps/Zuul/package/Resources/scripts/deploy.sh new file mode 100644 index 0000000..1edd7fd --- /dev/null +++ b/murano-apps/Zuul/package/Resources/scripts/deploy.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +puppet apply site.pp \ No newline at end of file diff --git a/murano-apps/Zuul/package/Resources/scripts/site.pp b/murano-apps/Zuul/package/Resources/scripts/site.pp new file mode 100644 index 0000000..4bb00b1 --- /dev/null +++ b/murano-apps/Zuul/package/Resources/scripts/site.pp @@ -0,0 +1,30 @@ +node default { + class { 'openstackci::zuul_scheduler': + vhost_name => $vhost_name, + gearman_server => '127.0.0.1', + gerrit_server => hiera('gerrit_server'), + gerrit_user => hiera('gerrit_user'), + #known_hosts_content => "review.openstack.org,104.130.159.134,2001:4800:7818:102:be76:4eff:fe05:9b12 ${gerrit_ssh_host_key}", + zuul_ssh_private_key => hiera('zuul_ssh_private_key_contents'), + #url_pattern => $url_pattern, + zuul_url => 'http://zuul.mirantis.com/p', + job_name_in_report => true, + status_url => 'http://status.mirantis.com/zuul/', + #swift_authurl => $swift_authurl, + #swift_auth_version => $swift_auth_version, + #swift_user => $swift_user, + #swift_key => $swift_key, + #swift_tenant_name => $swift_tenant_name, + #swift_region_name => $swift_region_name, + #swift_default_container => $swift_default_container, + #swift_default_logserver_prefix => $swift_default_logserver_prefix, + #swift_default_expiry => $swift_default_expiry, + #proxy_ssl_cert_file_contents => $proxy_ssl_cert_file_contents, + #proxy_ssl_key_file_contents => $proxy_ssl_key_file_contents, + #proxy_ssl_chain_file_contents => $proxy_ssl_chain_file_contents, + #statsd_host => $statsd_host, + project_config_repo => hiera('project_config_repo'), + git_email => 'jenkins@openstack.org', + git_name => 'OpenStack Jenkins', + } +} \ No newline at end of file diff --git a/murano-apps/Zuul/package/UI/ui.yaml b/murano-apps/Zuul/package/UI/ui.yaml new file mode 100644 index 0000000..cf90d42 --- /dev/null +++ b/murano-apps/Zuul/package/UI/ui.yaml @@ -0,0 +1,97 @@ +Version: 2 + +Application: + ?: + type: io.murano.opaas.Zuul + name: $.appConfiguration.name + gerrit_server: $.appConfiguration.GerritServer + gerrit_user: $.appConfiguration.GerritUser +# nodepool_server: $.appConfiguration.NodepoolServer +# jenkins_server: $.appConfiguration.JenkinsServer + instance: + ?: + type: io.murano.opaas.puppet.PuppetInstance + name: generateHostname($.instanceConfiguration.unitNamingPattern, 1) + flavor: $.instanceConfiguration.flavor + image: $.instanceConfiguration.osImage + keyname: $.instanceConfiguration.keyPair + availabilityZone: $.instanceConfiguration.availabilityZone + assignFloatingIp: $.appConfiguration.assignFloatingIP + +Forms: + - appConfiguration: + fields: + - name: name + type: string + label: Application Name + initial: ZuulApp + - name: GerritServer + type: string + label: Gerrit Server + description: Gerrit Server + - name: GerritUser + type: string + label: Gerrit User + description: Gerrit User +# - name: NodepoolServer +# type: string +# label: Nodepool Server +# description: Nodepool Server +# - name: JenkinsServer +# type: string +# label: Jenkins Server +# description: Jenkins Server + - name: assignFloatingIP + type: boolean + label: Assign Floating IP + description: >- + Select to true to assign floating IP automatically + initial: true + required: false + + - instanceConfiguration: + fields: + - name: title + type: string + required: false + hidden: true + description: Specify some instance parameters on which the application would be created + - name: flavor + type: flavor + label: Instance flavor + description: >- + Select registered in Openstack flavor. Consider that application performance + depends on this parameter. + initial: m1.tiny + required: false + - name: osImage + type: image + imageType: linux + label: Instance image + description: >- + Select a valid image for the application. Image should already be prepared and + registered in glance. + - name: keyPair + type: keypair + label: Key Pair + description: >- + Select a Key Pair to control access to instances. You can login to + instances using this KeyPair after the deployment of application. + required: false + - name: availabilityZone + type: azone + label: Availability zone + description: Select availability zone where the application would be installed. + required: false + - name: unitNamingPattern + type: string + label: Instance Naming Pattern + required: false + maxLength: 200 + regexpValidator: '^[-_\w]+$' + errorMessages: + invalid: Just letters, numbers, underscores and hyphens are allowed. + helpText: Just letters, numbers, underscores and hyphens are allowed. + description: >- + Specify a string, that will be used in instance hostname. + Just A-Z, a-z, 0-9, dash and underline are allowed. diff --git a/murano-apps/Zuul/package/manifest.yaml b/murano-apps/Zuul/package/manifest.yaml new file mode 100644 index 0000000..71cca3e --- /dev/null +++ b/murano-apps/Zuul/package/manifest.yaml @@ -0,0 +1,14 @@ +Format: 1.0 +Type: Application +FullName: io.murano.opaas.Zuul +Name: Zuul +Description: | + Zuul is a pipeline oriented project gating and automation system. +Author: 'Mirantis, Inc' +Tags: [CI, Zuul] +Classes: + io.murano.opaas.Zuul: Zuul.yaml +UI: ui.yaml +Require: + io.murano.opaas.puppet.Puppet: + io.murano.opaas.puppet.ProjectConfig: \ No newline at end of file