lib/kubes/docker/strategy/image_name.rb in kubes-0.9.1 vs lib/kubes/docker/strategy/image_name.rb in kubes-0.9.2
- old
+ new
@@ -17,10 +17,16 @@
FileUtils.mkdir_p(File.dirname(image_state_path))
text = JSON.pretty_generate(image: @@image_name)
IO.write(image_state_path, text)
end
+ def read_image_name
+ return unless File.exist?(image_state_path)
+ data = IO.read(image_state_path).strip
+ JSON.load(data)['image']
+ end
+
# output can get entirely wiped so dont use that folder
def image_state_path
Kubes.config.state.path
end
@@ -41,10 +47,11 @@
end
@@timestamp = Time.now.strftime('%Y-%m-%dT%H-%M-%S')
def generate_name
# IE: tongueroo/demo:kubes-
- ["#{repo}:kubes-#{@@timestamp}", git_sha].compact.join('-')
+ tag = ENV['KUBES_IMAGE_TAG'] || Kubes.config.image_tag || ["kubes-#{@@timestamp}", git_sha].compact.join('-')
+ "#{repo}:#{tag}"
end
def repo
Kubes.config.repo
end