miniexec 0.2.0 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/miniexec +14 -2
- data/lib/miniexec.rb +10 -9
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d42d81b21704d53e71cec76c58b95d15a24efce4efba79b2f358a1dd2b36086
|
4
|
+
data.tar.gz: 3aecd26ce85507c06db8cac29e337679d433085aa40055f421bde2277331ae76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c2073f300e8de6d25ae5ecd7fd5a6074c8ee547c3800a30f76ed751a0b36c60e2a5ebe2acd6a79587797674a39557dbe3299cc968f1d0899fe23bab514ea3c4
|
7
|
+
data.tar.gz: a6df904324c30967a49f41cac1ac5533df6612fe72fbd1b02cf6ba8c71b3302e5449de6a24476a24a08357e0bbd2fbcaf2b97ca9e3381a827160da607d399f8a
|
data/bin/miniexec
CHANGED
@@ -10,7 +10,9 @@ options = {
|
|
10
10
|
binds: [],
|
11
11
|
env: {},
|
12
12
|
path: '.',
|
13
|
-
docker: ENV['DOCKER_HOST'] || '/run/docker.sock'
|
13
|
+
docker: ENV['DOCKER_HOST'] || '/run/docker.sock',
|
14
|
+
cwd: true,
|
15
|
+
file: nil
|
14
16
|
}
|
15
17
|
|
16
18
|
OptionParser.new do |opts|
|
@@ -40,6 +42,14 @@ OptionParser.new do |opts|
|
|
40
42
|
'Location of the docker socket') do |sock|
|
41
43
|
options[:docker] = sock
|
42
44
|
end
|
45
|
+
opts.on('-f', '--file FILE',
|
46
|
+
'Manually specify a custom .gitlab-ci.yml file.') do |file|
|
47
|
+
options[:file] = file
|
48
|
+
end
|
49
|
+
opts.on('-n', '--no-mount-cwd',
|
50
|
+
'Don\'t mount the CWD in the container\'s WORKDIR by default.') do
|
51
|
+
options[:cwd] = false
|
52
|
+
end
|
43
53
|
end.parse!
|
44
54
|
|
45
55
|
raise OptionParser::MissingArgument, 'Specify a job with -j' if options[:job].nil?
|
@@ -48,5 +58,7 @@ MiniExec::MiniExec.config(project_path: options[:path])
|
|
48
58
|
exec = MiniExec::MiniExec.new options[:job],
|
49
59
|
docker_url: options[:docker],
|
50
60
|
binds: options[:binds],
|
51
|
-
env: options[:env]
|
61
|
+
env: options[:env],
|
62
|
+
mount_cwd: options[:cwd] || false,
|
63
|
+
file: options[:file]
|
52
64
|
exec.run_job
|
data/lib/miniexec.rb
CHANGED
@@ -32,26 +32,28 @@ module MiniExec
|
|
32
32
|
docker_url: nil,
|
33
33
|
binds: [],
|
34
34
|
env: {},
|
35
|
-
mount_cwd: true
|
35
|
+
mount_cwd: true,
|
36
|
+
file: nil)
|
36
37
|
@job_name = job
|
37
38
|
@project_path = project_path
|
38
|
-
|
39
|
+
file ||= "#{@project_path}/#{MiniExec.workflow_file}"
|
40
|
+
@workflow = YAML.load(File.read(file))
|
39
41
|
@job = @workflow[job]
|
40
42
|
@job['name'] = job
|
41
43
|
@default_image = @workflow['image'] || 'debian:buster-slim'
|
42
|
-
@image = set_job_image
|
43
44
|
@entrypoint = set_job_entrypoint
|
44
45
|
@binds = binds
|
45
46
|
@mount_cwd = mount_cwd
|
46
47
|
@env = {}
|
47
48
|
[
|
48
|
-
env,
|
49
|
-
gitlab_env,
|
50
49
|
@workflow['variables'],
|
51
|
-
@job['variables']
|
50
|
+
@job['variables'],
|
51
|
+
gitlab_env,
|
52
|
+
env
|
52
53
|
].each do |var_set|
|
53
54
|
@env.merge!(var_set.transform_values { |v| Util.expand_var(v.to_s, @env) }) if var_set
|
54
55
|
end
|
56
|
+
@image = set_job_image
|
55
57
|
@script = compile_script
|
56
58
|
@runlog = []
|
57
59
|
configure_logger
|
@@ -80,7 +82,7 @@ module MiniExec
|
|
80
82
|
Cmd: ['/usr/bin/env', 'bash', script_path],
|
81
83
|
WorkingDir: working_dir,
|
82
84
|
Entrypoint: @entrypoint,
|
83
|
-
Volumes:
|
85
|
+
Volumes: binds.map { |b| { b => { path_parent: 'rw' } } }.inject(:merge),
|
84
86
|
Env: @env.map { |k, v| "#{k}=#{v}" }
|
85
87
|
)
|
86
88
|
container.store_file(script_path, @script)
|
@@ -100,8 +102,7 @@ module MiniExec
|
|
100
102
|
image = @job['image'] if @job['image'].instance_of?(String)
|
101
103
|
image = @job['image']['name'] if @job['image'].instance_of?(Hash)
|
102
104
|
end
|
103
|
-
|
104
|
-
image || @default_image
|
105
|
+
Util.expand_var(image, @env) || @default_image
|
105
106
|
end
|
106
107
|
|
107
108
|
def set_job_entrypoint
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miniexec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Pugh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
12
|
-
dependencies:
|
11
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: docker-api
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: git
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
13
41
|
description: A minimal interpretor/executor for .gitlab-ci.yml
|
14
42
|
email: pugh@s3kr.it
|
15
43
|
executables:
|