all_images 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +29 -10
- data/all_images.gemspec +5 -5
- data/lib/all_images/app.rb +32 -8
- data/lib/all_images/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbf39eaf44bd3eef5cba7b22e942621717fd838cde984764c684ba2a7f8842f7
|
4
|
+
data.tar.gz: f8c257c224e80f2ae251ec8e05b8869d3348ae0408d4a0dadd789ef74ce182c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39b423c850d91d8a7261c2b4677ba9935486797e0dd08ab2cca2ed6e9af78c162296cd89daa7e7ce71dd23999fed098f4158edc57d34222d99ef38db495bca10
|
7
|
+
data.tar.gz: 4a2d1611e0452b452963c099aed19163af335290015b25b72757db37803827a304d77282c3cc0919cfc0b24855703d8fb727cd74dd4c11664edcee7b3bbbac08
|
data/CHANGES.md
CHANGED
@@ -1,9 +1,28 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## 2024-10-14 v0.6.0
|
4
|
+
|
5
|
+
### Significant Changes
|
6
|
+
* **Add support for environment variables to all_images**
|
7
|
+
+ Require `'tins/xt/full'` and add new method `env` to set environment variables.
|
8
|
+
+ Modified the `sh` method to use environment variables from the `env` method.
|
9
|
+
+ Modified the `run_image` method to include environment variables in the Docker command.
|
10
|
+
* Update rake task to use spec instead of test
|
11
|
+
* Added `[IMAGE]` as an optional argument in the Usage message.
|
12
|
+
|
13
|
+
### Other Changes
|
14
|
+
* Reformat CHANGES.md
|
15
|
+
* Add error reporting to `sh`
|
16
|
+
+ Added require `'shellwords'`
|
17
|
+
|
18
|
+
#### Environment Variables
|
19
|
+
* Added `env` section to `.all_images.yml`
|
20
|
+
* Defined `FOO=bar` and `USER` environment variables
|
21
|
+
|
3
22
|
## 2024-09-01 v0.5.0
|
4
23
|
|
5
24
|
* **Update image processing for parallel execution**:
|
6
|
-
|
25
|
+
+ Added random suffix to image names to prevent conflicts between concurrent processes.
|
7
26
|
* Added `CHANGES.md` file
|
8
27
|
|
9
28
|
## 2024-08-08 v0.4.1
|
@@ -31,20 +50,20 @@
|
|
31
50
|
## 2023-06-01 v0.2.3
|
32
51
|
|
33
52
|
* **New Features**
|
34
|
-
|
53
|
+
+ Added support for Ruby 3.2
|
35
54
|
* **Changes**
|
36
|
-
|
37
|
-
|
55
|
+
+ Bumped build version
|
56
|
+
+ Removed support for Ruby 2.5
|
38
57
|
* **Bug Fixes**
|
39
|
-
|
58
|
+
+ Repaired `fail_fast` mode
|
40
59
|
|
41
60
|
## 2023-04-19 v0.2.2
|
42
61
|
|
43
62
|
* **New Version Features**
|
44
|
-
|
45
|
-
|
63
|
+
+ Progress into the future of ruby development
|
64
|
+
+ Progress into the future
|
46
65
|
* **Significant Changes**
|
47
|
-
|
66
|
+
+ Removed development dependency (again)
|
48
67
|
|
49
68
|
## 2022-11-17 v0.2.1
|
50
69
|
|
@@ -53,8 +72,8 @@
|
|
53
72
|
## 2022-11-17 v0.2.0
|
54
73
|
|
55
74
|
* **New Features**
|
56
|
-
|
57
|
-
|
75
|
+
+ Added commands to run and debug single images
|
76
|
+
+ Added a debug debugger feature
|
58
77
|
|
59
78
|
## 2022-11-17 v0.1.0
|
60
79
|
|
data/all_images.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: all_images 0.
|
2
|
+
# stub: all_images 0.6.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "all_images".freeze
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.6.0".freeze
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Florian Frank".freeze]
|
11
|
-
s.date = "2024-
|
11
|
+
s.date = "2024-10-14"
|
12
12
|
s.description = "A script that runs a script in all of the configured docker images".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
14
|
s.executables = ["all_images".freeze]
|
@@ -17,13 +17,13 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.homepage = "https://github.com/flori/all_images".freeze
|
18
18
|
s.licenses = ["MIT".freeze]
|
19
19
|
s.rdoc_options = ["--title".freeze, "AllImages -- Runs a script in all of the docker images".freeze, "--main".freeze, "README.md".freeze]
|
20
|
-
s.rubygems_version = "3.5.
|
20
|
+
s.rubygems_version = "3.5.18".freeze
|
21
21
|
s.summary = "Runs a script in all of the docker images".freeze
|
22
22
|
s.test_files = ["spec/app_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
23
23
|
|
24
24
|
s.specification_version = 4
|
25
25
|
|
26
|
-
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.
|
26
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.19".freeze])
|
27
27
|
s.add_development_dependency(%q<rake>.freeze, [">= 0".freeze])
|
28
28
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
|
29
29
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0".freeze])
|
data/lib/all_images/app.rb
CHANGED
@@ -2,13 +2,13 @@ require 'term/ansicolor'
|
|
2
2
|
require 'tmpdir'
|
3
3
|
require 'fileutils'
|
4
4
|
require 'tins'
|
5
|
+
require 'tins/xt/full'
|
6
|
+
require 'shellwords'
|
5
7
|
|
6
8
|
class AllImages::App
|
7
9
|
include Term::ANSIColor
|
8
10
|
include FileUtils
|
9
11
|
|
10
|
-
alias sh system
|
11
|
-
|
12
12
|
def initialize(args)
|
13
13
|
@args = args.dup
|
14
14
|
@command = pick_command
|
@@ -18,13 +18,12 @@ class AllImages::App
|
|
18
18
|
|
19
19
|
def run
|
20
20
|
@config = load_config or return 23
|
21
|
-
|
22
21
|
result = 0
|
23
22
|
case @command
|
24
23
|
when 'ls'
|
25
24
|
puts Array(@config['images']).map(&:first)
|
26
25
|
when 'help'
|
27
|
-
puts "Usage: #{File.basename($0)} #{@commands * ?|} IMAGE"
|
26
|
+
puts "Usage: #{File.basename($0)} #{@commands * ?|} [IMAGE]"
|
28
27
|
else
|
29
28
|
Array(@config['images']).each do |image, script|
|
30
29
|
case @command
|
@@ -45,20 +44,45 @@ class AllImages::App
|
|
45
44
|
|
46
45
|
private
|
47
46
|
|
47
|
+
def env
|
48
|
+
vars = @config.fetch('env', [])
|
49
|
+
vars << 'TERM' if ENV.key?('TERM')
|
50
|
+
vars.each_with_object({}) { |v, h|
|
51
|
+
name, value = v.split(?=, 2)
|
52
|
+
if value
|
53
|
+
h[name] = value
|
54
|
+
else
|
55
|
+
h[name] = ENV[name]
|
56
|
+
end
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def sh(*a)
|
61
|
+
if $DEBUG
|
62
|
+
STDERR.puts "Executing #{a.inspect}."
|
63
|
+
end
|
64
|
+
system(*a)
|
65
|
+
if $?.success?
|
66
|
+
true
|
67
|
+
else
|
68
|
+
raise "Command #{Shellwords.join(a).inspect} failed with: #{$?.exitstatus}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
48
72
|
def name
|
49
73
|
[ 'all_images', @suffix ] * ?-
|
50
74
|
end
|
51
75
|
|
52
76
|
def run_image(image, script, interactive: false)
|
53
77
|
dockerfile = @config.fetch('dockerfile').to_s
|
54
|
-
tag
|
55
|
-
|
78
|
+
tag = provide_image image, dockerfile, script
|
79
|
+
envs = env.full? { |e| +' ' << e.map { |n, v| '-e %s=%s' % [ n, v.inspect ] } * ' ' }
|
56
80
|
if interactive
|
57
81
|
puts "You can run /script interactively now."
|
58
|
-
sh "docker run --name #{name} -it
|
82
|
+
sh "docker run --name #{name} -it#{envs} -v `pwd`:/work '#{tag}' sh"
|
59
83
|
return 0
|
60
84
|
else
|
61
|
-
if sh "docker run --name #{name} -it
|
85
|
+
if sh "docker run --name #{name} -it#{envs} -v `pwd`:/work '#{tag}' sh -c /script"
|
62
86
|
puts green('SUCCESS')
|
63
87
|
return 0
|
64
88
|
else
|
data/lib/all_images/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: all_images
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: '1.19'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: '1.19'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
|
-
rubygems_version: 3.5.
|
160
|
+
rubygems_version: 3.5.18
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Runs a script in all of the docker images
|