phoebo 0.3.4 → 0.3.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b02687c6a02c73020be2cbb439df797f779e094c
4
- data.tar.gz: eb92a5b4e00451eaebe0bdf6807d36e9a5bbdf3a
3
+ metadata.gz: aaaf647c7943ab6ee828ac42aa52d8e1af4153b8
4
+ data.tar.gz: 0deba1bc5f55d3886520551295d9de3389a3692b
5
5
  SHA512:
6
- metadata.gz: e4ce79487f72c76dcc1920e20738d325d9f8b17ec6c2c052b54fe3ff7bf4b2e11edebbd4f330a18a4d23962287904ee3ab491db0328ebb7767b0c5d4f89af5c9
7
- data.tar.gz: c9526f19ab92696fa0ef22eebf881bc38f49a12b7f9f1d15a98aa7cb7219ced1921696efbeb9265626ac9b952a2cb8bf6245d6089d2fa105b458e622aca19f01
6
+ metadata.gz: 868e904c086951ff65bb8d610ab8e35542ccd260d3e13f5b60491e9069a1522fff28b223068a5aa12e30f6a3aa0c662614fc6ce4fb8614976c6616fffb7ebc4f
7
+ data.tar.gz: 1f0050f8d930f9a89dc47afc0f6dd0ad1213c7da2cc6da0fb849a25331dc9e20987ff54e5a422bfda93a9c245c17412abf080b25a1955d08697eb0006e8a0ec3
@@ -49,6 +49,10 @@ module Phoebo
49
49
  raise Phoebo::SyntaxError.new("You need to define image for #{id}.")
50
50
  end
51
51
  end
52
+
53
+ unless task[:image] =~ /:[^:]+$/i
54
+ task[:image] += ":#{Image.tag(@request.ref)}"
55
+ end
52
56
  end
53
57
 
54
58
  self
@@ -59,6 +59,18 @@ module Phoebo
59
59
  end
60
60
  end
61
61
 
62
+ # Create image tag from ref
63
+ def self.tag(ref)
64
+ if ref
65
+ if ref =~ /^[0-9a-f]+$/i
66
+ return ref[0...8].downcase
67
+ else
68
+ return ref
69
+ end
70
+ else
71
+ return 'latest'
72
+ end
73
+ end
62
74
  end
63
75
  end
64
76
  end
@@ -8,12 +8,11 @@ module Phoebo
8
8
  class ImageBuilder
9
9
  include Console
10
10
 
11
- def initialize(base_path, request)
11
+ def initialize(base_path)
12
12
  @base_path = Pathname.new(base_path)
13
- @request = request
14
13
  end
15
14
 
16
- def build(image)
15
+ def build(image, tag)
17
16
  project_files = { }
18
17
  dockerfile = []
19
18
 
@@ -49,19 +48,8 @@ module Phoebo
49
48
  stdout.print " virtual size: " + ('%.2f MB' % (built_image.json['VirtualSize'].to_f / 1000 / 1000)).cyan
50
49
  stdout.puts
51
50
 
52
- if @request.ref
53
- if @request.ref =~ /^[0-9a-f]+$/i
54
- tag = @request.ref[0...8]
55
- else
56
- tag = @request.ref
57
- end
58
- else
59
- tag = 'latest'
60
- end
61
-
62
51
  stdout.puts "Tagging image #{built_image.id.to_s.cyan} -> #{image.name.cyan}#{':'.cyan}#{tag.cyan}"
63
52
  built_image.tag('repo' => image.name, 'tag' => tag, 'force' => true)
64
- image.name += ":#{tag}"
65
53
 
66
54
  # Return image ID
67
55
  built_image.id
@@ -1,3 +1,3 @@
1
1
  module Phoebo
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
@@ -23,9 +23,9 @@ module Phoebo
23
23
  config = Config.new_from_file(config_path, @request)
24
24
 
25
25
  # Build & push image
26
- builder = Docker::ImageBuilder.new(path, @request)
26
+ builder = Docker::ImageBuilder.new(path)
27
27
  config.images.each do |image|
28
- image_id = builder.build(image)
28
+ image_id = builder.build(image, Config::Image.tag(@request.ref))
29
29
  pusher.push(image_id) if @request.docker_user
30
30
  end
31
31
 
@@ -40,6 +40,6 @@ describe Phoebo::Docker::ImageBuilder do
40
40
 
41
41
  it 'processes commands' do
42
42
  expect(Docker::Image).to receive(:build_from_tar).and_return(docker_image)
43
- subject.build(image)
43
+ subject.build(image, 'latest')
44
44
  end
45
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phoebo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Staněk