Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Preparation for 2.1 #189

Merged
merged 10 commits into from
Nov 8, 2018
Merged

Preparation for 2.1 #189

merged 10 commits into from
Nov 8, 2018

Conversation

Ma27
Copy link
Collaborator

@Ma27 Ma27 commented Nov 6, 2018

This is a rather big changeset, for detailed descriptions of each change, please read the text blocks of the commit messages.

The main idea behind v2.1 is less to release a feature-rich release, but to cleanup (and deprecate) parts of the module to ease maintenance and future development. In order to achieve this, EOLed dependencies have been dropped and newer language features have been used. To allow CI to actually perform acceptance tests, beaker has been adopted.

I'll leave this PR open for some time to await feedback (and see if I actually want to have everything as-is), then I'll start to prepare 2.1 release.

In a0d1d79 Puppet 3.x has been dropped in favor of Puppet 4 which
introduced a new type system which made the validate_* function sof
`puppetlabs-stdlib` obsolete.

The most relevant components now use a type system as well, the rest
will follow or declared as deprecated.

Fixes #186
To evaluate the Puppet catalogue on the Puppet Master, the client
doesn't need `rubygems` as well. This was an ancient hack (maintained
over years) to avoid such a setup in test environments for Puppet such
as Vagrant.

Instead something like this might be implemented:

``` ruby
Vagrant.configure(2) do |config|
  # ...

  config.vm.provision :puppet do |puppet|
    puppet.module_path = ['puppet', ...]
  end
end
```

With the `manifests/default.pp`:

``` puppet
node default {
  contain ::nodejs

  package { ['ruby', 'rubygems']:
    ensure => present,
  } ->
  Class['::nodejs']
}
```
It's now listed in `::nodejs::params` as sensitive default, but in
edge-cases it might be helpful to specify a different directory than
`/usr/local/node/node-default` as directory for the default nodejs
instance.
…nside the module

The `::nodejs::params` class shall only be used as container with
sensitive defaults to provide a working setup on an average OS.

It should never be referenced directly inside the module's code, instead
`::nodejs` should pass it down to all internal APIs.

This is not a breaking change and much rather a cosmetic change as it
only affects private parts of the module and `::nodejs` has a parameter
with a default value.
Please refer to the changelog and the readme for further information.

Fixes #187
As requested it might be helpful to specify your own location for either
source or binary distribution. Possible cases where this might be needed
are e.g. corporate environments without internet access or to deploy a
patched/forked version of NodeJS to Puppet nodes.

As the NodeJS distribution provides several ways to index the available
versions, the source_server behaves different when used with a custom
server.

```
class { '::nodejs':
  source => 'https://your-server.com/nodejs.tar.gz',
}
```

You can't specify a version, but you need to directly specify the source
ot be installed.

`make_install => true` can be used for source builds with Puppet as
well.

Fixes #185
Don't support EOLed stdlib versions anymore, introduce upper-bound
version constraints in `metadata.json` to ensure no accidental breakage
with new major releases.
RuboCop searches for all `.rubocop.yml` inside the cwd, also
the (broken) one from `puppetlabs-stdlib` which has deprecated rules
and requires extra gems that aren't used by this module.
Due to several changes inside to the dependencies in the module this is
a rather drastic change. The module `puppetlabs-gcc` seems to be
abandoned (Puppet 3.x only support, last commit in 2015) which broke an
automated install with enabled dependency resolution (as done in
beaker). The logic of the module is now directly in
`::nodejs::instance::pkgs`.

To automate such testing processesin the future, `beaker` has been
introduced with `docker` as hypervisor (it's far more lightweight than a
full-blown `vagrant` setup).

Currently we only support Ubuntu 16.04 LTS in the testing matrix, but
whenever distros start to conflict with this module, the test suite can
be easily extended.

As `PUPPET_VERSION` is interpreted by beaker as well the test suite has
been split into two tasks (:test and :acceptance) as gem's version
constraint will break APT while provisioning docker.

Fixes #188
@coveralls
Copy link

coveralls commented Nov 6, 2018

Pull Request Test Coverage Report for Build 586

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • 22 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+0.9%) to 82.774%

Files with Coverage Reduction New Missed Lines %
spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb 1 75.0%
spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb 2 71.43%
spec/fixtures/modules/stdlib/lib/puppet/parser/functions/count.rb 2 75.0%
spec/fixtures/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb 8 56.52%
spec/fixtures/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb 9 59.26%
Totals Coverage Status
Change from base Build 581: 0.9%
Covered Lines: 370
Relevant Lines: 447

💛 - Coveralls

@Ma27
Copy link
Collaborator Author

Ma27 commented Nov 8, 2018

I have reasonable confidence that this should be safe to merge. Mainly because this doesn't change internal logic, but mainly makes it easier to maintain the code by reducing the build matrix, adding additional checks and removing, unneeded old parts.

It might take some time until 2.1 though since I have a lot of other ideas/projects I want to work on in my (limited) free time, so let's see when I have sufficient time to implement #138 which should (finally) land in 2.1 :)

@Ma27 Ma27 merged commit 1a87199 into master Nov 8, 2018
@Ma27 Ma27 deleted the cleanup-and-refactor-internals branch November 8, 2018 17:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants