Skip to content

Commit

Permalink
webhook-go: Implement repository support
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Sep 5, 2023
1 parent f36fdc3 commit 30b6bb8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
22 changes: 20 additions & 2 deletions manifests/webhook/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$pkg_file = '/tmp/webhook-go.rpm'
$package_url = "https://github.com/voxpupuli/webhook-go/releases/download/v${r10k::webhook::version}/webhook-go_${r10k::webhook::version}_linux_amd64.rpm"
}
'Debian', 'Ubuntu': {
'Debian': {
$provider = 'dpkg'
$pkg_file = '/tmp/webhook-go.deb'
$package_url = "https://github.com/voxpupuli/webhook-go/releases/download/v${r10k::webhook::version}/webhook-go_${r10k::webhook::version}_linux_amd64.deb"
Expand All @@ -33,7 +33,25 @@
}
}
'repo': {
warning('webhook-go: configuring a repo is not implemented yet')
case $facts['os']['family'] {
'RedHat': {
}
'Debian': {

Check failure on line 39 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

two-space soft tabs not used (check: 2sp_soft_tabs)

Check warning on line 39 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indent should be 8 chars and is 9 (check: strict_indent)
include apt

Check failure on line 40 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

two-space soft tabs not used (check: 2sp_soft_tabs)

Check warning on line 40 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indent should be 10 chars and is 11 (check: strict_indent)
apt::source { 'voxpupuli-webhook-go':

Check failure on line 41 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

two-space soft tabs not used (check: 2sp_soft_tabs)

Check warning on line 41 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indent should be 10 chars and is 11 (check: strict_indent)
comment => 'A certifiably-awesome open-source package repository curated by Vox Pupuli, hosted by Cloudsmith.',

Check failure on line 42 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

two-space soft tabs not used (check: 2sp_soft_tabs)

Check warning on line 42 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indent should be 12 chars and is 13 (check: strict_indent)
location => 'https://dl.cloudsmith.io/public/voxpupuli/webhook-go/deb/debian',

Check failure on line 43 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

two-space soft tabs not used (check: 2sp_soft_tabs)

Check warning on line 43 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indent should be 12 chars and is 13 (check: strict_indent)
repos => 'main',

Check failure on line 44 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

two-space soft tabs not used (check: 2sp_soft_tabs)

Check warning on line 44 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indent should be 12 chars and is 13 (check: strict_indent)
key => {

Check failure on line 45 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

two-space soft tabs not used (check: 2sp_soft_tabs)

Check warning on line 45 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indent should be 12 chars and is 13 (check: strict_indent)
'id' => 'FD229D5D47E6F534',

Check failure on line 46 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

two-space soft tabs not used (check: 2sp_soft_tabs)

Check warning on line 46 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indent should be 14 chars and is 15 (check: strict_indent)
'source' => 'https://dl.cloudsmith.io/public/voxpupuli/webhook-go/gpg.FD229D5D47E6F534.key',

Check failure on line 47 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

two-space soft tabs not used (check: 2sp_soft_tabs)

Check warning on line 47 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indent should be 14 chars and is 15 (check: strict_indent)
},

Check failure on line 48 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

two-space soft tabs not used (check: 2sp_soft_tabs)

Check warning on line 48 in manifests/webhook/package.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indent should be 12 chars and is 13 (check: strict_indent)
}
}
default: {
fail("Operating system ${facts['os']['name']} not supported for packages")
}
}
}
# none = people configure a repo on their own
'none': {
Expand Down
34 changes: 34 additions & 0 deletions spec/acceptance/r10k_webhook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,38 @@ class { 'r10k': }
its(:stdout) { is_expected.to match(%r{webhook-go}) }
end
end

context 'with external repo' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'r10k': }
-> class { 'r10k::webhook':
install_method => 'repo',
}
PUPPET
end
end
describe package('webhook-go') do
it { is_expected.to be_installed }
end

describe file('/etc/voxpupuli/webhook.yml') do
it 'exists and has content' do
expect(subject).to exist
expect(subject).to be_owned_by 'root'
expect(subject).to be_grouped_into 'root'
expect(subject).to contain "---\nserver:\n protected: true\n user: puppet\n password: puppet\n"
end
end

describe service('webhook-go') do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end

describe command('systemctl cat webhook-go') do
its(:stdout) { is_expected.to match(%r{webhook-go}) }
end
end
end

0 comments on commit 30b6bb8

Please sign in to comment.