jenkins-bot has submitted this change and it was merged.

Change subject: Generate Puppet config_version from short SHA1 of HEAD
......................................................................


Generate Puppet config_version from short SHA1 of HEAD

This patch tells Puppet to generate the configuration version by capturing the
output of puppet/extra/config-version. That script gets the short SHA1 hash of
HEAD for MediaWiki-Vagrant and the current UTC timestamp and joins them with a
period (for example, '1373576256.89684db'). If it is unable to determine the
Git commit of HEAD, the second field is set to 'no-git' (for example,
'1373576256.no-git').

Puppet uses the configuration version to label its log output. By including the
time and SCM info, it should be easier to correlate Puppet logs to specific
changes. For details, see the Puppet manual: <http://docs.puppetlabs.com/
references/latest/configuration.html#configversion>

Change-Id: Ia11d7cbd686078ccbaca524377addbe1645cf754
---
M Vagrantfile
A puppet/extra/config-version
2 files changed, 20 insertions(+), 0 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Vagrantfile b/Vagrantfile
index 3b87391..1017eec 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -83,6 +83,7 @@
             '--node_terminus', 'exec',
             '--external_nodes', '/vagrant/puppet/extra/puppet-classifier',
             '--verbose',
+            '--config_version', '/vagrant/puppet/extra/config-version',
             '--logdest', '/vagrant/logs/puppet.log',
             '--logdest', 'console',
         ]
diff --git a/puppet/extra/config-version b/puppet/extra/config-version
new file mode 100755
index 0000000..b352cb1
--- /dev/null
+++ b/puppet/extra/config-version
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Prior to each Puppet run, Puppet will invoke this script to determine the
+# configuration version. This script will generate a version string of the
+# format 'NNNNNNNNNN.XXXXXXX', where 'NNN..' is the current UTC UNIX time and
+# 'XXX..' is the short SHA1 hash of the HEAD commit of MediaWiki-Vagrant.
+#
+# If no Git info is available (as would happen if MediaWiki-Vagrant was
+# obtained via a tarball, rather than git-clone), the second field is set to
+# 'no-git'.
+#
+# Puppet uses the configuration version as a label for its log output.
+# Including the timestamp and commit in the version makes it easier to
+# correlate logs to specific changes.
+#
+# For more information, see the Puppet manual:
+# 
<http://docs.puppetlabs.com/references/latest/configuration.html#configversion>
+#
+HEAD="$(git --git-dir="/vagrant/.git" rev-parse --short HEAD 2>/dev/null)"
+echo "$(date -u +%s).${HEAD:-no-git}"

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia11d7cbd686078ccbaca524377addbe1645cf754
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to