Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default release to 18.x, EL7 to 16.x #481

Merged
merged 5 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ To install Node.js and npm (using the NodeSource repository if possible):
class { 'nodejs': }
```

The default version installed is currently `12.x`.
The default version installed is currently `18.x`.

If you wish to install a Node.js 13.x release from the NodeSource repository
rather than 12.x on Debian/RHEL platforms:
If you wish to install a Node.js 21.x release from the NodeSource repository
rather than 18.x on Debian/RHEL platforms:

```puppet
class { 'nodejs':
repo_url_suffix => '13.x',
repo_url_suffix => '21.x',
}
```

Expand Down
7 changes: 5 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
$repo_proxy_password = 'absent'
$repo_proxy_username = 'absent'
$repo_release = undef
$repo_url_suffix = '12.x'
$repo_url_suffix = ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7') ? {
bastelfreak marked this conversation as resolved.
Show resolved Hide resolved
true => '16.x',
default => '18.x',
}
$use_flags = ['npm', 'snapshot']

$cmd_exe_path = $facts['os']['family'] ? {
Expand All @@ -38,7 +41,7 @@
$nodejs_dev_package_name = 'nodejs-devel'
$nodejs_dev_package_ensure = 'absent'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_ensure = 'present'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = 'nodejs::repo::nodesource'
Expand Down
50 changes: 28 additions & 22 deletions manifests/repo/nodesource/yum.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,40 @@
owner => 'root',
source => "puppet:///modules/${module_name}/repo/dnf/nodejs.module",
}

$module_hotfixes = true
} else {
$module_hotfixes = undef
}

yumrepo { 'nodesource':
descr => $descr,
baseurl => $baseurl,
enabled => '1',
failovermethod => $yum_failovermethod,
gpgkey => 'file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL',
gpgcheck => '1',
priority => $priority,
proxy => $proxy,
proxy_password => $proxy_password,
proxy_username => $proxy_username,
require => File['/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL'],
descr => $descr,
baseurl => $baseurl,
enabled => '1',
failovermethod => $yum_failovermethod,
gpgkey => 'file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL',
gpgcheck => '1',
module_hotfixes => $module_hotfixes,
priority => $priority,
proxy => $proxy,
proxy_password => $proxy_password,
proxy_username => $proxy_username,
require => File['/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL'],
}

yumrepo { 'nodesource-source':
descr => $source_descr,
baseurl => $source_baseurl,
enabled => $yum_source_enabled,
failovermethod => $yum_failovermethod,
gpgkey => 'file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL',
gpgcheck => '1',
priority => $priority,
proxy => $proxy,
proxy_password => $proxy_password,
proxy_username => $proxy_username,
require => File['/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL'],
descr => $source_descr,
baseurl => $source_baseurl,
enabled => $yum_source_enabled,
failovermethod => $yum_failovermethod,
gpgkey => 'file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL',
gpgcheck => '1',
module_hotfixes => $module_hotfixes,
priority => $priority,
proxy => $proxy,
proxy_password => $proxy_password,
proxy_username => $proxy_username,
require => File['/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL'],
}

file { '/etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL':
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
nodejs-devel
].each do |pkg|
describe package(pkg) do
it do

Check warning on line 60 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 - CentOS 9

nodejs RedHat with repo_class => epel Package "nodejs-devel" is expected to be installed Failure/Error: is_expected.to be_installed expected Package "nodejs-devel" to be installed

Check warning on line 60 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - CentOS 9

nodejs RedHat with repo_class => epel Package "nodejs-devel" is expected to be installed Failure/Error: is_expected.to be_installed expected Package "nodejs-devel" to be installed

Check warning on line 60 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 - OracleLinux 9

nodejs RedHat with repo_class => epel Package "nodejs-devel" is expected to be installed Failure/Error: is_expected.to be_installed expected Package "nodejs-devel" to be installed

Check warning on line 60 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - OracleLinux 9

nodejs RedHat with repo_class => epel Package "nodejs-devel" is expected to be installed Failure/Error: is_expected.to be_installed expected Package "nodejs-devel" to be installed
pending('nodejs-devel and nodejs not installable together on EL9') if fact('os.release.major') == '9' && pkg == 'nodejs-devel'
is_expected.to be_installed
end
Expand Down Expand Up @@ -97,7 +97,7 @@
let(:manifest) do
<<-PUPPET
class { 'nodejs': }
nodejs::npm::global_config_entry { '//path.to.registry/:_secret':
nodejs::npm::global_config_entry { '//path.to.registry/:_authToken':
ensure => present,
value => 'cGFzc3dvcmQ=',
require => Package[nodejs],
Expand All @@ -109,7 +109,7 @@
describe 'npm config' do
it 'contains the global_config_entry secret' do
npm_output = shell('cat $(/usr/bin/npm config get globalconfig)')
expect(npm_output.stdout).to match '//path.to.registry/:_secret="cGFzc3dvcmQ="'
expect(npm_output.stdout).to match '//path.to.registry/:_authToken="cGFzc3dvcmQ="'
end
end
end
Expand All @@ -121,7 +121,7 @@
let(:manifest) do
<<-PUPPET
class { 'nodejs': }
nodejs::npm::global_config_entry { '//path.to.registry/:_secret':
nodejs::npm::global_config_entry { '//path.to.registry/:_authToken':
ensure => present,
value => 'cGFzc3dvcmQ',
require => Package[nodejs],
Expand All @@ -133,7 +133,7 @@
describe 'npm config' do
it 'contains the global_config_entry secret' do
npm_output = shell('cat $(/usr/bin/npm config get globalconfig)')
expect(npm_output.stdout).to match '//path.to.registry/:_secret=cGFzc3dvcmQ'
expect(npm_output.stdout).to match '//path.to.registry/:_authToken=cGFzc3dvcmQ'
end
end
end
Expand Down
27 changes: 9 additions & 18 deletions spec/classes/nodejs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,25 +292,16 @@
end
end

['7.0', '27'].each do |operatingsystemrelease|
['7.0'].each do |operatingsystemrelease|
osversions = operatingsystemrelease.split('.')
operatingsystemmajrelease = osversions[0]

if operatingsystemmajrelease == '7'
operatingsystem = 'CentOS'
dist_type = 'el'
repo_baseurl = "https://rpm.nodesource.com/pub_12.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch"
repo_source_baseurl = "https://rpm.nodesource.com/pub_12.x/#{dist_type}/#{operatingsystemmajrelease}/SRPMS"
repo_descr = "Node.js Packages for Enterprise Linux #{operatingsystemmajrelease} - $basearch"
repo_source_descr = "Node.js for Enterprise Linux #{operatingsystemmajrelease} - $basearch - Source"
else
operatingsystem = 'Fedora'
dist_type = 'fc'
repo_baseurl = "https://rpm.nodesource.com/pub_12.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch"
repo_source_baseurl = "https://rpm.nodesource.com/pub_12.x/#{dist_type}/#{operatingsystemmajrelease}/SRPMS"
repo_descr = "Node.js Packages for Fedora Core #{operatingsystemmajrelease} - $basearch"
repo_source_descr = "Node.js for Fedora Core #{operatingsystemmajrelease} - $basearch - Source"
end
operatingsystem = 'CentOS'
dist_type = 'el'
repo_baseurl = "https://rpm.nodesource.com/pub_16.x/#{dist_type}/#{operatingsystemmajrelease}/$basearch"
repo_source_baseurl = "https://rpm.nodesource.com/pub_16.x/#{dist_type}/#{operatingsystemmajrelease}/SRPMS"
repo_descr = "Node.js Packages for Enterprise Linux #{operatingsystemmajrelease} - $basearch"
repo_source_descr = "Node.js for Enterprise Linux #{operatingsystemmajrelease} - $basearch - Source"

context "when run on #{operatingsystem} release #{operatingsystemrelease}" do
let :facts do
Expand Down Expand Up @@ -1312,8 +1303,8 @@
}
end

repo_baseurl = 'https://rpm.nodesource.com/pub_12.x/el/7/$basearch'
repo_source_baseurl = 'https://rpm.nodesource.com/pub_12.x/el/7/SRPMS'
repo_baseurl = 'https://rpm.nodesource.com/pub_18.x/el/7/$basearch'
repo_source_baseurl = 'https://rpm.nodesource.com/pub_18.x/el/7/SRPMS'
repo_descr = 'Node.js Packages for Enterprise Linux 7 - $basearch'
repo_source_descr = 'Node.js for Enterprise Linux 7 - $basearch - Source'

Expand Down