miniexec 0.2.1 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/miniexec +8 -2
  3. data/lib/miniexec.rb +10 -8
  4. metadata +31 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 550158d86f5f2784056c277e222f8b446df695deccd78dfa6e585ec4ff755852
4
- data.tar.gz: e6b1ca3987365aabf54d3f126b153a0b527e1b5b2075395b57ecb3c240a046ca
3
+ metadata.gz: 10dfada2318171d17308c16909b8fc7136e7b887146365c62a8e4f37393f7016
4
+ data.tar.gz: da4883125bc5636508e0385c2ef3014d9135322b6686fcbb6ebf4ab30cf770ee
5
5
  SHA512:
6
- metadata.gz: c3483cdf517a9fec48c1c0146ead79f323986892420cc5a5d7bf918f8ff2f02ff7734ed324bf75df81b8b10e7258376b8ba185d6de3914f4aeccb550553832f7
7
- data.tar.gz: 19b604234de06aa7276e15fa73ea00c2f6f4419ee3f6414b2c2768d5c1cae61bcc91b51370f639a48ab5cdc195a6c93dbf2efa01c0731ff8e99ff83a9f91a7d0
6
+ metadata.gz: ed47b1c7192e5f692c98cb0b6a5169bdbafb837a10ef445df0916a89da10bf20e5de0926526c9bf2c1997226e09af01ba0c37205c8d2a060aa2691ac79b6b62c
7
+ data.tar.gz: e954e5f47fdb36cb506ee3a90808cee892a24a41aaca8e3bd5b20539b764c609df49bf6b5eb03263f65688c735f8b8a8e3cc89020a436a7416bcc31ce9f7f737
data/bin/miniexec CHANGED
@@ -11,7 +11,8 @@ options = {
11
11
  env: {},
12
12
  path: '.',
13
13
  docker: ENV['DOCKER_HOST'] || '/run/docker.sock',
14
- cwd: true
14
+ cwd: true,
15
+ file: nil
15
16
  }
16
17
 
17
18
  OptionParser.new do |opts|
@@ -41,6 +42,10 @@ OptionParser.new do |opts|
41
42
  'Location of the docker socket') do |sock|
42
43
  options[:docker] = sock
43
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
44
49
  opts.on('-n', '--no-mount-cwd',
45
50
  'Don\'t mount the CWD in the container\'s WORKDIR by default.') do
46
51
  options[:cwd] = false
@@ -54,5 +59,6 @@ exec = MiniExec::MiniExec.new options[:job],
54
59
  docker_url: options[:docker],
55
60
  binds: options[:binds],
56
61
  env: options[:env],
57
- mount_cwd: options[:cwd] || false
62
+ mount_cwd: options[:cwd] || false,
63
+ file: options[:file]
58
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
- @workflow = YAML.load(File.read("#{@project_path}/#{MiniExec.workflow_file}"))
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
@@ -100,8 +102,8 @@ 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
+ return Util.expand_var(image, @env) if image
106
+ @default_image
105
107
  end
106
108
 
107
109
  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.1
4
+ version: 0.2.6
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-05-17 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-10-21 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: