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 +4 -4
- data/lib/fig/lock.rb +25 -13
- data/lib/fig/lock/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6145c846418bac63b04262835d0a4c8f14510f7f
|
4
|
+
data.tar.gz: 4ea6437b110024c40ca59605924e6962bc510215
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 759652ccdc1d8bab83b7ca27558cda77ee03c86f85d76a1553e3dc8687e4cc3b969a6397235e999ee4a3fb344833cf3a38ec33a99d0dcb9a59778f8f3b54bae6
|
7
|
+
data.tar.gz: 053e33ca23279c6a461d82c0cb2809f0db1265ae679831cbfc0b6154e5d370b1162df9f19d35d97b860232a255e5978c58ce90dca2c4b01d811d03c37bb88b53
|
data/lib/fig/lock.rb
CHANGED
@@ -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
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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
|
data/lib/fig/lock/version.rb
CHANGED