all_images 0.11.2 → 0.12.0
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 +4 -4
- data/CHANGES.md +13 -0
- data/README.md +26 -0
- data/all_images.gemspec +4 -4
- data/lib/all_images/app.rb +17 -21
- data/lib/all_images/version.rb +1 -1
- data/spec/app_spec.rb +4 -0
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4dcdc93b7a13b4553302d63dd2ff1cdd34c5e795d4b45119df2d54454b8c2dac
|
|
4
|
+
data.tar.gz: 0f6743c6e1f723596ea7749e76811815511175852f215dc9b9e74fbe20968df5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7eba1f686ff9afdad5f01dae94ae17648b610a29155552aef157b90f82ce36b161550b457c3cbb10044f31007abce36b1b8eb25756f932b1976cb2bc815dbecc
|
|
7
|
+
data.tar.gz: 31496325b74e67a0bbd0c414375aade96b6e0ba798d0c88910ba2c6e239d48106e4cf10320ab467d83f75a4e91e89faaa7fa13eaa4a815f28d6a494c05f1e1e1
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-01-17 v0.12.0
|
|
4
|
+
|
|
5
|
+
- Added new **before** and **after** configuration hooks in `.all_images.yml`
|
|
6
|
+
for pre/post execution functionality
|
|
7
|
+
- Introduced `RESULT` environment variable to enable post-execution decision
|
|
8
|
+
making in hooks
|
|
9
|
+
- Enhanced `sh` method with `crash: false` option to allow non-fatal hook execution
|
|
10
|
+
- Updated `run_image` method to execute hooks and track test results
|
|
11
|
+
- Updated README documentation for the new hook functionality
|
|
12
|
+
- Updated `rubygems_version` from **4.0.2** to **4.0.3**
|
|
13
|
+
- Updated `gem_hadar` development dependency from **>= 2.16.3** to **>=
|
|
14
|
+
2.17.0**
|
|
15
|
+
|
|
3
16
|
## 2026-01-02 v0.11.2
|
|
4
17
|
|
|
5
18
|
- Updated rake execution to use `bundle exec` for consistent dependency
|
data/README.md
CHANGED
|
@@ -215,6 +215,32 @@ all_images run
|
|
|
215
215
|
# Shows searchable list of available images
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
+
### Pre/Post Execution Hooks 🔄
|
|
219
|
+
|
|
220
|
+
AllImages supports pre/post execution hooks in your configuration:
|
|
221
|
+
|
|
222
|
+
```yaml
|
|
223
|
+
before: |-
|
|
224
|
+
echo 🏁 Preparing…
|
|
225
|
+
echo Deleting Gemfile.lock
|
|
226
|
+
rm -f Gemfile.lock
|
|
227
|
+
|
|
228
|
+
after: |-
|
|
229
|
+
if [[ "$RESULT" = "1" ]]
|
|
230
|
+
then
|
|
231
|
+
echo 😵 Some tests failed!
|
|
232
|
+
else
|
|
233
|
+
echo 🥳 All tests passed!
|
|
234
|
+
fi
|
|
235
|
+
|
|
236
|
+
# ... rest of your configuration
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
- `before` hook runs before each image execution
|
|
240
|
+
- `after` hook runs after each image execution with `RESULT` environment variable
|
|
241
|
+
- `RESULT` indicates success (0) or failure (1) of the test script
|
|
242
|
+
- Hooks are non-fatal (won't stop the workflow if they fail)
|
|
243
|
+
|
|
218
244
|
## Error Handling ⚠️
|
|
219
245
|
|
|
220
246
|
AllImages provides comprehensive error handling for common scenarios:
|
data/all_images.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: all_images 0.
|
|
2
|
+
# stub: all_images 0.12.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.12.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]
|
|
@@ -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 = "4.0.
|
|
20
|
+
s.rubygems_version = "4.0.3".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, [">= 2.
|
|
26
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, [">= 2.17.0".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
|
@@ -116,27 +116,15 @@ class AllImages::App
|
|
|
116
116
|
}
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
#
|
|
121
|
-
# This method runs a given system command with the provided arguments,
|
|
122
|
-
# optionally logging the execution when debug mode is enabled. It checks the
|
|
123
|
-
# command's exit status and raises an exception if the command fails,
|
|
124
|
-
# otherwise returning true to indicate success.
|
|
125
|
-
#
|
|
126
|
-
# @param a [ Array<String> ] the command and its arguments to be executed
|
|
127
|
-
#
|
|
128
|
-
# @return [ TrueClass ] when the command executes successfully
|
|
129
|
-
#
|
|
130
|
-
# @raise [ RuntimeError ] if the executed command exits with a non-zero status
|
|
131
|
-
def sh(*a)
|
|
119
|
+
def sh(script, crash: true)
|
|
132
120
|
if $DEBUG
|
|
133
121
|
STDERR.puts "Executing #{a.inspect}."
|
|
134
122
|
end
|
|
135
|
-
system(
|
|
123
|
+
system(script)
|
|
136
124
|
if $?.success?
|
|
137
125
|
true
|
|
138
|
-
|
|
139
|
-
raise "Command #{
|
|
126
|
+
elsif crash
|
|
127
|
+
raise "Command #{script.inspect} failed with: #{$?.exitstatus}"
|
|
140
128
|
end
|
|
141
129
|
end
|
|
142
130
|
|
|
@@ -165,25 +153,33 @@ class AllImages::App
|
|
|
165
153
|
#
|
|
166
154
|
# @return [ Integer ] exit code indicating success (0) or failure (1) of the script execution
|
|
167
155
|
def run_image(image, script, interactive: false)
|
|
156
|
+
if before = @config['before']
|
|
157
|
+
sh before
|
|
158
|
+
end
|
|
168
159
|
dockerfile = @config.fetch('dockerfile').to_s
|
|
169
160
|
tag = provide_image image, dockerfile, script
|
|
170
161
|
envs = env.full? { |e| +' ' << e.map { |n, v| '-e %s=%s' % [ n, v.inspect ] } * ' ' }
|
|
162
|
+
result = 1
|
|
171
163
|
if interactive
|
|
172
164
|
puts "You can run /script interactively now."
|
|
173
|
-
sh "docker run --name #{name} -it#{envs} -v `pwd`:/work '#{tag}' sh"
|
|
174
|
-
|
|
165
|
+
sh "docker run --name #{name} -it#{envs} -v `pwd`:/work '#{tag}' sh", crash: true
|
|
166
|
+
result = nil
|
|
175
167
|
else
|
|
176
168
|
info_puts "Running container #{name.inspect} for image tagged #{tag.inspect}."
|
|
177
|
-
if sh "docker run --name #{name} -it#{envs} -v `pwd`:/work '#{tag}' sh -c /script"
|
|
169
|
+
if sh "docker run --name #{name} -it#{envs} -v `pwd`:/work '#{tag}' sh -c /script", crash: false
|
|
178
170
|
info_puts "Image tagged #{tag.inspect} was run with result:"
|
|
179
171
|
puts green('SUCCESS')
|
|
180
|
-
|
|
172
|
+
result = 0
|
|
181
173
|
else
|
|
182
174
|
info_puts "Image tagged #{tag.inspect} was run with result:"
|
|
183
175
|
puts red('FAILURE')
|
|
184
|
-
return 1
|
|
185
176
|
end
|
|
186
177
|
end
|
|
178
|
+
if result and after = @config['after']
|
|
179
|
+
ENV['RESULT'] = result.to_s
|
|
180
|
+
sh after, crash: false
|
|
181
|
+
end
|
|
182
|
+
result.to_i
|
|
187
183
|
ensure
|
|
188
184
|
sh "docker rm -f #{name} >/dev/null"
|
|
189
185
|
end
|
data/lib/all_images/version.rb
CHANGED
data/spec/app_spec.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: all_images
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.12.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 2.
|
|
18
|
+
version: 2.17.0
|
|
19
19
|
type: :development
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 2.
|
|
25
|
+
version: 2.17.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: rake
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
211
211
|
- !ruby/object:Gem::Version
|
|
212
212
|
version: '0'
|
|
213
213
|
requirements: []
|
|
214
|
-
rubygems_version: 4.0.
|
|
214
|
+
rubygems_version: 4.0.3
|
|
215
215
|
specification_version: 4
|
|
216
216
|
summary: Runs a script in all of the docker images
|
|
217
217
|
test_files:
|