Hashar has uploaded a new change for review.

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

Change subject: contint: install npm/grunt-cli with npm
......................................................................

contint: install npm/grunt-cli with npm

We require very specific versions of npm and grunt-cli on the CI slaves
which are not matched by Precise/Trusty/Jessie Debian packages.

Puppetize the installation described:
https://wikitech.wikimedia.org/wiki/Nova_Resource:Integration/Setup

Basically get npm from the distribution and use it to install pinned
versions of npm/grunt-cli.
Override the /usr/bin/npm link to point to the newly installed version.

Bug: T113903
Change-Id: I0d58b643ac677cba4b8000fbdaa936ee378263df
---
A modules/contint/manifests/packages/javascript.pp
M modules/contint/manifests/packages/labs.pp
2 files changed, 43 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/48/244748/1

diff --git a/modules/contint/manifests/packages/javascript.pp 
b/modules/contint/manifests/packages/javascript.pp
new file mode 100644
index 0000000..423f927
--- /dev/null
+++ b/modules/contint/manifests/packages/javascript.pp
@@ -0,0 +1,40 @@
+# == Class contint::packages::javascript
+#
+# Install npm/grunt-cli from npmjs.com with pinned versions
+#
+class contint::packages::javascript {
+
+    require_realms('labs')
+
+    package { 'npm':
+        ensure => present,
+    }
+
+    # DO NOT CHANGE VERSIONS
+    #
+    # https://wikitech.wikimedia.org/wiki/Nova_Resource:Integration/Setup
+    $versions = {
+        'npm'       => '2.7.6',
+        'grunt-cli' => '0.1.13',
+    }
+
+    exec { 'pin npm':
+        path    => '/usr/local/bin:/usr/bin',
+        command => "npm install -g npm@${versions['npm']}",
+        onlyif  => "/usr/bin/test \"`/usr/local/bin/npm --version`\" != 
${versions['npm']}",
+        require => Package['npm'],
+    }
+
+    file { '/usr/bin/npm':
+        ensure  => link,
+        target  => '/usr/local/bin/npm',
+        require => Exec['pin npm'],
+    }
+
+    exec { 'pin grunt-cli':
+        command => "/usr/local/bin/npm install -g 
grunt-cli@${versions['grunt-cli']}",
+        onlyif  => "/usr/bin/test \"`/usr/local/bin/grunt --version`\" != 
${versions['grunt-cli']}",
+        require => File['/usr/local/bin/npm'],
+    }
+
+}
diff --git a/modules/contint/manifests/packages/labs.pp 
b/modules/contint/manifests/packages/labs.pp
index addc7b2..6d80e06 100644
--- a/modules/contint/manifests/packages/labs.pp
+++ b/modules/contint/manifests/packages/labs.pp
@@ -11,6 +11,9 @@
     # Fonts needed for browser tests screenshots (T71535)
     include mediawiki::packages::fonts
 
+    # Required for javascript testing
+    include ::contint::packages::javascript
+
     # Required for python testing
     include ::contint::packages::python
 
@@ -52,18 +55,6 @@
             require => File['/var/cache/pbuilder'],
     }
     # end of jenkins-debian glue puppetization
-
-    package { [
-        'npm',
-        # For 
mediawiki/extensions/Collection/OfflineContentGenerator/latex_renderer
-        # Provided by openstack::common:
-        #'unzip',
-        # provided by misc::contint::packages:
-        #'librsvg2-bin',
-        #'imagemagick',
-
-        ]: ensure => present,
-    }
 
     # For mediawiki/extensions/Collection/OfflineContentGenerator/bundler
     require_package('zip')

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d58b643ac677cba4b8000fbdaa936ee378263df
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <[email protected]>

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

Reply via email to