build-labels 0.0.24 → 0.0.25

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
  SHA256:
3
- metadata.gz: fd7ab1245c1d04bebef6f2aaca6741ea9529e59158f3fdf0beeaecbf516ca868
4
- data.tar.gz: d07338cffd8ad2d6cd610d3f35291996b7d8477f475724f5f162d14089caeaff
3
+ metadata.gz: d05ba80af8d752ebf4ce95012e228afada07ccf3636a2a21082b1cc3e2c367be
4
+ data.tar.gz: d1fbeb9d6f7dbedadbdd6d118509a2ee33d752152aaf65d5f9fec1c22c30c464
5
5
  SHA512:
6
- metadata.gz: '096a1d7fd6cea945e5f6a0cce84456396ac028698c0999eb017ea3d0136206f65e3115318f7cd684ed3b9320ce9e95e00f7b4d9132383dceb9f3098aa068f685'
7
- data.tar.gz: bcce2f8607691a553192c0dcfcbcb8e2a1de3c02657c7793e20d5c2728af39dc158598c7df6eb644e58e12b0de83c2675f58199034886a1c90a4b8ff6ba55f40
6
+ metadata.gz: 8b210add16eeb51a3f485308f993928bcf02033d984bc17a6331792541a05cd6bfa13b8574fa5f027fc35fe11c8c022b90d75bd84a4595c9e2f9d40feb7374eb
7
+ data.tar.gz: 16aa41dbba662aa18bbe1bbfa871132b1884dcbaf6412b7d2d60833855add373cae745a5f384224e995554029cf7395efcbfb15ae5326ee35f14fae15d8e41c8
@@ -5,7 +5,6 @@ BuildLabels::CommandLine::COMMANDS[:set_version] = Class.new do
5
5
  # parser.on('', '--set-version', '')
6
6
  # end
7
7
 
8
-
9
8
  def apply_gitlab_tag(tag)
10
9
  return tag if ENV['CI_COMMIT_TAG'].to_s.empty?
11
10
  git_tag = ENV['CI_COMMIT_TAG']
@@ -22,20 +21,27 @@ BuildLabels::CommandLine::COMMANDS[:set_version] = Class.new do
22
21
  versionfile = svc['build'].is_a?(String) ? './' : svc['build']['context']
23
22
  versionfile = File.join versionfile, '.version'
24
23
  versionfile = File.expand_path versionfile, compose_dir
25
- next unless File.exist? versionfile
26
- current_version = File.read(versionfile).strip
24
+
25
+ current_version = File.exist?( versionfile) ? File.read(versionfile).strip : nil
27
26
  image = svc['image'].gsub( /:.*/, '')
28
27
  tag = svc['image'][/:(.*)/, 1]
29
28
 
30
29
  tag = apply_gitlab_tag(tag)
31
- svc['image'] = "#{image}:#{current_version}#{tag ? "-" + tag : ""}"
30
+ full_tag = [current_version, tag].compact.join '-'
31
+ full_tag = full_tag.empty? ? ":#{full_tag}" : ''
32
+
33
+ svc['image'] = "#{image}#{full_tag}"
32
34
 
33
35
  next unless svc['build']['tags']
34
36
  svc['build']['tags'] = svc['build']['tags'].map do |t|
35
37
  image = t.gsub( /:.*/, '')
36
38
  tag = t[/:(.*)/, 1]
37
39
  tag = apply_gitlab_tag(tag)
38
- "#{image}:#{current_version}#{tag ? "-" + tag : ""}"
40
+
41
+ full_tag = [current_version, tag].compact.join '-'
42
+ full_tag = full_tag.empty? ? ":#{full_tag}" : ''
43
+
44
+ "#{image}#{full_tag}"
39
45
  end
40
46
  end
41
47
 
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module BuildLabels
2
2
  class Builder
3
- VERSION = '0.0.24'
3
+ VERSION = '0.0.25'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-labels
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B