diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 760c856..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,65 +0,0 @@ -2020-16-05 Release 3.0.0 - -Thanks to fraenki - -* Add support for Artifactory 7 - -2020-06-04 Release 2.2.8 - -Several fixes by Tim Meusel. - -* Litmus testing added -* Add PostGres example - -2019-22-08 Release 2.2.7 - -Several fixes by Ron Aughenbaugh from University of Maryland. Go Terrapins. - -* Manage db.properties with augeas -* Added optional params to db.properties with augeas -* Fix hardcoding of paths - -2019-14-08 Release 2.2.5 -- Alexander Hermes bumped java dependency -- Frank Wall fixed bug where service restarted on .temp.db.properties change - -2019-20-05 Release 2.1.0 -- Database secrets are now read from a temporary file, allowing for encrypted passwords -- Master key for database can now be specified to re-use an existing database -- Module can now provision a Mysql database and connect it to Artifactory -- Smoothed out install script for better compatability with database - -2018-22-08 Release 2.0.16 -- Refactored for PDK and ensured all test pass. - -2018-13-08 Release 2.0.14 -- Refactored for PDK and ensured all test pass. - -2018-03--14 Release 2.0.13 -- Remove OJDBC JAR file and ha-node prop files -- Make artifactory version configurable - -2018-02-28 Release 2.0.12 -- Added fix for manage_java = false dependency -- Added enhancement for derby usage - -2017-03-21 Release 2.0.9 -- Fix simple puppet linter problems - -2017-03-21 Release 2.0.8 -- Change from wget to file type to grab binary drivers - -2016-08-14 Release 2.0.7 -- Fix JDBC permissions - -2016-08-14 Release 2.0.5 -- JDBC driver added as owner root, not artifactory - -2016-07-26 Release 2.0.0 -- Remove db_hostname and db_port. Use db_url instead. - -2016-07-22 Release 1.0.5 -- Added active management of java to module - -2016-07-22 Release 1.0.3 -- Added shields and final travis-ci tests diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e44861e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,84 @@ +# Changelog + +2020-08-26 Release 3.0.1 + +* Fix for PR 11 + +2020-16-05 Release 3.0.0 + +* Thanks to fraenki + +* Add support for Artifactory 7 + +2020-06-04 Release 2.2.8 + +Several fixes by Tim Meusel. + +* Litmus testing added +* Add PostGres example + +2019-22-08 Release 2.2.7 + +Several fixes by Ron Aughenbaugh from University of Maryland. Go Terrapins. + +* Manage db.properties with augeas +* Added optional params to db.properties with augeas +* Fix hardcoding of paths + +2019-14-08 Release 2.2.5 + +* Alexander Hermes bumped java dependency +* Frank Wall fixed bug where service restarted on .temp.db.properties change + +2019-20-05 Release 2.1.0 + +* Database secrets are now read from a temporary file, allowing for encrypted passwords +* Master key for database can now be specified to re-use an existing database +* Module can now provision a Mysql database and connect it to Artifactory +* Smoothed out install script for better compatability with database + +2018-22-08 Release 2.0.16 + +* Refactored for PDK and ensured all test pass. + +2018-13-08 Release 2.0.14 + +* Refactored for PDK and ensured all test pass. + +2018-03--14 Release 2.0.13 + +* Remove OJDBC JAR file and ha-node prop files +* Make artifactory version configurable + +2018-02-28 Release 2.0.12 + +* Added fix for manage_java = false dependency +* Added enhancement for derby usage + +2017-03-21 Release 2.0.9 + +* Fix simple puppet linter problems + +2017-03-21 Release 2.0.8 + +* Change from wget to file type to grab binary drivers + +2016-08-14 Release 2.0.7 + +* Fix JDBC permissions + +2016-08-14 Release 2.0.5 + +* JDBC driver added as owner root, not artifactory + +2016-07-26 Release 2.0.0 + +* Remove db_hostname and db_port. Use db_url instead. + +2016-07-22 Release 1.0.5 + +* Added active management of java to module + +2016-07-22 Release 1.0.3 + +* Added shields and final travis-ci tests diff --git a/README.markdown b/README.md similarity index 96% rename from README.markdown rename to README.md index 996fa7f..c4adf0d 100644 --- a/README.markdown +++ b/README.md @@ -11,8 +11,8 @@ * [Beginning with artifactory](#beginning-with-artifactory) 4. [Usage - Configuration options and additional functionality](#usage) 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference) -5. [Limitations - OS compatibility, etc.](#limitations) -6. [Development - Guide for contributing to the module](#development) +6. [Limitations - OS compatibility, etc.](#limitations) +7. [Development - Guide for contributing to the module](#development) ## Overview @@ -21,7 +21,7 @@ Artifactory 7+ is supported, legacy support for Artifactory 6 is still available If you are looking for the HA installation look at: -Artifactory HA: https://forge.puppet.com/fervid/artifactory_ha +Artifactory HA: Github and gitlab are great for storing source control, but bad at storing installers and compiled packages. @@ -51,7 +51,7 @@ This ensures that the module behaves correctly and does not enable obsolete feat If you need to add database connectivity instantiate with the required parameters: -~~~ +```puppet class { '::artifactory': jdbc_driver_url => 'puppet:///modules/my_module/mysql.jar', db_type => 'oracle', @@ -65,7 +65,7 @@ class { '::artifactory': binary_provider_filesystem_dir => '/var/opt/jfrog/artifactory/data/filestore', binary_provider_cache_dir => '/var/opt/jfrog/artifactory/', } -~~~ +``` ### Artifactory with PostgreSQL database @@ -165,7 +165,7 @@ This is required if using a new data source. ##### `use_temp_db_secrets` Set to true(default) if you want Artifactory to delete temporary db.properties file on service start. -https://www.jfrog.com/confluence/display/RTF/Configuring+Security#ConfiguringSecurity-HardeningSecurityforSecrets + Set to false if you would like db.properties file to be written to ${::artifactory::artifactory_home}/etc/db.properties and managed with Augeas, taking into account Artifactory encrypts password field on startup. Management with Augeas @@ -196,18 +196,23 @@ Only required for database configuration. The password for the database account. Optional setting for the binary storage provider. The type of database to configure for. Valid values are 'filesystem', 'fullDb', 'cachedFS', 'S3'. Defaults to 'filesystem'. ###### filesystem (default) + This means that metadata is stored in the database, but binaries are stored in the file system. The default location is under $ARTIFACTORY_HOME/data/filestore however this can be modified. ###### fullDb + All the metadata and the binaries are stored as BLOBs in the database, objects are cached as in cachedFS. ###### cachedFS + Works the same way as filesystem but also has a binary LRU (Least Recently Used) cache for upload/download requests. Improves performance of instances with high IOPS (I/O Operations) or slow NFS access. ###### S3 + This is the setting used for S3 Object Storage. ###### fullDbDirect + All the metadata and the binaries are stored as BLOBs in the database. No caching occurs. ##### `pool_max_active` @@ -249,7 +254,6 @@ This module has been tested on: Since your module is awesome, other users will want to play with it. Let them know what the ground rules for contributing are. - ### Contributors To see who's already involved, see the [list of contributors.](https://github.com/fervid/artifactory/graphs/contributors) diff --git a/data/common.yaml b/data/common.yaml new file mode 100644 index 0000000..2fbf0ff --- /dev/null +++ b/data/common.yaml @@ -0,0 +1 @@ +--- {} diff --git a/hiera.yaml b/hiera.yaml new file mode 100644 index 0000000..545fff3 --- /dev/null +++ b/hiera.yaml @@ -0,0 +1,21 @@ +--- +version: 5 + +defaults: # Used for any hierarchy level that omits these keys. + datadir: data # This path is relative to hiera.yaml's directory. + data_hash: yaml_data # Use the built-in YAML backend. + +hierarchy: + - name: "osfamily/major release" + paths: + # Used to distinguish between Debian and Ubuntu + - "os/%{facts.os.name}/%{facts.os.release.major}.yaml" + - "os/%{facts.os.family}/%{facts.os.release.major}.yaml" + # Used for Solaris + - "os/%{facts.os.family}/%{facts.kernelrelease}.yaml" + - name: "osfamily" + paths: + - "os/%{facts.os.name}.yaml" + - "os/%{facts.os.family}.yaml" + - name: 'common' + path: 'common.yaml' diff --git a/manifests/config.pp b/manifests/config.pp index 579cc1c..16c243a 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -66,12 +66,13 @@ # Determine the directory for the chosen binary provider. if ($binary_provider_type == 'file-system') and ! $::artifactory::binary_provider_filesystem_dir { - $mapped_provider_filesystem_dir = 'filestore' - } else { - $mapped_provider_filesystem_dir = $::artifactory::binary_provider_filesystem_dir - } - if $::artifactory::binary_provider_base_data_dir { - $binary_provider_filesystem_dir = "${::artifactory::binary_provider_base_data_dir}/${mapped_provider_filesystem_dir}" + if $::artifactory::binary_provider_base_data_dir { + $binary_provider_filesystem_dir = "${::artifactory::binary_provider_base_data_dir}/filestore" + } else { + $binary_provider_filesystem_dir = undef + } + } elsif ($binary_provider_type == 'file-system') and $::artifactory::binary_provider_filesystem_dir { + $binary_provider_filesystem_dir = $::artifactory::binary_provider_filesystem_dir } else { $binary_provider_filesystem_dir = undef } diff --git a/metadata.json b/metadata.json index 0a3dc7d..c0f9a8e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "fervid-artifactory", - "version": "3.0.0", + "version": "3.0.5", "author": "Fervid", "summary": "Installs and configures Artifactory OSS", "license": "Apache-2.0", diff --git a/spec/classes/artifactory_spec.rb b/spec/classes/artifactory_spec.rb index fdd6d32..3226de1 100644 --- a/spec/classes/artifactory_spec.rb +++ b/spec/classes/artifactory_spec.rb @@ -169,19 +169,77 @@ } end - context 'artifactory class with version specified' do + context 'running a legacy version (pre v7)' do let(:params) do { - 'package_version' => '5.9.1', + 'package_version' => '6.0.0', } end it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package('jfrog-artifactory-oss').with( - 'ensure' => '5.9.1', + 'ensure' => '6.0.0', ) } + it { + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/binarystore.xml').with_content(%r{chain template="file-system"}) + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/binarystore.xml').without_content(%r{}) + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/binarystore.xml').without_content(%r{}) + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/binarystore.xml').without_content(%r{}) + } + end + + context 'running a current version' do + let(:params) do + { + 'package_version' => '7.4.3', + } + end + + it { is_expected.to compile.with_all_deps } + it { + is_expected.to contain_package('jfrog-artifactory-oss').with( + 'ensure' => '7.4.3', + ) + } + it { + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').with_content(%r{chain template="file-system"}) + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').without_content(%r{}) + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').without_content(%r{}) + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').without_content(%r{}) + } + end + + context 'running a current version with a custom binary filesystem dir' do + let(:params) do + { + 'package_version' => '7.4.3', + 'binary_provider_filesystem_dir' => '/opt/artifactory-filestore', + } + end + + it { is_expected.to compile.with_all_deps } + it { + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').with_content(%r{}) + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').with_content(%r{/opt/artifactory-filestore}) + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').without_content(%r{}) + } + end + + context 'running a current version with a custom binary base data dir' do + let(:params) do + { + 'package_version' => '7.4.3', + 'binary_provider_base_data_dir' => '/opt/artifactory-data', + } + end + + it { is_expected.to compile.with_all_deps } + it { + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').with_content(%r{/opt/artifactory-data}) + is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').with_content(%r{/opt/artifactory-data/filestore}) + } end end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 4ac8d7e..73a0238 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true require 'puppet_litmus' -require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb')) - PuppetLitmus.configure! + +require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb')) diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index ebc3b50..c059824 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -1,4 +1,5 @@ -require 'puppet_litmus' +# frozen_string_literal: true + require 'singleton' class Helper @@ -6,6 +7,6 @@ class Helper include PuppetLitmus end -# def some_helper_method -# Helper.instance.bolt_run_script('path/to/file') -# end +def some_helper_method + Helper.instance.bolt_run_script('path/to/file') +end diff --git a/templates/binarystore.xml.epp b/templates/binarystore.xml.epp index 56b9f65..a2401a2 100644 --- a/templates/binarystore.xml.epp +++ b/templates/binarystore.xml.epp @@ -33,33 +33,33 @@ -<% if $binary_provider_type == 'filesystem' +<% if $binary_provider_type == 'file-system' and ($binary_provider_base_data_dir or $binary_provider_filesystem_dir) - or $binary_provider_type == 'cachedFS' + or $binary_provider_type == 'cache-fs' and ($binary_provider_cache_dir or $binary_provider_cache_maxsize) { -%> -<% if $binary_provider_type == 'filesystem' +<% if $binary_provider_type == 'file-system' and $binary_provider_base_data_dir { -%> <%= $binary_provider_base_data_dir %> <% } -%> -<% if $binary_provider_type == 'filesystem' +<% if $binary_provider_type == 'file-system' and $binary_provider_filesystem_dir { -%> <%= $binary_provider_filesystem_dir %> <% } -%> -<% if $binary_provider_type == 'cachedFS' +<% if $binary_provider_type == 'cache-fs' and $binary_provider_cache_maxsize { -%> <%= $binary_provider_cache_maxsize %> <% } -%> -<% if $binary_provider_type == 'cachedFS' +<% if $binary_provider_type == 'cache-fs' and $binary_provider_cache_dir { -%> <%= $binary_provider_cache_dir %> <% } -%> -<% } elsif $binary_provider_type == 'fullDb' { -%> +<% } elsif $binary_provider_type == 'full-db' { -%> -<% } elsif $binary_provider_type == 'fullDbDirect' { -%> +<% } elsif $binary_provider_type == 'full-db-direct' { -%> <% } -%>