From d4666d130a73be74f74c7c28fa674b1e10119ecb Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 1 Apr 2016 19:49:54 -0400 Subject: [PATCH] Implement a script to generate Puppetfile * Implement generate_puppetfile.sh This script will read from openstack_modules.txt and external_modules.txt that contain the list of Puppet modules we rely to run our CI. It will build a Puppetfile by using master for Puppet OpenStack modules and the latest tag for external modules. * Remove Puppetfile, that is not useful anymore since it's generated. * Run the script everytime our CI needs to install modules. Which means our CI will always test the latests versions of our external modules. * Allow to pin modules. Example: puppetlabs/puppetlabs-apache,1.8.1 Change-Id: I2d529cc16b335d112f996c9f1f0266f440eab065 --- Puppetfile | 151 ++++++++++++++++++++--------------------- external_modules.txt | 20 ++++++ generate_puppetfile.sh | 57 ++++++++++++++++ openstack_modules.txt | 29 ++++++++ 4 files changed, 178 insertions(+), 79 deletions(-) create mode 100644 external_modules.txt create mode 100755 generate_puppetfile.sh create mode 100644 openstack_modules.txt diff --git a/Puppetfile b/Puppetfile index 92104c19d..ba40579ff 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,5 +1,6 @@ -# OpenStack modules +# Auto-generated Puppetfile for Puppet OpenStack project +## OpenStack modules mod 'aodh', :git => 'https://git.openstack.org/openstack/puppet-aodh', :ref => 'master' @@ -108,10 +109,6 @@ mod 'trove', :git => 'https://git.openstack.org/openstack/puppet-trove', :ref => 'master' -mod 'tuskar', - :git => 'https://git.openstack.org/openstack/puppet-tuskar', - :ref => 'master' - mod 'vswitch', :git => 'https://git.openstack.org/openstack/puppet-vswitch', :ref => 'master' @@ -120,88 +117,84 @@ mod 'zaqar', :git => 'https://git.openstack.org/openstack/puppet-zaqar', :ref => 'master' -# External modules - -mod 'apache', - :git => 'https://github.com/puppetlabs/puppetlabs-apache', - :branch => '1.8.x' - -mod 'apt', - :git => 'https://github.com/puppetlabs/puppetlabs-apt', - :branch => '2.2.x' - -mod 'concat', - :git => 'https://github.com/puppetlabs/puppetlabs-concat', - :branch => '1.2.x' - -mod 'corosync', - :git => 'https://github.com/puppet-community/puppet-corosync', - :tag => '0.8.0' - -mod 'dns', - :git => 'https://github.com/theforeman/puppet-dns', - :tag => '3.1.0' - -mod 'firewall', - :git => 'https://github.com/puppetlabs/puppetlabs-firewall', - :branch => '1.7.x' - -mod 'inifile', - :git => 'https://github.com/puppetlabs/puppetlabs-inifile', - :branch => '1.4.x' - -mod 'memcached', - :git => 'https://github.com/saz/puppet-memcached', - :tag => 'v2.8.1' - -mod 'mongodb', - :git => 'https://github.com/puppetlabs/puppetlabs-mongodb', - :branch => '0.12.0' - -mod 'mysql', - :git => 'https://github.com/puppetlabs/puppetlabs-mysql', - :branch => '3.6.x' - -mod 'postgresql', - :git => 'https://github.com/puppetlabs/puppetlabs-postgresql', - :branch => '4.6.x' - +## External modules mod 'powerdns', :git => 'https://github.com/antonlindstrom/puppet-powerdns', - :tag => '0.0.5' - -mod 'python', - :git => 'https://github.com/stankevich/puppet-python', - :tag => '1.10.0' - -mod 'qpid', - :git => 'https://github.com/dprince/puppet-qpid', - :tag => '1.0.3' - -mod 'rabbitmq', - :git => 'https://github.com/puppetlabs/puppetlabs-rabbitmq', - :tag => '5.3.1' - -mod 'rsync', - :git => 'https://github.com/puppetlabs/puppetlabs-rsync', - :tag => '0.4.0' - -mod 'staging', - :git => 'https://github.com/nanliu/puppet-staging', - :tag => '1.0.4' - -mod 'stdlib', - :git => 'https://github.com/puppetlabs/puppetlabs-stdlib', - :branch => '4.9.x' + :ref => '0.0.5' mod 'sysctl', :git => 'https://github.com/duritong/puppet-sysctl', - :tag => 'v0.0.11' + :ref => 'v0.0.11' + +mod 'staging', + :git => 'https://github.com/nanliu/puppet-staging', + :ref => '1.0.4' + +mod 'corosync', + :git => 'https://github.com/puppet-community/puppet-corosync', + :ref => '0.8.0' + +mod 'apache', + :git => 'https://github.com/puppetlabs/puppetlabs-apache', + :ref => '1.8.1' + +mod 'apt', + :git => 'https://github.com/puppetlabs/puppetlabs-apt', + :ref => '2.2.2' + +mod 'concat', + :git => 'https://github.com/puppetlabs/puppetlabs-concat', + :ref => '1.2.5' + +mod 'firewall', + :git => 'https://github.com/puppetlabs/puppetlabs-firewall', + :ref => '1.8.0' + +mod 'inifile', + :git => 'https://github.com/puppetlabs/puppetlabs-inifile', + :ref => '1.5.0' + +mod 'mongodb', + :git => 'https://github.com/puppetlabs/puppetlabs-mongodb', + :ref => '0.13.0' + +mod 'mysql', + :git => 'https://github.com/puppetlabs/puppetlabs-mysql', + :ref => '3.7.0' + +mod 'postgresql', + :git => 'https://github.com/puppetlabs/puppetlabs-postgresql', + :ref => '4.7.1' + +mod 'rabbitmq', + :git => 'https://github.com/puppetlabs/puppetlabs-rabbitmq', + :ref => '5.3.1' + +mod 'rsync', + :git => 'https://github.com/puppetlabs/puppetlabs-rsync', + :ref => '0.4.0' + +mod 'stdlib', + :git => 'https://github.com/puppetlabs/puppetlabs-stdlib', + :ref => '4.11.0' mod 'vcsrepo', :git => 'https://github.com/puppetlabs/puppetlabs-vcsrepo', - :branch => '1.3.x' + :ref => '1.3.2' mod 'xinetd', :git => 'https://github.com/puppetlabs/puppetlabs-xinetd', - :tag => '1.5.0' + :ref => '1.5.0' + +mod 'memcached', + :git => 'https://github.com/saz/puppet-memcached', + :ref => 'v2.8.1' + +mod 'python', + :git => 'https://github.com/stankevich/puppet-python', + :ref => '1.12.0' + +mod 'dns', + :git => 'https://github.com/theforeman/puppet-dns', + :ref => '3.2.0' + diff --git a/external_modules.txt b/external_modules.txt new file mode 100644 index 000000000..43cd59b6d --- /dev/null +++ b/external_modules.txt @@ -0,0 +1,20 @@ +antonlindstrom/puppet-powerdns +duritong/puppet-sysctl +nanliu/puppet-staging +puppet-community/puppet-corosync +puppetlabs/puppetlabs-apache +puppetlabs/puppetlabs-apt +puppetlabs/puppetlabs-concat,1.2.5 +puppetlabs/puppetlabs-firewall +puppetlabs/puppetlabs-inifile +puppetlabs/puppetlabs-mongodb +puppetlabs/puppetlabs-mysql +puppetlabs/puppetlabs-postgresql +puppetlabs/puppetlabs-rabbitmq +puppetlabs/puppetlabs-rsync +puppetlabs/puppetlabs-stdlib +puppetlabs/puppetlabs-vcsrepo +puppetlabs/puppetlabs-xinetd +saz/puppet-memcached +stankevich/puppet-python +theforeman/puppet-dns diff --git a/generate_puppetfile.sh b/generate_puppetfile.sh new file mode 100755 index 000000000..3af28919d --- /dev/null +++ b/generate_puppetfile.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# +# Build a Puppetfile with latest dependencies +# + +# cleanup +rm -rf modules Puppetfile +mkdir modules + +# header +echo -e "# Auto-generated Puppetfile for Puppet OpenStack project\n" > Puppetfile + +# OpenStack Modules +echo "## OpenStack modules" >> Puppetfile +for p in $(cat openstack_modules.txt); do + # hack for puppet-openstack-integration + # where namespace is openstack_integration + title=$(echo $p | sed 's/-/_/g') + # TODO(emilien) we need to add support for stable branches + cat >> Puppetfile < 'https://git.openstack.org/openstack/puppet-$p', + :ref => 'master' + +EOF +done + +# External Modules +echo -e "## External modules" >> Puppetfile +for e in $(cat external_modules.txt); do + namespace=$(echo $e | awk -F'/' '{print $1}' | cut -d "," -f 1) + module=$(echo $e | awk -F'/' '{print $2}' | cut -d "," -f 1) + title=$(echo $module | awk -F'/' '{print $1}' | cut -d "-" -f 2) + pin=$(echo $e | grep "," | cut -d "," -f 2) + if [ ! -z "$pin" ]; then + git ls-remote --exit-code https://github.com/$namespace/$module $pin + if (($? == 2)); then + echo "Wrong pin: $pin does not exist in $module module." + exit 1 + else + tag=$pin + fi + else + git clone https://github.com/$namespace/$module modules/$module + tag=$(cd modules/$module; git describe --tags $(git rev-list --tags --max-count=1)) + rm -rf modules/$module + fi + cat >> Puppetfile < 'https://github.com/$namespace/$module', + :ref => '$tag' + +EOF +done + +# for debug +cat Puppetfile diff --git a/openstack_modules.txt b/openstack_modules.txt new file mode 100644 index 000000000..bf8b9f059 --- /dev/null +++ b/openstack_modules.txt @@ -0,0 +1,29 @@ +aodh +barbican +ceilometer +ceph +cinder +designate +glance +gnocchi +heat +horizon +ironic +keystone +manila +mistral +monasca +murano +neutron +nova +octavia +openstack-integration +openstack_extras +openstacklib +oslo +sahara +swift +tempest +trove +vswitch +zaqar