Ori.livneh has submitted this change and it was merged.
Change subject: Updating git::clone so that gerrit urls can be assumed by
default
......................................................................
Updating git::clone so that gerrit urls can be assumed by default
e.g. git::clone { 'analytics/wikimetrics': directory => '/srv/wikimetrics' }
This will clone analytics/wikimetrics from gerrit.
This is also for compatibility with the mediawiki-vagrant git::clone define,
so that submodules shared between mediawiki-vagrant and operations/puppet
and that use git::clone will work in both.
Change-Id: Id76ff8bd9896d188d0a2c65d19e9d456be01d22f
---
M modules/git/manifests/clone.pp
1 file changed, 19 insertions(+), 4 deletions(-)
Approvals:
Ori.livneh: Verified; Looks good to me, approved
diff --git a/modules/git/manifests/clone.pp b/modules/git/manifests/clone.pp
index c6be77a..654fc2b 100644
--- a/modules/git/manifests/clone.pp
+++ b/modules/git/manifests/clone.pp
@@ -5,10 +5,12 @@
# === Required parameters
#
# $+directory+:: path to clone the repository into.
-# $+origin+:: Origin repository URL.
#
# === Optional parameters
#
+# $+origin+:: If this is not specified, the the $title repository will be
+# checked out from gerrit using a default gerrit url.
+# If you set this, please specify the full repository url.
# $+branch+:: Branch you would like to check out.
# $+ensure+:: _absent_, _present_, or _latest_. Defaults to _present_.
# - _present_ (default) will just clone once.
@@ -23,7 +25,7 @@
#
# === Example usage
#
-# git::clone{ 'my_clone_name':
+# git::clone { 'my_clone_name':
# directory => '/path/to/clone/container',
# origin => 'http://blabla.org/core.git',
# branch => 'the_best_branch'
@@ -31,9 +33,15 @@
#
# Will clone +http://blabla.org/core.git+ branch +the_best_branch+ at
# +/path/to/clone/container/core+
+#
+# # Example: check out from gerrit:
+# git::clone { 'analytics/wikimetrics':
+# directory = '/srv/wikimetrics',
+# }
+#
define git::clone(
$directory,
- $origin,
+ $origin=undef,
$branch='',
$ssh='',
$ensure='present',
@@ -42,6 +50,13 @@
$timeout='300',
$depth='full',
$mode=0755) {
+
+ $gerrit_url_format = 'https://gerrit.wikimedia.org/r/p/%s.git'
+
+ $remote = $origin ? {
+ undef => sprintf($gerrit_url_format, $title),
+ default => $origin,
+ }
case $ensure {
'absent': {
@@ -76,7 +91,7 @@
Exec { path => '/usr/bin:/bin' }
# clone the repository
exec { "git_clone_${title}":
- command => "git clone ${brancharg}${origin}${deptharg}
$directory",
+ command => "git clone ${brancharg}${remote}${deptharg}
$directory",
logoutput => on_failure,
cwd => '/tmp',
environment => $env,
--
To view, visit https://gerrit.wikimedia.org/r/108537
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id76ff8bd9896d188d0a2c65d19e9d456be01d22f
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ottomata <[email protected]>
Gerrit-Reviewer: Andrew Bogott <[email protected]>
Gerrit-Reviewer: Matanya <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits