Andrew Bogott has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/362928 )

Change subject: Labs: Update cdnjs clone commands
......................................................................


Labs: Update cdnjs clone commands

Running `git pull` on a shallow clone even with depth=1 does not always
work as hoped. Git's pull is a shortcut for git fetch && git merge. Git
merge with missing intermediate revisions can lead to conflicts that
need to be manually resolved. Using git reset --hard instead should work
(almost?) every time. Adding in a `git clean -dffx` call should also get
rid of any strange artifacts in the clone caused by deletes and changes
in gitignore that happened in the intervening commits.

h/t https://stackoverflow.com/a/41081908/8171

Change-Id: Ib13a2582f7d4b5799289d4eed179bc6f6d23203a
---
M modules/toollabs/manifests/static.pp
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Andrew Bogott: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/toollabs/manifests/static.pp 
b/modules/toollabs/manifests/static.pp
index 560ca2b..9d7e9a1 100644
--- a/modules/toollabs/manifests/static.pp
+++ b/modules/toollabs/manifests/static.pp
@@ -23,7 +23,7 @@
     # Also gerrit will probably die from a 11Gig repo
     # This does not mean it's ok to clone other things from github on 
ops/puppet :)
     exec { 'clone-cdnjs':
-        command => '/usr/bin/git clone --depth 1 
https://github.com/cdnjs/cdnjs.git /srv/cdnjs',
+        command => '/usr/bin/git clone --depth 1 --branch master 
https://github.com/cdnjs/cdnjs.git /srv/cdnjs',
         creates => '/srv/cdnjs',
         # This is okay because puppet-run defines a timeout, and this takes 
longer than the default
         # exec timeout of 300s
@@ -32,7 +32,7 @@
     }
 
     cron { 'update-cdnjs':
-        command => 'cd /srv/cdnjs && /usr/bin/git pull --depth 1 
https://github.com/cdnjs/cdnjs.git && /usr/local/bin/cdnjs-packages-gen 
/srv/cdnjs /srv/cdnjs/packages.json',
+        command => 'cd /srv/cdnjs && /usr/bin/git fetch --depth 1 origin && 
/usr/bin/git reset --hard origin/master && /usr/bin/git clean -dffx && 
/usr/local/bin/cdnjs-packages-gen /srv/cdnjs /srv/cdnjs/packages.json',
         user    => 'root',
         hour    => 0,
         minute  => 0,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib13a2582f7d4b5799289d4eed179bc6f6d23203a
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Andrew Bogott <abog...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Madhuvishy <mviswanat...@wikimedia.org>
Gerrit-Reviewer: Rush <r...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to