Skip to content

Commit

Permalink
feat: do not let clean task delete currently deployed or currently re…
Browse files Browse the repository at this point in the history
…leased+supported versions
  • Loading branch information
bethesque committed Nov 11, 2021
1 parent 71844f0 commit b05f0b6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/pact_broker/tasks/clean_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ def rake_task &block
if keep_version_selectors.nil? || keep_version_selectors.empty?
raise PactBroker::Error.new("You must specify which versions to keep")
else
if keep_version_selectors.none?(&:currently_deployed?)
keep_version_selectors << PactBroker::DB::Clean::Selector.new(deployed: true)
end

if keep_version_selectors.none?(&:currently_supported?)
keep_version_selectors << PactBroker::DB::Clean::Selector.new(released: true)
end

output "#{prefix}Deleting oldest #{version_deletion_limit} versions, keeping versions that match the configured selectors", keep_version_selectors
end

Expand Down

0 comments on commit b05f0b6

Please sign in to comment.