Skip to content
Open
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
5 changes: 4 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
String $yum_name = 'bintray-jfrog-artifactory-rpms',
String $yum_baseurl = 'https://jfrog.bintray.com/artifactory-rpms',
String $yum_baseurl_pro = 'https://jfrog.bintray.com/artifactory-pro-rpms',
String $deb_baseurl = 'https://releases.jfrog.io/artifactory/artifactory-debs',
String $deb_baseurl_pro = 'https://releases.jfrog.io/artifactory/artifactory-pro-debs',
String $deb_baseurl_key = 'https://releases.jfrog.io/artifactory/api/gpg/key/public',
String $package_name = 'jfrog-artifactory-oss',
String $package_name_pro = 'jfrog-artifactory-pro',
String $package_version = 'present',
Expand All @@ -35,7 +38,7 @@

$service_name = 'artifactory'

Class{'::artifactory::yum': }
Class{'::artifactory::repo': }
-> class{'::artifactory::install': }
-> class{'::artifactory::config': }
-> class{'::artifactory::service': }
Expand Down
21 changes: 21 additions & 0 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @summary Pull in the platform specific repo classes
# @api private
class artifactory::repo () {
assert_private()

if $::artifactory::manage_repo {
case $facts['os']['family'] {
'RedHat', 'Linux': {
contain artifactory::repo::yum
}

'Debian': {
contain artifactory::repo::debian
}

default: {
fail( "Unsupported OS family: ${facts['os']['family']}" )
}
}
}
}
33 changes: 33 additions & 0 deletions manifests/repo/debian.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# == Class artifactory::repo::debian
#
# @summary Set up the apt repo on Debian-based distros
# @api private
class artifactory::repo::debian (
String $gpg_key_id = 'A3D085F542F740BBD7E3A2846B219DCCD7639232',
) {
assert_private()

include apt

case $artifactory::edition {
'enterprise', 'pro' : {
$_url = $artifactory::deb_baseurl_pro
}
default : {
$_url = $artifactory::deb_baseurl
}
}

apt::source { 'artifactory':
location => $_url,
release => $facts['os']['distro']['codename'],
repos => 'main',
include => {
'src' => false,
},
key => {
'id' => $gpg_key_id,
'source' => $artifactory::deb_baseurl_key,
},
}
}
6 changes: 2 additions & 4 deletions manifests/yum.pp → manifests/repo/yum.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# == Class artifactory::install
# == Class artifactory::repo::yum
#
# This class is called from artifactory for install.
#
class artifactory::yum {
class artifactory::repo::yum {
if $::artifactory::manage_repo {
case $artifactory::edition {
'enterprise', 'pro' : {
Expand Down
14 changes: 14 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@
"7",
"8"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"18.04",
"20.04"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"10",
"11"
]
}
],
"requirements": [
Expand Down
36 changes: 24 additions & 12 deletions spec/classes/artifactory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

describe 'artifactory' do
context 'supported operating systems' do
on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { facts.merge('root_home' => '/root') }
let(:facts) { os_facts.merge('root_home' => '/root') }

context 'artifactory class without any parameters' do
it { is_expected.to compile.with_all_deps }
Expand All @@ -16,17 +16,29 @@
it { is_expected.to contain_service('artifactory') }
it { is_expected.to contain_package('jfrog-artifactory-oss').with_ensure('present') }

it { is_expected.to contain_class('artifactory::yum') }
it { is_expected.to contain_class('artifactory') }
it {
is_expected.to contain_yumrepo('bintray-jfrog-artifactory-rpms').with(
'baseurl' => 'https://jfrog.bintray.com/artifactory-rpms',
'descr' => 'bintray-jfrog-artifactory-rpms',
'gpgcheck' => '1',
'enabled' => '1',
'gpgkey' => 'https://jfrog.bintray.com/artifactory-rpms/repodata/repomd.xml.key',
)
}
case os_facts[:os]['family']
when 'Debian'
it { is_expected.to contain_class('artifactory::repo::debian') }
it {
is_expected.to contain_apt__source('artifactory').with(
'location' => 'https://releases.jfrog.io/artifactory/artifactory-debs',
'release' => os_facts[:os]['distro']['codename'],
'repos' => 'main'
)
}
else
it { is_expected.to contain_class('artifactory::repo::yum') }
it {
is_expected.to contain_yumrepo('bintray-jfrog-artifactory-rpms').with(
'baseurl' => 'https://jfrog.bintray.com/artifactory-rpms',
'descr' => 'bintray-jfrog-artifactory-rpms',
'gpgcheck' => '1',
'enabled' => '1',
'gpgkey' => 'https://jfrog.bintray.com/artifactory-rpms/repodata/repomd.xml.key',
)
}
end
end

context 'artifactory class with master_key parameter' do
Expand Down