build-labels 0.0.26 → 0.0.27

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: 6a94764281e17cee34a35d9fbcd11fe0d702db9e3b0f2073c722f1aa5ddae9e1
4
- data.tar.gz: 1eec4eaf51c4600dca1bdf6a2bee6200ccd93ea90c3bd0354d310495a2bfefc4
3
+ metadata.gz: 208d38d03e2e082828c05f3db32d515798d09ff4cb65c93aa993a5a96d6f1187
4
+ data.tar.gz: cd1ff4fc1c4a9dcd137f0cacbbfee9b66c71cc8b04e2cbe87049c99053276f09
5
5
  SHA512:
6
- metadata.gz: c2cfea7e0a02d74f90d97fff96df3adedf78b652a064b64afb5b4e0433ac1917bfc905d6171f3126da36673309d0c82de27e23dae68c5828ff73310f8b40c421
7
- data.tar.gz: 23a108326a37b8c8ea49237c77b77e0f3d2073cdcfea563c5257963401a10fea64cb278d52a5598f3e0f5f3a8699413204da721f6e43fdb52cdde54a0a10672e
6
+ metadata.gz: ffdf54b18d77baf4c6ecc16760f0e08b35823aa085f69994bcf2fbb474103f4b16bdd31fdd6a49d6c83eb376d60c7679388b82bf8df2e865c2fd4f9c12f960c1
7
+ data.tar.gz: 6cc8f640a773e079ec01ca1ef89ab8118f51359e7c70b38e76bbbffd49bd257ab37830db957a22e630306a7915423d01621f65f25e0faeef192a12070c813f2d
@@ -1,14 +1,13 @@
1
1
  require_relative 'command_line'
2
2
 
3
3
  BuildLabels::CommandLine::COMMANDS[:set_version] = Class.new do
4
- # def options(parser)
5
- # parser.on('', '--set-version', '')
6
- # end
7
-
8
- def apply_gitlab_tag(tag)
9
- return tag if ENV['CI_COMMIT_TAG'].to_s.empty?
10
- git_tag = ENV['CI_COMMIT_TAG']
11
- [tag,git_tag].compact.join '-'
4
+ def commit_message_commands(version)
5
+ return version unless (match = ENV['CI_COMMIT_MESSAGE']&.match(/#push:(\w+)/i))
6
+
7
+ puts 'Debug: Push command detected in commit message'
8
+ version = '0.0' if version.to_s.empty?
9
+ tag = match[1] ? "-#{match[1]}" : ''
10
+ "#{version}.#{ENV['CI_PIPELINE_IID']}#{tag}"
12
11
  end
13
12
 
14
13
  def run(builder, params, compose)
@@ -23,10 +22,11 @@ BuildLabels::CommandLine::COMMANDS[:set_version] = Class.new do
23
22
  versionfile = File.expand_path versionfile, compose_dir
24
23
 
25
24
  current_version = File.exist?( versionfile) ? File.read(versionfile).strip : nil
25
+ current_version = commit_message_commands(current_version)
26
+
26
27
  image = svc['image'].gsub( /:.*/, '')
27
28
  tag = svc['image'][/:(.*)/, 1]
28
29
 
29
- tag = apply_gitlab_tag(tag)
30
30
  full_tag = [current_version, tag].compact.join '-'
31
31
  full_tag = full_tag.empty? ? '' : ":#{full_tag}"
32
32
 
@@ -34,20 +34,14 @@ BuildLabels::CommandLine::COMMANDS[:set_version] = Class.new do
34
34
 
35
35
  next unless svc['build']['tags']
36
36
  svc['build']['tags'] = svc['build']['tags'].map do |t|
37
- image = t.gsub( /:.*/, '')
38
- tag = t[/:(.*)/, 1]
39
- tag = apply_gitlab_tag(tag)
40
-
41
- full_tag = [current_version, tag].compact.join '-'
42
- full_tag = full_tag.empty? ? '' : ":#{full_tag}"
43
-
44
- "#{image}#{full_tag}"
37
+ image, tag = t.split(':')
38
+ full_tag = [current_version, tag].compact.join('-')
39
+ "#{image}#{full_tag.empty? ? '' : ":#{full_tag}"}"
45
40
  end
46
41
  end
47
-
48
42
  end
49
43
 
50
- def help = 'Add version tag from [docker_context]/.version file to image'
51
- end.new
52
-
53
-
44
+ def help
45
+ 'Add version tag from [docker_context]/.version file to image'
46
+ end
47
+ end.new
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module BuildLabels
2
2
  class Builder
3
- VERSION = '0.0.26'
3
+ VERSION = '0.0.27'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-labels
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-29 00:00:00.000000000 Z
11
+ date: 2025-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake