Created
May 24, 2018 19:40
-
-
Save thomasmckay/30761adbfb00144cea1ae4cf2aa96835 to your computer and use it in GitHub Desktop.
skopeo copy upload w/ hammer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
inspect_results = JSON.parse(`skopeo inspect #{ARGV[0]}`) | |
name = inspect_results['Name'].split('/')[-1] | |
Dir.mkdir(name) unless Dir.exist?(name) | |
Dir.chdir(name) | |
inspect_results['RepoTags'].each do |repotag| | |
puts "#{repotag}" | |
if !Dir.exist?(repotag) | |
Dir.mkdir(repotag) | |
`skopeo copy #{ARGV[0]}:#{repotag} dir:#{repotag}` | |
end | |
if !File.exist?("#{repotag}.tar") | |
Dir.chdir(repotag) | |
`tar cvf ../#{repotag}.tar *` | |
Dir.chdir("..") | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment