Skip to content
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
6 changes: 6 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,12 @@ Data type: `Optional[Variant[Stdlib::Absolutepath,Array[Stdlib::Absolutepath]]]`

GPG keyring(s) to use when verifying Release file

##### `latest`

Data type: `Optional[Boolean]`

Download only latest version of each package (per architecture)

##### `max_tries`

Data type: `Optional[Integer[0]]`
Expand Down
1 change: 1 addition & 0 deletions lib/puppet_x/voxpupuli/aptly/cli_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def self.mirror_update(name, options = {})
cmd << '-ignore-checksums' if options[:ignore_checksums]
cmd << '-ignore-signatures' if options[:ignore_signatures]
cmd += Array(options[:keyring]).map { |x| "-keyring=#{x}" }
cmd << '-latest' if options[:latest]
cmd << "-max-tries=#{options[:max_tries]}" if options[:max_tries]
cmd << '-skip-existing-packages' if options[:skip_existing_packages]
cmd << name
Expand Down
2 changes: 1 addition & 1 deletion spec/tasks/mirror_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
end

describe 'mirror_update' do
let(:opts) { super().merge(name: 'test', architectures: %w[amd64 arm64]) }
let(:opts) { super().merge(name: 'test', architectures: %w[amd64 arm64], latest: true) }

it 'updates the mirror' do
allow(PuppetX::Aptly::CliHelper).to receive(method_name).with(opts[:name], opts).and_return(true)
Expand Down
13 changes: 12 additions & 1 deletion spec/unit/cli_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
ignore_checksums: true,
ignore_signatures: true,
keyring: ['/home/aptly/example_keyring1.gpg', '/home/aptly/example_keyring2.gpg'],
latest: true,
max_tries: 5,
skip_existing_packages: true,
}.merge(non_aptly_options),
Expand All @@ -123,7 +124,7 @@
-dep-follow-recommends -dep-follow-source -dep-follow-suggests
-download-limit=100 -downloader=default -force -ignore-checksums
-ignore-signatures -keyring=/home/aptly/example_keyring1.gpg
-keyring=/home/aptly/example_keyring2.gpg -max-tries=5
-keyring=/home/aptly/example_keyring2.gpg -latest -max-tries=5
-skip-existing-packages bookworm-main
]
end
Expand All @@ -132,6 +133,16 @@
cli_helper.mirror_update(*args)
expect(Open3).to have_received(:capture3).with(*cmd).once
end

context 'without latest' do
let(:args) { ['bookworm-main', non_aptly_options] }
let(:cmd) { [aptly_environment] + %w[aptly.sh mirror update bookworm-main] }

specify do
cli_helper.mirror_update(*args)
expect(Open3).to have_received(:capture3).with(*cmd).once
end
end
end

describe '#mirror_list' do
Expand Down
4 changes: 4 additions & 0 deletions tasks/mirror_update.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
"description": "GPG keyring(s) to use when verifying Release file",
"type": "Optional[Variant[Stdlib::Absolutepath,Array[Stdlib::Absolutepath]]]"
},
"latest": {
"description": "Download only latest version of each package (per architecture)",
"type": "Optional[Boolean]"
},
"max_tries": {
"description": "Max download tries till process fails with download error",
"type": "Optional[Integer[0]]"
Expand Down
Loading