fig-lock 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bca2a28b6c732f30e24541658e453a8aa48f1010
4
- data.tar.gz: 97062daed4c6738cf9531bad45ad3ee1d7819a31
3
+ metadata.gz: 6145c846418bac63b04262835d0a4c8f14510f7f
4
+ data.tar.gz: 4ea6437b110024c40ca59605924e6962bc510215
5
5
  SHA512:
6
- metadata.gz: 48b3d569173fb90b3ef1edf36aa0ac1220324a39112b886a2a9ff359a9f68903fd57485c492d40d1f0ec2f50b93e6f6262eac78f950d3a0c6cb0ef6d34d7d842
7
- data.tar.gz: c407eeaf4ec48d51a2bdc7354e58645042a87cd045cf0608b49fcb237070bf722539f2cf0ad257c0f9e02623a2971eb6517160ead1ee963df5f272e4ca94f92b
6
+ metadata.gz: 759652ccdc1d8bab83b7ca27558cda77ee03c86f85d76a1553e3dc8687e4cc3b969a6397235e999ee4a3fb344833cf3a38ec33a99d0dcb9a59778f8f3b54bae6
7
+ data.tar.gz: 053e33ca23279c6a461d82c0cb2809f0db1265ae679831cbfc0b6154e5d370b1162df9f19d35d97b860232a255e5978c58ce90dca2c4b01d811d03c37bb88b53
@@ -63,27 +63,39 @@ module Fig
63
63
  # Select the latest version for images in the fig hash. Updates the input hash.
64
64
  def select_latest(hash)
65
65
  log.info "Selecting latest tags:"
66
+
67
+ resolved_tags = {}
68
+
66
69
  hash.each do |k,v|
67
70
  image = v['image']
68
71
  image = "#{image}:latest" unless image.index(':')
69
72
  log.info "Selecting latest tag for #{image} ..."
73
+
74
+
70
75
  unless image.nil?
71
- # Fetch tags
72
- tags = docker_client.tags(image)
73
- latest = tags['latest']
74
- fail "Image #{image} has no latest tag" if latest.nil?
75
-
76
- # Figure out which one corresponds to "latest"
77
- version = tags.detect{|k,v|
78
- v == latest && k != 'latest'
79
- }
80
- version = version[0] if version
81
- fail "No matching version found for hash #{latest}" unless version
76
+ result = resolved_tags[image]
77
+ if result
78
+ log.info "Using previously resolved image: #{result}"
79
+ else
80
+ # Fetch tags
81
+ tags = docker_client.tags(image)
82
+ latest = tags['latest']
83
+ fail "Image #{image} has no latest tag" if latest.nil?
84
+
85
+ # Figure out which one corresponds to "latest"
86
+ version = tags.detect{|k,v|
87
+ v == latest && k != 'latest'
88
+ }
89
+ version = version[0] if version
90
+ fail "No matching version found for hash #{latest}" unless version
91
+
92
+ result = "#{image[0..image.rindex(':')-1]}:#{version}"
93
+ log.info "Resolved image: #{result}"
94
+ resolved_tags[image] = result
95
+ end
82
96
 
83
97
  # Update hash
84
- result = "#{image[0..image.rindex(':')-1]}:#{version}"
85
98
  v['image'] = result
86
- log.info "Resolved image: #{result}"
87
99
  end
88
100
  end
89
101
  end
@@ -1,5 +1,5 @@
1
1
  module Fig
2
2
  class Lock
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fig-lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Shea