rancher-charts/.github/workflows/regsync-split.rb

24 lines
510 B
Ruby
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

#! /usr/bin/env ruby
require "json"
require "pathname"
require "yaml"
pwd = Pathname(Dir.pwd)
regsync = YAML.load((pwd + "regsync.yaml").read)
regsync["sync"].sum do |sync|
sync["tags"]["allow"].count
end.then do |sum|
puts "total tags to consider: #{sum}"
end
regsync["sync"].each do |sync|
regsync.merge("sync" => [sync]).then do |regsync|
(pwd + "regsync" + sync["source"]).then do |dir|
dir.mkpath
(dir + "regsync.yaml").write(YAML.dump(regsync))
end
end
end