diff --git a/modules/openstack_project/manifests/release_slave.pp b/modules/openstack_project/manifests/release_slave.pp index 982d76e179..4cadc5a35e 100644 --- a/modules/openstack_project/manifests/release_slave.pp +++ b/modules/openstack_project/manifests/release_slave.pp @@ -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', diff --git a/modules/openstack_project/templates/npmrc_global.erb b/modules/openstack_project/templates/npmrc_global.erb new file mode 100644 index 0000000000..bdd42b825e --- /dev/null +++ b/modules/openstack_project/templates/npmrc_global.erb @@ -0,0 +1,3 @@ +tag-version-prefix= +sign-git-tag=true +prefix=/usr/local diff --git a/modules/openstack_project/templates/npmrc.erb b/modules/openstack_project/templates/npmrc_jenkins.erb similarity index 89% rename from modules/openstack_project/templates/npmrc.erb rename to modules/openstack_project/templates/npmrc_jenkins.erb index 9b267d8ad2..cf6550c5e6 100644 --- a/modules/openstack_project/templates/npmrc.erb +++ b/modules/openstack_project/templates/npmrc_jenkins.erb @@ -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) %>