Please review pull request #113: Support reuse of an existing git repository checkout. opened by (daniel-pittman)

Description:

Previously the suite would delete the entire git source checkouts, then fetch
them from scratch. This would ensure that the content was clean, but wasn't
actually terribly efficient since almost all content was identical each time.

Now, we clone if the repository is missing, but otherwise update the origin
remote to whatever we are targeted at, then fetch that. This has the same net
effect but avoids fetching 36+MB every time the suite runs.

Signed-off-by: Daniel Pittman dan...@rimspace.net

  • Opened: Fri Jan 20 20:30:56 UTC 2012
  • Based on: puppetlabs:master (f1cdf8eebae89653161ffa017e11000b94261fba)
  • Requested merge: daniel-pittman:faster-rerun-through-checkout-reuse (1bae816e0630e56823c3c40234d82bc6e0a9bb4f)

Diff follows:

diff --git a/setup/git/01_TestSetup.rb b/setup/git/01_TestSetup.rb
index acebfa5..38444a9 100755
--- a/setup/git/01_TestSetup.rb
+++ b/setup/git/01_TestSetup.rb
@@ -31,8 +31,15 @@
 end
 
 def install_from_git(host, package, repo, revision)
-  step "Clone #{repo}"
-  on host, "cd #{SourcePath} && git clone #{repo} #{package}"
+  target = "#{SourcePath}/#{package}"
+
+  step "Clone #{repo} if needed"
+  on host, "cd #{SourcePath} && test -d #{package} || git clone #{repo} #{package}"
+
+  step "Update origin for #{package}"
+  on host, "cd #{target} && git remote rm origin"
+  on host, "cd #{target} && git remote add origin #{repo}"
+  on host, "cd #{target} && git fetch origin"
 
   step "Check out the revision #{revision}"
   on host, "cd #{SourcePath}/#{package} && git checkout #{revision}"
@@ -50,13 +57,13 @@ def install_from_git(host, package, repo, revision)
   on host, "echo #{github_sig} >> $HOME/.ssh/known_hosts"
   host['pluginlibpath'] = pluginlibpath
 
-  step "Clean and create #{SourcePath}"
-  on host, "rm -rf #{SourcePath} && mkdir -vp #{SourcePath}"
-
+  step "Install facter from git"
   install_from_git host, :facter, FacterRepo, FacterRev
+  step "Install puppet from git"
   install_from_git host, :puppet, PuppetRepo, PuppetRev
 
   package_names.zip(options[:plugins]).each do |package, repo|
+    step "Install #{package} plugin from git"
     install_from_git host, package, repo, 'master'
   end
 
diff --git a/setup/git/03_ValidateSignCert.rb b/setup/git/03_ValidateSignCert.rb
index 11c6cef..b8288b1 100755
--- a/setup/git/03_ValidateSignCert.rb
+++ b/setup/git/03_ValidateSignCert.rb
@@ -3,7 +3,7 @@
 step "Master: Start Puppet Master"
 with_master_running_on(master, "--dns_alt_names=\"puppet,$(hostname -s),$(hostname -f)\" --verbose") do
   step "Agents: Run agent --test first time to gen CSR"
-  on agents, puppet_agent("--test"), :acceptable_exit_codes => [1]
+  on agents, puppet_agent("--test"), :acceptable_exit_codes => [0,1,2]
 
   # Sign all waiting certs
   step "Master: sign all certs"

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to