Hashar has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401545 )

Change subject: Compile puppet catalogs in CI
......................................................................

Compile puppet catalogs in CI

Add rspec-puppet tasks at the root of the repository so one can easily
compile the catalogues.
First for a dummy host that has no role applied, and if successful for
each roles. That is done serially which is quite slow.

Bug: T183570
Change-Id: I4ca7a2b80d7b0ffb8b3fcef40c498b8c5dfc1ba0
X-Notable-Event: Happy-New-Gregorian-Year
---
M Rakefile
M puppet/spec/spec_helper.rb
2 files changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant 
refs/changes/45/401545/1

diff --git a/Rakefile b/Rakefile
index b057e5a..93a0b4a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -39,12 +39,25 @@
 RSpec::Core::RakeTask.new(:spec) do |t|
   t.rspec_opts = '-I tests/spec --default-path tests'
 end
+
+desc 'Compile default host Puppet catalog'
+RSpec::Core::RakeTask.new(:compile_host) do |t|
+  t.rspec_opts = '--format doc -I puppet/spec --default-path puppet --pattern 
spec/hosts/\*_spec.rb'
+end
+desc 'Compile Puppet roles'
+RSpec::Core::RakeTask.new(:compile_roles) do |t|
+  t.rspec_opts = '-I puppet/spec --default-path puppet --exclude-pattern 
spec/hosts/\*_spec.rb'
+end
+# Compile host first since it is fairly fast
+desc 'Compile puppet catalogs'
+task compile: [:compile_host, :compile_roles]
+
 RuboCop::RakeTask.new(:rubocop)
 
 task default: [:test]
 
 desc 'Run all build/tests commands (CI entry point)'
-task test: [:clean, :syntax, :spec, :rubocop, :cucumber, :lint, :doc]
+task test: [:clean, :syntax, :spec, :rubocop, :cucumber, :lint, :doc, :compile]
 
 desc 'Generate all documentations'
 task :doc do
diff --git a/puppet/spec/spec_helper.rb b/puppet/spec/spec_helper.rb
index ee86e07..a6e487d 100644
--- a/puppet/spec/spec_helper.rb
+++ b/puppet/spec/spec_helper.rb
@@ -1,4 +1,5 @@
 require 'rspec-puppet'
+require 'fileutils'
 
 def puppet_path
   File.expand_path(File.join(__FILE__, '../..'))
@@ -14,6 +15,7 @@
   conf = File.read(File.join(puppet_path, 'hiera.yaml'))
   conf.gsub!(%r{/vagrant/puppet}, puppet_path)
 
+  FileUtils.mkdir_p(fixture_path)
   fixture = File.join(fixture_path, 'hiera.yaml')
   File.write(fixture, conf)
 

-- 
To view, visit https://gerrit.wikimedia.org/r/401545
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ca7a2b80d7b0ffb8b3fcef40c498b8c5dfc1ba0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: stretch-migration
Gerrit-Owner: Hashar <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to