diff --git a/murano-apps/CiCdEnvironment/package/Classes/CiCdEnvironment.yaml b/murano-apps/CiCdEnvironment/package/Classes/CiCdEnvironment.yaml new file mode 100644 index 0000000..3dc0016 --- /dev/null +++ b/murano-apps/CiCdEnvironment/package/Classes/CiCdEnvironment.yaml @@ -0,0 +1,93 @@ +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: CiCdEnvironment + +Extends: std:Application + +Properties: + 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, format('Deploying CI/CD')) + + - $user: 'user' + - $password: 'P@ssw0rd' + + # OpenLDAP + - $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(opaas:OpenLDAP, $._environment, + name => 'OpenLDAP', + instance => $ldapInstance, + domain => 'infra.local', + ldapRootUser => 'root', + ldapRootPass => 'openstack', + ldapUser => $user, + ldapPass => $password) + + # Gerrit + - $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(opaas:Gerrit, $this, name => 'Gerrit', instance => $gerritInstance) + + # Jenkins + - $._environment.reporter.report($this, + 'Jenkins credentials user={0}, password={1}'.format( + $user, $password)) + - $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(opaas:Jenkins, $._environment, + name => 'Jenkins', + instance => $jenkinsInstance, + ldap => $this.ldap, + cfplugin => false) + + # Deploy all + - Parallel: + - $this.ldap.deploy() + - $this.gerrit.deploy() + - $this.jenkins.deploy() diff --git a/murano-apps/CiCdEnvironment/package/UI/ui.yaml b/murano-apps/CiCdEnvironment/package/UI/ui.yaml new file mode 100644 index 0000000..4639e6a --- /dev/null +++ b/murano-apps/CiCdEnvironment/package/UI/ui.yaml @@ -0,0 +1,60 @@ +Version: 2 + +Application: + ?: + type: io.murano.opaas.CiCdEnvironment + name: 'CI/CD' + instance_name: generateHostname($.instanceConfiguration.unitNamingPattern, 1) + flavor: $.instanceConfiguration.flavor + image: $.instanceConfiguration.osImage + keyname: $.instanceConfiguration.keyPair + availabilityZone: $.instanceConfiguration.availabilityZone + assignFloatingIp: true + +Forms: + - 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.medium + 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/CiCdEnvironment/package/logo.png b/murano-apps/CiCdEnvironment/package/logo.png new file mode 100644 index 0000000..7d709dd Binary files /dev/null and b/murano-apps/CiCdEnvironment/package/logo.png differ diff --git a/murano-apps/CiCdEnvironment/package/manifest.yaml b/murano-apps/CiCdEnvironment/package/manifest.yaml new file mode 100644 index 0000000..35e6f01 --- /dev/null +++ b/murano-apps/CiCdEnvironment/package/manifest.yaml @@ -0,0 +1,17 @@ +Format: 1.0 +Type: Application +FullName: io.murano.opaas.CiCdEnvironment +Name: CI/CD +Description: | + The One-click CI/CD installer +Author: 'Mirantis, Inc' +Tags: [CI] +Classes: + io.murano.opaas.CiCdEnvironment: CiCdEnvironment.yaml +UI: ui.yaml +Logo: logo.png +Require: + io.murano.opaas.OpenLDAP: + io.murano.opaas.Jenkins: + io.murano.opaas.Gerrit: + io.murano.opaas.puppet.Puppet: