drunker 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +142 -0
- data/Gemfile +1 -1
- data/README.md +20 -5
- data/drunker.gemspec +2 -3
- data/lib/drunker.rb +1 -0
- data/lib/drunker/aggregator.rb +7 -3
- data/lib/drunker/aggregator/base.rb +1 -1
- data/lib/drunker/aggregator/pretty.rb +27 -0
- data/lib/drunker/artifact.rb +1 -1
- data/lib/drunker/cli.rb +1 -1
- data/lib/drunker/config.rb +3 -2
- data/lib/drunker/executor.rb +34 -23
- data/lib/drunker/executor/builder.rb +7 -3
- data/lib/drunker/executor/iam.rb +1 -1
- data/lib/drunker/source.rb +6 -6
- data/lib/drunker/version.rb +1 -1
- metadata +4 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52bccd6c28771917af0c742d9bb2f1d590338bb5
|
4
|
+
data.tar.gz: d8a9836770d2ce3a68628e747f3ae839363cd044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bcfd3438e029f4a985147d7c131f819f3e9215c511361bb38bc6b2f12c6724a610d33d6f60ac7b1a1f7537c244f809a966049b259695fcc41c1deeaf828b7c3
|
7
|
+
data.tar.gz: 81329e16744b8025c1a49d4d613c53ca3ccd0f757437b5085d7181eab94e3e4ab3180ea57766279547fb340147fe54982fb6ee328dfa6e5ae7ca96bae388917a
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
# To use the MeowCop gem.
|
2
|
+
inherit_gem:
|
3
|
+
meowcop:
|
4
|
+
- config/rubocop.yml
|
5
|
+
|
6
|
+
# Modify the version if you don't use MRI 2.1.
|
7
|
+
AllCops:
|
8
|
+
TargetRubyVersion: 2.4
|
9
|
+
|
10
|
+
Rails:
|
11
|
+
# If you use RuboCop with Ruby on Rails, turn on this option.
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
# You can customize rubocop settings.
|
15
|
+
Lint/ShadowingOuterLocalVariable:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Metrics/LineLength:
|
19
|
+
Exclude:
|
20
|
+
- "spec/**"
|
21
|
+
|
22
|
+
# EnforcedStyle: with_first_parameter => 0 offense
|
23
|
+
# EnforcedStyle: with_fixed_indentation => 15 offenses
|
24
|
+
Style/AlignParameters:
|
25
|
+
EnforcedStyle: with_first_parameter
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
# EnforcedStyle: nested => 0 offense
|
29
|
+
# EnforcedStyle: compact => 14 offenses
|
30
|
+
Style/ClassAndModuleChildren:
|
31
|
+
EnforcedStyle: nested
|
32
|
+
Enabled: true
|
33
|
+
|
34
|
+
# EnforcedStyle: leading => 0 offense
|
35
|
+
# EnforcedStyle: trailing => 28 offenses
|
36
|
+
Style/DotPosition:
|
37
|
+
EnforcedStyle: leading
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
# EnforcedStyle: empty_lines => 617 offenses
|
41
|
+
# EnforcedStyle: no_empty_lines => 1 offense
|
42
|
+
Style/EmptyLinesAroundBlockBody:
|
43
|
+
EnforcedStyle: no_empty_lines
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
# EnforcedStyle: empty_lines => 34 offenses
|
47
|
+
# EnforcedStyle: empty_lines_except_namespace => 26 offenses
|
48
|
+
# EnforcedStyle: empty_lines_special => 19 offenses
|
49
|
+
# EnforcedStyle: no_empty_lines => 0 offense
|
50
|
+
Style/EmptyLinesAroundClassBody:
|
51
|
+
EnforcedStyle: no_empty_lines
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
# EnforcedStyle: when_needed => 30 offenses
|
55
|
+
# EnforcedStyle: always => 30 offenses
|
56
|
+
# EnforcedStyle: never => 0 offense
|
57
|
+
Style/FrozenStringLiteralComment:
|
58
|
+
EnforcedStyle: never
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
# EnforcedStyle: ruby19 => 40 offenses
|
62
|
+
# EnforcedStyle: hash_rockets => 451 offenses
|
63
|
+
# EnforcedStyle: no_mixed_keys => 0 offense
|
64
|
+
# EnforcedStyle: ruby19_no_mixed_keys => 40 offenses
|
65
|
+
Style/HashSyntax:
|
66
|
+
EnforcedStyle: no_mixed_keys
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
# EnforcedStyle: require_parentheses => 0 offense
|
70
|
+
# EnforcedStyle: require_no_parentheses => 28 offenses
|
71
|
+
# EnforcedStyle: require_no_parentheses_except_multiline => 27 offenses
|
72
|
+
Style/MethodDefParentheses:
|
73
|
+
EnforcedStyle: require_parentheses
|
74
|
+
Enabled: true
|
75
|
+
|
76
|
+
# EnforcedStyle: snake_case => 0 offense
|
77
|
+
# EnforcedStyle: camelCase => 23 offenses
|
78
|
+
Style/MethodName:
|
79
|
+
EnforcedStyle: snake_case
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
# EnforcedStyle: symmetrical => 0 offense
|
83
|
+
# EnforcedStyle: new_line => 23 offenses
|
84
|
+
# EnforcedStyle: same_line => 12 offenses
|
85
|
+
Style/MultilineMethodCallBraceLayout:
|
86
|
+
EnforcedStyle: symmetrical
|
87
|
+
Enabled: true
|
88
|
+
|
89
|
+
# EnforcedStyle: aligned => 28 offenses
|
90
|
+
# EnforcedStyle: indented => 28 offenses
|
91
|
+
# EnforcedStyle: indented_relative_to_receiver => 6 offenses
|
92
|
+
Style/MultilineMethodCallIndentation:
|
93
|
+
EnforcedStyle: indented_relative_to_receiver
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
# EnforcedStyle: compact => 0 offense
|
97
|
+
# EnforcedStyle: exploded => 10 offenses
|
98
|
+
Style/RaiseArgs:
|
99
|
+
EnforcedStyle: compact
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
# EnforcedStyleInsidePipes: space => 33 offenses
|
103
|
+
# EnforcedStyleInsidePipes: no_space => 0 offense
|
104
|
+
Style/SpaceAroundBlockParameters:
|
105
|
+
EnforcedStyleInsidePipes: no_space
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
# EnforcedStyle: space => 1 offense
|
109
|
+
# EnforcedStyle: no_space => 152 offenses
|
110
|
+
Style/SpaceBeforeBlockBraces:
|
111
|
+
EnforcedStyle: space
|
112
|
+
Enabled: true
|
113
|
+
|
114
|
+
# EnforcedStyle: space => 134 offenses
|
115
|
+
# EnforcedStyle: no_space => 0 offense
|
116
|
+
Style/SpaceInsideStringInterpolation:
|
117
|
+
EnforcedStyle: no_space
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
# EnforcedStyle: single_quotes => 687 offenses
|
121
|
+
# EnforcedStyle: double_quotes => 3 offenses
|
122
|
+
Style/StringLiterals:
|
123
|
+
EnforcedStyle: double_quotes
|
124
|
+
Enabled: true
|
125
|
+
|
126
|
+
# EnforcedStyle: final_newline => 1 offense
|
127
|
+
# EnforcedStyle: final_blank_line => 30 offenses
|
128
|
+
Style/TrailingBlankLines:
|
129
|
+
EnforcedStyle: final_newline
|
130
|
+
Enabled: true
|
131
|
+
|
132
|
+
# EnforcedStyle: snake_case => 0 offense
|
133
|
+
# EnforcedStyle: camelCase => 46 offenses
|
134
|
+
Style/VariableName:
|
135
|
+
EnforcedStyle: snake_case
|
136
|
+
Enabled: true
|
137
|
+
|
138
|
+
# EnforcedStyle: percent => 0 offense
|
139
|
+
# EnforcedStyle: brackets => 47 offenses
|
140
|
+
Style/WordArray:
|
141
|
+
EnforcedStyle: percent
|
142
|
+
Enabled: true
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# Drunker
|
2
|
+
[![Build Status](https://travis-ci.org/wata727/drunker.svg?branch=master)](https://travis-ci.org/wata727/drunker)
|
3
|
+
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE.txt)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/drunker.svg)](https://badge.fury.io/rb/drunker)
|
2
5
|
|
3
6
|
Distributed CLI runner on [AWS CodeBuild](https://aws.amazon.com/codebuild/). This is a wrapper for handling CodeBuild container more easily.
|
4
7
|
|
@@ -93,6 +96,17 @@ EXIT_STATUS: 0
|
|
93
96
|
|
94
97
|
What is surprising is that do not require your local machine specs at all even if you increase the number of parallels. You can increase the number of parallels within the bounds of common sense.
|
95
98
|
|
99
|
+
### Limitation
|
100
|
+
The number of parallelism of CodeBuild is determined by default. If the limit is reached, Drunker queues remaining builders.
|
101
|
+
|
102
|
+
```
|
103
|
+
INFO: Maximum number of concurrent running builds has been reached. it will retry later...
|
104
|
+
INFO: Waiting builder: 1/25, queues: 4
|
105
|
+
...
|
106
|
+
```
|
107
|
+
|
108
|
+
For details about limitation, please see [here](http://docs.aws.amazon.com/codebuild/latest/userguide/limits.html).
|
109
|
+
|
96
110
|
### EC2 Container Registry
|
97
111
|
|
98
112
|
Do you want to use private images? You can also specify the image of [EC2 Container Registry](https://aws.amazon.com/ecr/). Following example:
|
@@ -126,7 +140,6 @@ Options:
|
|
126
140
|
[--file-pattern=FILE_PATTERN] # FILES target file pattern, can use glob to specify, but files beginning with a dot are ignored.
|
127
141
|
# Default: **/*
|
128
142
|
[--aggregator=AGGREGATOR] # Aggregator name. If you want to use custom aggregator, please install that beforehand.
|
129
|
-
# Default: pretty
|
130
143
|
[--loglevel=LOGLEVEL] # Output log level
|
131
144
|
# Default: info
|
132
145
|
# Possible values: debug, info, warn, error, fatal
|
@@ -254,16 +267,18 @@ buildspec:
|
|
254
267
|
|
255
268
|
## Customize Output
|
256
269
|
|
257
|
-
Do you want to customize the output format? You can customize output format, exit code by creating Gem called aggregator.
|
258
|
-
|
259
|
-
The specifications that the aggregator must satisfy are the following three.
|
270
|
+
Do you want to customize the output format? You can customize output format, exit code by creating Gem called aggregator. The specifications that the aggregator must satisfy are the following five.
|
260
271
|
|
261
|
-
-
|
272
|
+
- The name of Gem must be `drunker-aggregator-#{name}`.
|
273
|
+
- Create `lib/drunker-aggregator-#{name}.rb`, and require `Drunker::Aggregator::#{name}` class
|
274
|
+
- `Drunker::Aggregator::#{name}` must inherit `Drunker::Aggregator::Base`
|
262
275
|
- Implement `run` and `exit_status` methods to receive array of `Drunker::Artifact::Layer`
|
263
276
|
- Return a number in `exit_status` method
|
264
277
|
|
265
278
|
`Drunker::Artifact::Layer` has outputs and build ID for each build. Please see the [implementation](https://github.com/wata727/drunker/blob/master/lib/drunker/artifact/layer.rb) for details.
|
266
279
|
|
280
|
+
For example, [this aggregator](https://github.com/wata727/drunker-aggregator-phpmd) can aggregate for PHPMD XML format report.
|
281
|
+
|
267
282
|
## Development
|
268
283
|
|
269
284
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/drunker.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "drunker/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "drunker"
|
@@ -29,5 +29,4 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_runtime_dependency "thor", "~> 0.19"
|
30
30
|
spec.add_runtime_dependency "rubyzip", "~> 1.2"
|
31
31
|
spec.add_runtime_dependency "aws-sdk", "~> 2"
|
32
|
-
spec.add_runtime_dependency "drunker-aggregator-pretty", "~> 0.1"
|
33
32
|
end
|
data/lib/drunker.rb
CHANGED
data/lib/drunker/aggregator.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
module Drunker
|
2
2
|
class Aggregator
|
3
3
|
def self.create(config)
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
if config.aggregator
|
5
|
+
require config.aggregator.name
|
6
|
+
klass = Object.const_get(config.aggregator.name.split("-").map(&:capitalize).join("::"))
|
7
|
+
klass.new
|
8
|
+
else
|
9
|
+
Pretty.new
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Drunker
|
2
|
+
class Aggregator
|
3
|
+
class Pretty < Base
|
4
|
+
def run(layers)
|
5
|
+
layers.each do |layer|
|
6
|
+
puts
|
7
|
+
puts "-------------------------------------------------------------------------------------------"
|
8
|
+
puts "BUILD_ID: #{layer.build_id}"
|
9
|
+
if layer.invalid?
|
10
|
+
puts "RESULT: FAILED"
|
11
|
+
else
|
12
|
+
puts "RESULT: SUCCESS"
|
13
|
+
puts "STDOUT: #{layer.stdout}"
|
14
|
+
puts "STDERR: #{layer.stderr}"
|
15
|
+
puts "EXIT_STATUS: #{layer.exit_status}"
|
16
|
+
end
|
17
|
+
puts "-------------------------------------------------------------------------------------------"
|
18
|
+
puts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def exit_status(layers)
|
23
|
+
layers.map { |layer| layer.invalid? ? 1 : layer.exit_status }.max
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/drunker/artifact.rb
CHANGED
@@ -6,7 +6,7 @@ module Drunker
|
|
6
6
|
attr_reader :exit_status
|
7
7
|
|
8
8
|
def initialize(config:, logger:)
|
9
|
-
timestamp = Time.now.to_i
|
9
|
+
timestamp = Time.now.to_i
|
10
10
|
s3 = Aws::S3::Resource.new(client: Aws::S3::Client.new(config.aws_client_options))
|
11
11
|
|
12
12
|
@bucket = s3.create_bucket(bucket: "drunker-artifact-store-#{timestamp}")
|
data/lib/drunker/cli.rb
CHANGED
@@ -8,7 +8,7 @@ module Drunker
|
|
8
8
|
method_option :env, :type => :hash, :default => {}, :desc => "Environment variables in containers"
|
9
9
|
method_option :buildspec, :type => :string, :desc => "Location of custom buildspec"
|
10
10
|
method_option :file_pattern, :type => :string, :default => "**/*", :desc => "FILES target file pattern, can use glob to specify, but files beginning with a dot are ignored."
|
11
|
-
method_option :aggregator, :type => :string, :
|
11
|
+
method_option :aggregator, :type => :string, :desc => "Aggregator name. If you want to use custom aggregator, please install that beforehand."
|
12
12
|
method_option :loglevel, :type => :string, :default => "info", :enum => %w(debug info warn error fatal), :desc => "Output log level"
|
13
13
|
method_option :debug, :type => :boolean, :default => false, :desc => "Enable debug mode. This mode does not delete the AWS resources created by Drunker"
|
14
14
|
method_option :access_key, :type => :string, :desc => "AWS access key token used by Drunker"
|
data/lib/drunker/config.rb
CHANGED
@@ -95,7 +95,8 @@ module Drunker
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def aggregator_gem!(name)
|
98
|
-
|
98
|
+
return unless name
|
99
|
+
gem = Gem::Specification.all.select { |gem| gem.name == "drunker-aggregator-#{name}" }.max_by(&:version)
|
99
100
|
raise InvalidConfigException.new("Invalid aggregator. `drunker-aggregator-#{name}` is already installed?") unless gem
|
100
101
|
gem
|
101
102
|
end
|
@@ -135,7 +136,7 @@ module Drunker
|
|
135
136
|
"Invalid timeout. It should be number (Not string). got: #{yaml["timeout"]}"
|
136
137
|
when yaml["buildspec"] && !(yaml["buildspec"].is_a?(String) || yaml["buildspec"].is_a?(Hash))
|
137
138
|
"Invalid buildspec. It should be string or hash. got: #{yaml["buildspec"]}"
|
138
|
-
when yaml["environment_variables"] && !yaml["environment_variables"]&.values
|
139
|
+
when yaml["environment_variables"] && !yaml["environment_variables"]&.values&.all? { |v| v.is_a?(String) || v.is_a?(Numeric) }
|
139
140
|
"Invalid environment variables. It should be flatten hash. got: #{yaml["environment_variables"]}"
|
140
141
|
when yaml["file_pattern"] && !yaml["file_pattern"].is_a?(String)
|
141
142
|
"Invalid file pattern. It should be string. got: #{yaml["file_pattern"]}"
|
data/lib/drunker/executor.rb
CHANGED
@@ -3,32 +3,28 @@ module Drunker
|
|
3
3
|
RETRY_LIMIT = 10
|
4
4
|
|
5
5
|
def initialize(source:, config:, logger:)
|
6
|
-
@project_name = "drunker-executor-#{Time.now.to_i
|
6
|
+
@project_name = "drunker-executor-#{Time.now.to_i}"
|
7
7
|
@source = source
|
8
8
|
logger.info("Creating artifact...")
|
9
9
|
@artifact = Drunker::Artifact.new(config: config, logger: logger)
|
10
10
|
@config = config
|
11
11
|
@client = Aws::CodeBuild::Client.new(config.aws_client_options)
|
12
|
-
@builders = []
|
13
12
|
@logger = logger
|
14
13
|
end
|
15
14
|
|
16
15
|
def run
|
17
16
|
setup_project do
|
18
|
-
|
17
|
+
builders = create_builders
|
19
18
|
|
20
19
|
loop do
|
21
|
-
builders
|
22
|
-
|
23
|
-
if builder.retriable?
|
24
|
-
build_id = builder.retry
|
25
|
-
artifact.replace_build(before: failed_id ,after: build_id)
|
26
|
-
end
|
27
|
-
end
|
20
|
+
start_builders builders
|
21
|
+
restart_failed_builders builders
|
28
22
|
|
29
|
-
|
30
|
-
finished.
|
31
|
-
|
23
|
+
ran, waiting = builders.partition(&:ran?)
|
24
|
+
running, finished = ran.partition(&:running?)
|
25
|
+
|
26
|
+
finished.select(&:failed?).each do |builder|
|
27
|
+
builder.errors.each do |error|
|
32
28
|
logger.warn("Build failed: #{failed.build_id}")
|
33
29
|
logger.warn("\tphase_type: #{error[:phase_type]}")
|
34
30
|
logger.warn("\tphase_status: #{error[:phase_status]}")
|
@@ -37,12 +33,14 @@ module Drunker
|
|
37
33
|
end
|
38
34
|
end
|
39
35
|
|
40
|
-
|
41
|
-
|
36
|
+
if waiting.count.zero? && running.count.zero?
|
37
|
+
logger.info("Build is completed!")
|
38
|
+
break
|
39
|
+
end
|
40
|
+
logger.info("Waiting builders: #{finished.count}/#{builders.count}, queues: #{waiting.count}")
|
42
41
|
sleep 5
|
43
42
|
builders.each(&:refresh)
|
44
43
|
end
|
45
|
-
logger.info("Build is completed!")
|
46
44
|
artifact.layers # load artifact layers from S3
|
47
45
|
end
|
48
46
|
|
@@ -56,7 +54,6 @@ module Drunker
|
|
56
54
|
attr_reader :artifact
|
57
55
|
attr_reader :config
|
58
56
|
attr_reader :client
|
59
|
-
attr_reader :builders
|
60
57
|
attr_reader :logger
|
61
58
|
|
62
59
|
def setup_project
|
@@ -104,19 +101,33 @@ module Drunker
|
|
104
101
|
end
|
105
102
|
end
|
106
103
|
|
107
|
-
def
|
108
|
-
builders = []
|
109
|
-
|
104
|
+
def create_builders
|
110
105
|
files_list = source.target_files.each_slice(source.target_files.count.quo(config.concurrency).ceil).to_a
|
111
106
|
logger.info("Start parallel build: { files: #{source.target_files.count}, concurrency: #{config.concurrency}, real_concurrency: #{files_list.count} }")
|
112
|
-
files_list.to_a.
|
107
|
+
files_list.to_a.each_with_object([]) do |files, builders|
|
113
108
|
builder = Builder.new(project_name: project_name, targets: files, artifact: artifact, config: config, logger: logger)
|
109
|
+
builders << builder
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def start_builders(builders)
|
114
|
+
builders.reject(&:ran?).each do |builder|
|
114
115
|
build_id = builder.run
|
115
116
|
artifact.set_build(build_id)
|
116
|
-
builders << builder
|
117
117
|
end
|
118
|
+
rescue Aws::CodeBuild::Errors::AccountLimitExceededException => exn
|
119
|
+
logger.info("Maximum number of concurrent running builds has been reached. it will retry later...")
|
120
|
+
logger.debug("Exception: #{exn.inspect}")
|
121
|
+
end
|
118
122
|
|
119
|
-
|
123
|
+
def restart_failed_builders(builders)
|
124
|
+
builders.select(&:access_denied?).each do |builder|
|
125
|
+
failed_id = builder.build_id
|
126
|
+
if builder.retriable?
|
127
|
+
build_id = builder.retry
|
128
|
+
artifact.replace_build(before: failed_id ,after: build_id)
|
129
|
+
end
|
130
|
+
end
|
120
131
|
end
|
121
132
|
end
|
122
133
|
end
|
@@ -51,16 +51,20 @@ module Drunker
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
def ran?
|
55
|
+
!!build_id
|
56
|
+
end
|
57
|
+
|
54
58
|
def running?
|
55
|
-
status == IN_PROGRESS
|
59
|
+
ran? && status == IN_PROGRESS
|
56
60
|
end
|
57
61
|
|
58
62
|
def failed?
|
59
|
-
status == FAILED
|
63
|
+
ran? && status == FAILED
|
60
64
|
end
|
61
65
|
|
62
66
|
def success?
|
63
|
-
status == SUCCEEDED
|
67
|
+
ran? && status == SUCCEEDED
|
64
68
|
end
|
65
69
|
|
66
70
|
def refresh
|
data/lib/drunker/executor/iam.rb
CHANGED
data/lib/drunker/source.rb
CHANGED
@@ -3,7 +3,7 @@ module Drunker
|
|
3
3
|
attr_reader :target_files
|
4
4
|
|
5
5
|
def initialize(target_dir, config:, logger:)
|
6
|
-
timestamp = Time.now.to_i
|
6
|
+
timestamp = Time.now.to_i
|
7
7
|
s3 = Aws::S3::Resource.new(client: Aws::S3::Client.new(config.aws_client_options))
|
8
8
|
|
9
9
|
@bucket = s3.create_bucket(bucket: "drunker-source-store-#{timestamp}")
|
@@ -45,16 +45,16 @@ module Drunker
|
|
45
45
|
attr_reader :logger
|
46
46
|
|
47
47
|
def archive(target_dir)
|
48
|
-
archive_path = Pathname.new("#{target_dir
|
48
|
+
archive_path = Pathname.new("#{target_dir}/#{name}")
|
49
49
|
|
50
50
|
Zip::File.open(archive_path.to_s, Zip::File::CREATE) do |zip|
|
51
|
-
Pathname.glob(target_dir
|
51
|
+
Pathname.glob(target_dir + "**/*", File::Constants::FNM_DOTMATCH).select(&:file?).each do |real_path|
|
52
52
|
archive_file = real_path.relative_path_from(target_dir)
|
53
53
|
zip.add(archive_file, real_path.to_s)
|
54
|
-
logger.debug("Archived: #{archive_file
|
54
|
+
logger.debug("Archived: #{archive_file}")
|
55
55
|
end
|
56
56
|
end
|
57
|
-
logger.debug("Archived source: #{archive_path
|
57
|
+
logger.debug("Archived source: #{archive_path}")
|
58
58
|
yield archive_path
|
59
59
|
archive_path.unlink
|
60
60
|
logger.debug("Deleted archive")
|
@@ -62,7 +62,7 @@ module Drunker
|
|
62
62
|
|
63
63
|
def set_target_files(target_dir)
|
64
64
|
logger.debug("Use file pattern: #{config.file_pattern}")
|
65
|
-
Pathname.glob(target_dir
|
65
|
+
Pathname.glob(target_dir + config.file_pattern).select(&:file?).each do |real_path|
|
66
66
|
file = real_path.relative_path_from(target_dir).to_s
|
67
67
|
@target_files << file
|
68
68
|
logger.debug("Set target: #{file}")
|
data/lib/drunker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drunker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuma Watanabe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: drunker-aggregator-pretty
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0.1'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0.1'
|
125
111
|
description: Distributed CLI runner on AWS CodeBuild
|
126
112
|
email:
|
127
113
|
- watassbass@gmail.com
|
@@ -132,6 +118,7 @@ extra_rdoc_files: []
|
|
132
118
|
files:
|
133
119
|
- ".gitignore"
|
134
120
|
- ".rspec"
|
121
|
+
- ".rubocop.yml"
|
135
122
|
- ".travis.yml"
|
136
123
|
- CODE_OF_CONDUCT.md
|
137
124
|
- Gemfile
|
@@ -145,6 +132,7 @@ files:
|
|
145
132
|
- lib/drunker.rb
|
146
133
|
- lib/drunker/aggregator.rb
|
147
134
|
- lib/drunker/aggregator/base.rb
|
135
|
+
- lib/drunker/aggregator/pretty.rb
|
148
136
|
- lib/drunker/artifact.rb
|
149
137
|
- lib/drunker/artifact/layer.rb
|
150
138
|
- lib/drunker/cli.rb
|