Giuseppe Lavagetto has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/138614

Change subject: puppet-compiler: work better with jenkins + fixes
......................................................................

puppet-compiler: work better with jenkins + fixes

- Now each jenkins run will have its own output directory
- Fixed an error when trying to copy naggen2 as non-root
- Now the production branch and the private repo get refreshed at each
  run

Change-Id: I6c27917c7e4b2f85d5a95be05e98b7119caf8607
Signed-off-by: Giuseppe Lavagetto <[email protected]>
---
M compare-puppet-catalogs/puppet_compare/app_defaults.py
M compare-puppet-catalogs/puppet_compare/generator.py
M compare-puppet-catalogs/shell/helper
M compare-puppet-catalogs/shell/prepare_change
4 files changed, 17 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/software 
refs/changes/14/138614/1

diff --git a/compare-puppet-catalogs/puppet_compare/app_defaults.py 
b/compare-puppet-catalogs/puppet_compare/app_defaults.py
index c56c6d0..9684275 100644
--- a/compare-puppet-catalogs/puppet_compare/app_defaults.py
+++ b/compare-puppet-catalogs/puppet_compare/app_defaults.py
@@ -3,12 +3,17 @@
 PARENT=os.path.realpath(os.path.join(MYDIR,'..'))
 BASEDIR = os.environ.get('PUPPET_COMPILER_BASEDIR', PARENT)
 get_path = lambda x: os.path.join(BASEDIR, x)
+
 COMPILE_SCRIPT = get_path('shell/compile')
 FETCH_CHANGE = get_path('shell/prepare_change')
+HELPER_SCRIPT = get_path('shell/helper')
 DIFF_SCRIPT = get_path('shell/differ')
 NODE_DIR = get_path('external/var/yaml/node')
 PUPPET_VERSIONS = [('2.7', 'production'), ('3', 'production')]
-OUTPUT_DIR = get_path('output')
+
+bdir = get_path('output')
+# Jenkins support
+OUTPUT_DIR = os.path.join(bdir, os.environ.get('BUILD_NUMBER', ''))
 COMPILE_OUTPUT_DIR = os.path.join(OUTPUT_DIR, 'compiled')
 DIFF_DIR = os.path.join(OUTPUT_DIR, 'diff')
 HTML_DIR = os.path.join(OUTPUT_DIR, 'html')
diff --git a/compare-puppet-catalogs/puppet_compare/generator.py 
b/compare-puppet-catalogs/puppet_compare/generator.py
index 2496be6..708911f 100644
--- a/compare-puppet-catalogs/puppet_compare/generator.py
+++ b/compare-puppet-catalogs/puppet_compare/generator.py
@@ -207,7 +207,14 @@
                 self.nodelist['ERROR'].add(node)
         self.node_output(node)
 
+    def _refresh_main(self):
+        cmd = "{} {}".format(app.config.get('HELPER_SCRIPT'), 'install')
+        log.info('Refreshing the base installation')
+        run(cmd)
+
     def run(self):
+        if self.change is None:
+            self._refresh_main()
         threadpool = threads.ThreadOrchestrator(self.tp_size)
         for node in self.node_generator():
             threadpool.add(self._run_node, node)
diff --git a/compare-puppet-catalogs/shell/helper 
b/compare-puppet-catalogs/shell/helper
index 52e84f6..874dc9e 100755
--- a/compare-puppet-catalogs/shell/helper
+++ b/compare-puppet-catalogs/shell/helper
@@ -123,8 +123,9 @@
 }
 
 function setup_naggen() {
-    if [ ! -f /usr/local/bin/naggen ];  then
-        cp ${PUPPETDIR}/modules/puppetmaster/files/naggen /usr/local/bin/naggen
+    if [ ! -f /usr/local/bin/naggen2 -a $UID -eq 0 ];  then
+        # do this on vagrant only, where we run as root.
+        cp ${PUPPETDIR}/modules/puppetmaster/files/naggen2 
/usr/local/bin/naggen2
     fi;
 }
 
diff --git a/compare-puppet-catalogs/shell/prepare_change 
b/compare-puppet-catalogs/shell/prepare_change
index b2d4674..400f986 100755
--- a/compare-puppet-catalogs/shell/prepare_change
+++ b/compare-puppet-catalogs/shell/prepare_change
@@ -14,4 +14,4 @@
 echo "Preparing the dir for change ${CHANGE}"
 ${DIR}/helper install ${CHANGE} ${REVISION}
 PARENT=$(readlink -f ${DIR}/../)
-mkdir -p ${PARENT}/output/change/${CHANGE}/{html,compiled,diff}
+mkdir -p ${PARENT}/output/${BUILD_NUMBER}/change/${CHANGE}/{html,compiled,diff}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6c27917c7e4b2f85d5a95be05e98b7119caf8607
Gerrit-PatchSet: 1
Gerrit-Project: operations/software
Gerrit-Branch: master
Gerrit-Owner: Giuseppe Lavagetto <[email protected]>

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

Reply via email to