Skip to content

Commit

Permalink
Update hokusai tag-matching to be [only] compatible with >=v0.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyAghion committed Apr 5, 2019
1 parent 6ddc2d8 commit 57ee7ae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/releasecop/manifest_item.rb
Expand Up @@ -24,9 +24,11 @@ def bare_clone?
private

def find_hokusai_sha
images_output = with_aws_env { `hokusai registry images` }
tags = images_output.lines.grep(/\d{4}.* | .* | .*/).map{|l| l.split(' | ').last.split(',').map(&:strip)}
tags.detect{|t| t.include?(@options['hokusai']) }.detect{|t| t[/^[0-9a-f]{40}$/]}
images_output = with_aws_env { `hokusai registry images --limit 1000` } # list as many items as possible
tags = images_output.lines.grep(/\d{4}.* \| .*/).map do |l| # lines listing images
l.split(' | ').last.gsub(/\e\[(\d+)(\;\d+)*m/, '').split(',').map(&:strip) # tags
end
tags.detect{|t| t.include?(@options['hokusai']) }.detect{|t| t[/^[0-9a-f]{40}$/]} # first SHA-seeming tag matching environment
end

def find_tag_pattern_sha
Expand Down

0 comments on commit 57ee7ae

Please sign in to comment.