2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
desc "GitLab | X509 | Update signatures when certificate store has changed"
|
|
|
|
namespace :gitlab do
|
|
|
|
namespace :x509 do
|
|
|
|
task update_signatures: :environment do
|
2023-05-27 22:25:52 +05:30
|
|
|
require 'logger'
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
update_certificates
|
|
|
|
end
|
|
|
|
|
|
|
|
def update_certificates
|
2021-09-04 01:27:46 +05:30
|
|
|
logger = Logger.new($stdout)
|
2020-04-22 19:07:51 +05:30
|
|
|
|
2022-01-26 12:08:38 +05:30
|
|
|
unless CommitSignatures::X509CommitSignature.exists?
|
2020-04-22 19:07:51 +05:30
|
|
|
logger.info("Unable to find any x509 commit signatures. Exiting.")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
logger.info("Start to update x509 commit signatures")
|
|
|
|
|
2022-01-26 12:08:38 +05:30
|
|
|
CommitSignatures::X509CommitSignature.find_each do |sig|
|
2020-04-22 19:07:51 +05:30
|
|
|
sig.x509_commit&.update_signature!(sig)
|
|
|
|
end
|
|
|
|
|
|
|
|
logger.info("End update x509 commit signatures")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|