lib/command/deploy_image.rb in cpflow-3.0.1 vs lib/command/deploy_image.rb in cpflow-4.0.0
- old
+ new
@@ -33,11 +33,11 @@
next unless container["image"].match?(%r{^/org/#{config.org}/image/#{config.app}:})
container_name = container["name"]
step("Deploying image '#{image}' for workload '#{container_name}'") do
cp.workload_set_image_ref(workload, container: container_name, image: image)
- deployed_endpoints[container_name] = workload_data.dig("status", "endpoint")
+ deployed_endpoints[container_name] = endpoint_for_workload(workload_data)
end
end
end
progress.puts("\nDeployed endpoints:")
@@ -45,9 +45,18 @@
progress.puts(" - #{workload}: #{endpoint}")
end
end
private
+
+ def endpoint_for_workload(workload_data)
+ endpoint = workload_data.dig("status", "endpoint")
+ Resolv.getaddress(endpoint.split("/").last)
+ endpoint
+ rescue Resolv::ResolvError
+ deployments = cp.fetch_workload_deployments(workload_data["name"])
+ deployments.dig("items", 0, "status", "endpoint")
+ end
def run_release_script
release_script = config[:release_script]
run_command_in_latest_image(release_script, title: "release script")
end