yatfa 1.0.83 → 1.0.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/yatfa_agent/agent.rb
CHANGED
|
@@ -303,7 +303,7 @@ module YatfaAgent
|
|
|
303
303
|
end
|
|
304
304
|
|
|
305
305
|
# Add yatfa.version label for updater daemon to detect stale containers
|
|
306
|
-
# Uses
|
|
306
|
+
# Uses version number from remote version.json (already fetched by build_image)
|
|
307
307
|
if remote_version
|
|
308
308
|
docker_cmd += ["--label", "yatfa.version=#{remote_version}"]
|
|
309
309
|
end
|
|
@@ -28,7 +28,7 @@ module YatfaAgent
|
|
|
28
28
|
response = Net::HTTP.get_response(uri)
|
|
29
29
|
return nil unless response.is_a?(Net::HTTPSuccess)
|
|
30
30
|
data = JSON.parse(response.body)
|
|
31
|
-
data["
|
|
31
|
+
data["version"]
|
|
32
32
|
rescue StandardError
|
|
33
33
|
nil
|
|
34
34
|
end
|
|
@@ -57,7 +57,7 @@ module YatfaAgent
|
|
|
57
57
|
|
|
58
58
|
if no_cache
|
|
59
59
|
if local_version
|
|
60
|
-
puts "🔄 Infrastructure updated (#{local_version
|
|
60
|
+
puts "🔄 Infrastructure updated (v#{local_version} → v#{remote_version}), rebuilding without cache..."
|
|
61
61
|
else
|
|
62
62
|
puts "🔄 First build (or stamp missing), rebuilding without cache..."
|
|
63
63
|
end
|
|
@@ -39,7 +39,7 @@ module YatfaAgent
|
|
|
39
39
|
return
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
puts " Remote version: #{remote_version
|
|
42
|
+
puts " Remote version: v#{remote_version}"
|
|
43
43
|
|
|
44
44
|
# 2. Find yatfa-managed containers
|
|
45
45
|
containers = list_yatfa_containers
|
|
@@ -102,7 +102,7 @@ module YatfaAgent
|
|
|
102
102
|
# @return [String, nil] label value
|
|
103
103
|
def self.get_container_label(container_id, label)
|
|
104
104
|
result = IO.popen(
|
|
105
|
-
["docker", "inspect", "--format",
|
|
105
|
+
["docker", "inspect", "--format", %({{index .Config.Labels "#{label}"}}), container_id],
|
|
106
106
|
err: File::NULL,
|
|
107
107
|
&:read
|
|
108
108
|
).strip
|
|
@@ -111,7 +111,7 @@ module YatfaAgent
|
|
|
111
111
|
|
|
112
112
|
# Update a single stale container
|
|
113
113
|
# @param container [Hash] container info from list_yatfa_containers
|
|
114
|
-
# @param new_version [String] target version
|
|
114
|
+
# @param new_version [String] target infrastructure version number
|
|
115
115
|
def self.update_container(container, new_version)
|
|
116
116
|
name = container[:name]
|
|
117
117
|
puts ""
|
|
@@ -261,7 +261,7 @@ module YatfaAgent
|
|
|
261
261
|
# Build a docker run command to recreate a container with preserved config
|
|
262
262
|
# @param name [String] container name
|
|
263
263
|
# @param config [Hash] container inspect data
|
|
264
|
-
# @param new_version [String] target version
|
|
264
|
+
# @param new_version [String] target infrastructure version number
|
|
265
265
|
# @return [Array<String>] docker command arguments
|
|
266
266
|
def self.build_recreate_command(name, config, new_version)
|
|
267
267
|
cmd = ["docker", "run", "-d", "--name", name]
|