diff --git a/murano-apps/Jenkins/package/Classes/Jenkins.yaml b/murano-apps/Jenkins/package/Classes/Jenkins.yaml index 2980aea..8760b2d 100644 --- a/murano-apps/Jenkins/package/Classes/Jenkins.yaml +++ b/murano-apps/Jenkins/package/Classes/Jenkins.yaml @@ -69,6 +69,7 @@ Methods: - $.configureZMQPlugin() - $.configureGitPlugin($.gitUser, $.gitEmail) + - $.configureMavenPlugin() - If: $.instance.assignFloatingIp Then: @@ -155,6 +156,13 @@ Methods: - $template: $resources.yaml('ConfigureGit.template') - $.instance.agent.call($template, $resources) + configureMavenPlugin: + Body: + - $resources: new(sys:Resources) + - $._environment.reporter.report($this, 'Configure Jenkins Maven plugin...') + - $template: $resources.yaml('ConfigureMaven.template') + - $.instance.agent.call($template, $resources) + destroy: Body: - $.reportDestroyed() diff --git a/murano-apps/Jenkins/package/Resources/ConfigureMaven.template b/murano-apps/Jenkins/package/Resources/ConfigureMaven.template new file mode 100644 index 0000000..ce4a860 --- /dev/null +++ b/murano-apps/Jenkins/package/Resources/ConfigureMaven.template @@ -0,0 +1,19 @@ +FormatVersion: 2.1.0 +Version: 1.0.0 +Name: Configure Maven + +Body: | + return configureMaven().stdout + +Scripts: + configureMaven: + Type: Application + Version: 1.0.0 + EntryPoint: configure_maven.sh + Files: + - configure_maven/templates/hudson.tasks.Maven.xml.erb + - configure_maven/manifests/init.pp + - configure_maven.pp + Options: + captureStdout: true + captureStderr: true \ No newline at end of file diff --git a/murano-apps/Jenkins/package/Resources/scripts/configure_maven.pp b/murano-apps/Jenkins/package/Resources/scripts/configure_maven.pp new file mode 100644 index 0000000..0be1654 --- /dev/null +++ b/murano-apps/Jenkins/package/Resources/scripts/configure_maven.pp @@ -0,0 +1,6 @@ +node default { + class { 'configure_maven': + maven_name => 'MAVEN', + maven_id => '3.3.9', + } +} \ No newline at end of file diff --git a/murano-apps/Jenkins/package/Resources/scripts/configure_maven.sh b/murano-apps/Jenkins/package/Resources/scripts/configure_maven.sh new file mode 100644 index 0000000..accce8b --- /dev/null +++ b/murano-apps/Jenkins/package/Resources/scripts/configure_maven.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# No error if already exists. +mkdir -p /etc/puppet/modules/configure_maven +mkdir -p /etc/puppet/modules/configure_maven/manifests/ +mkdir -p /etc/puppet/modules/configure_maven/templates/ + +cp configure_maven/manifests/init.pp /etc/puppet/modules/configure_maven/manifests/ +cp configure_maven/templates/hudson.tasks.Maven.xml.erb /etc/puppet/modules/configure_maven/templates/ + +puppet apply configure_maven.pp \ No newline at end of file diff --git a/murano-apps/Jenkins/package/Resources/scripts/configure_maven/manifests/init.pp b/murano-apps/Jenkins/package/Resources/scripts/configure_maven/manifests/init.pp new file mode 100644 index 0000000..89772d8 --- /dev/null +++ b/murano-apps/Jenkins/package/Resources/scripts/configure_maven/manifests/init.pp @@ -0,0 +1,17 @@ +class configure_maven ( + $maven_name = undef, + $maven_id = undef, +) { + service { 'jenkins': + ensure => running, + enable => true, + } + file { '/var/lib/jenkins/hudson.tasks.Maven.xml': + notify => Service['jenkins'], + ensure => present, + owner => 'jenkins', + group => 'jenkins', + mode => '0644', + content => template('configure_maven/hudson.tasks.Maven.xml.erb'), + } +} \ No newline at end of file diff --git a/murano-apps/Jenkins/package/Resources/scripts/configure_maven/templates/hudson.tasks.Maven.xml.erb b/murano-apps/Jenkins/package/Resources/scripts/configure_maven/templates/hudson.tasks.Maven.xml.erb new file mode 100644 index 0000000..f521085 --- /dev/null +++ b/murano-apps/Jenkins/package/Resources/scripts/configure_maven/templates/hudson.tasks.Maven.xml.erb @@ -0,0 +1,17 @@ + + + + + <%= maven_name %> + + + + + <%= maven_id %> + + + + + + + \ No newline at end of file