Staged upgrade for npm
The version of npm that ships with trusty is able to upgrade itself to npm v2, but cannot upgrade to npm v3. Furthermore, performing a staged upgrade picks up the default `profile` parameter from npm, so that value has to be overridden globally in order to ensure that /usr/bin is not polluted. This patch adds the following: - A staged upgrade step, triggered when the detected version of npm is "1", to upgrade to version 2. - A new global npmrc configuration file, containing the profile setting. - Renamed jenkins/global npmrc templates. Values that made more sense to keep globally have been moved there. Change-Id: Ia633ccabb49d74a10c904a6e8ba73945d77fb32d
This commit is contained in:
parent
4eab56767b
commit
68610b1cf9
@ -55,13 +55,26 @@ class openstack_project::release_slave (
|
||||
|
||||
package { ['nodejs', 'nodejs-legacy', 'npm']:
|
||||
ensure => latest,
|
||||
before => Exec['upgrade npm'],
|
||||
before => [
|
||||
Exec['upgrade npm']
|
||||
]
|
||||
}
|
||||
|
||||
exec { 'assert npm@2':
|
||||
command => 'npm install npm@2 -g --upgrade',
|
||||
path => '/usr/local/bin:/usr/bin',
|
||||
onlyif => '[ `npm --version | cut -c 1` = "1" ]',
|
||||
require => [
|
||||
Package['npm'],
|
||||
File['/etc/npmrc'],
|
||||
],
|
||||
}
|
||||
|
||||
exec { 'upgrade npm':
|
||||
command => 'npm install npm -g --upgrade',
|
||||
path => '/usr/local/bin:/usr/bin',
|
||||
onlyif => '[ `npm view npm version` != `npm --version` ]'
|
||||
onlyif => '[ `npm view npm version` != `npm --version` ]',
|
||||
require => Exec['assert npm@2'],
|
||||
}
|
||||
|
||||
file { '/home/jenkins/.pypirc':
|
||||
@ -78,10 +91,18 @@ class openstack_project::release_slave (
|
||||
owner => 'jenkins',
|
||||
group => 'jenkins',
|
||||
mode => '0600',
|
||||
content => template('openstack_project/npmrc.erb'),
|
||||
content => template('openstack_project/npmrc_jenkins.erb'),
|
||||
require => File['/home/jenkins'],
|
||||
}
|
||||
|
||||
file { '/etc/npmrc':
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0666',
|
||||
content => template('openstack_project/npmrc_global.erb'),
|
||||
}
|
||||
|
||||
file { '/home/jenkins/.jenkinsci-curl':
|
||||
ensure => present,
|
||||
owner => 'jenkins',
|
||||
|
3
modules/openstack_project/templates/npmrc_global.erb
Normal file
3
modules/openstack_project/templates/npmrc_global.erb
Normal file
@ -0,0 +1,3 @@
|
||||
tag-version-prefix=
|
||||
sign-git-tag=true
|
||||
prefix=/usr/local
|
@ -4,8 +4,6 @@
|
||||
init.author.name=<%= jenkins_gitfullname %>
|
||||
init.author.email=<%= jenkins_gitemail %>
|
||||
init.author.url=<%= npm_userurl %>
|
||||
tag-version-prefix=
|
||||
sign-git-tag=true
|
||||
|
||||
//registry.npmjs.org/:username=<%= npm_username %>
|
||||
//registry.npmjs.org/:_password=<%= Base64.encode64(npm_userpassword) %>
|
Loading…
Reference in New Issue
Block a user