gitlabci-bundle-update-mr 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +11 -0
- data/.rubocop.yml +25 -0
- data/CHANGELOG.md +6 -1
- data/Gemfile +4 -0
- data/Gemfile.lock +43 -9
- data/README.md +3 -1
- data/exe/gitlabci-bundle-update-mr +13 -6
- data/gitlabci-bundle-update-mr.gemspec +9 -7
- data/lib/gitlabci/bundle/update/mr.rb +7 -7
- data/lib/gitlabci/bundle/update/mr/client.rb +60 -47
- data/lib/gitlabci/bundle/update/mr/version.rb +1 -1
- metadata +46 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74c00bc91c7d10b1e98b13306612d4ebfbaf85d9996ec7ba6afa9edf927d73d6
|
4
|
+
data.tar.gz: abf4225860bf01f5806d9f190edfc16196de3b36b15f76f05e641ed2da8b1370
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a59d9d7cd005e94d7415df45874cf3d5b6b8ed81fb29999802edeab8081690724279019f3fc16019d84c88d7e4e771edbc42c0d9e3c331be80f2979573c2c6dd
|
7
|
+
data.tar.gz: 12c2bd50c6c9c20311a2fbffa3d233ef3fc789d66670fd4c3807630f6785ccad95c248a18099d525fa08cdcdcf1def125c849d0719d43fc0b5bee3b01878b938
|
data/.gitlab-ci.yml
CHANGED
@@ -12,6 +12,7 @@ continuous_bundle_update:
|
|
12
12
|
CACHE_VERSION: "v2"
|
13
13
|
GIT_EMAIL: "gitlabci@example.com"
|
14
14
|
GIT_USER: "GitLab CI"
|
15
|
+
OPTIONS: "--merge-when-pipeline-succeeds"
|
15
16
|
|
16
17
|
before_script:
|
17
18
|
# Set timezone to Asia/Tokyo
|
@@ -71,6 +72,16 @@ test:trunk:
|
|
71
72
|
image: rubylang/ruby:trunk-nightly-bionic
|
72
73
|
allow_failure: true
|
73
74
|
|
75
|
+
rubocop:
|
76
|
+
<<: *default
|
77
|
+
|
78
|
+
stage: build
|
79
|
+
|
80
|
+
image: ruby
|
81
|
+
|
82
|
+
script:
|
83
|
+
- bundle exec rubocop -P
|
84
|
+
|
74
85
|
pages:
|
75
86
|
<<: *default
|
76
87
|
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require: rubocop-performance
|
2
|
+
|
3
|
+
inherit_gem:
|
4
|
+
onkcop:
|
5
|
+
- "config/rubocop.yml"
|
6
|
+
# uncomment if use rails cops
|
7
|
+
# - "config/rails.yml"
|
8
|
+
# uncomment if use rspec cops
|
9
|
+
# - "config/rspec.yml"
|
10
|
+
|
11
|
+
AllCops:
|
12
|
+
TargetRubyVersion: 2.3
|
13
|
+
|
14
|
+
Layout/AlignHash:
|
15
|
+
EnforcedHashRocketStyle: table
|
16
|
+
EnforcedColonStyle: table
|
17
|
+
|
18
|
+
Layout/IndentFirstArrayElement:
|
19
|
+
EnforcedStyle: consistent
|
20
|
+
|
21
|
+
Layout/IndentFirstHashElement:
|
22
|
+
EnforcedStyle: consistent
|
23
|
+
|
24
|
+
Metrics/MethodLength:
|
25
|
+
Max: 21
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## Unreleased
|
2
|
-
[full changelog](https://gitlab.com/sue445/gitlabci-bundle-update-mr/compare/v0.
|
2
|
+
[full changelog](https://gitlab.com/sue445/gitlabci-bundle-update-mr/compare/v0.3.0...master)
|
3
|
+
|
4
|
+
## v0.3.0
|
5
|
+
[full changelog](https://gitlab.com/sue445/gitlabci-bundle-update-mr/compare/v0.2.2...v0.3.0)
|
6
|
+
|
7
|
+
* Support "Merge when pipeline succeeds" [!41](https://gitlab.com/sue445/gitlabci-bundle-update-mr/merge_requests/41) *@sue445*
|
3
8
|
|
4
9
|
## v0.2.2
|
5
10
|
[full changelog](https://gitlab.com/sue445/gitlabci-bundle-update-mr/compare/v0.2.1...v0.2.2)
|
data/Gemfile
CHANGED
@@ -7,3 +7,7 @@ gemspec
|
|
7
7
|
gem "faraday", ">= 0.15.4"
|
8
8
|
gem "octokit", ">= 4.13.0"
|
9
9
|
gem "sawyer", ">= 0.8.1"
|
10
|
+
|
11
|
+
# TODO: Remove after https://github.com/onk/onkcop/pull/62 is merged
|
12
|
+
gem "onkcop", github: "sue445/onkcop", branch: "rubocop_0.68.0", ref: "6256494"
|
13
|
+
gem "rubocop", ">= 0.68.0"
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/sue445/onkcop.git
|
3
|
+
revision: 6256494c1f860f62df6a4d57c81a4c200beee53b
|
4
|
+
ref: 6256494
|
5
|
+
branch: rubocop_0.68.0
|
6
|
+
specs:
|
7
|
+
onkcop (0.53.0.3)
|
8
|
+
rubocop (>= 0.53.0)
|
9
|
+
rubocop-rspec (>= 1.24.0)
|
10
|
+
|
1
11
|
PATH
|
2
12
|
remote: .
|
3
13
|
specs:
|
4
|
-
gitlabci-bundle-update-mr (0.
|
14
|
+
gitlabci-bundle-update-mr (0.3.0)
|
5
15
|
bundler
|
6
16
|
compare_linker (>= 1.4.3)
|
7
17
|
gitlab (>= 4.0.0)
|
@@ -12,6 +22,7 @@ GEM
|
|
12
22
|
specs:
|
13
23
|
addressable (2.5.2)
|
14
24
|
public_suffix (>= 2.0.2, < 4.0)
|
25
|
+
ast (2.4.0)
|
15
26
|
byebug (11.0.1)
|
16
27
|
coderay (1.1.2)
|
17
28
|
compare_linker (1.4.3)
|
@@ -21,31 +32,35 @@ GEM
|
|
21
32
|
safe_yaml (~> 1.0.0)
|
22
33
|
diff-lcs (1.3)
|
23
34
|
docile (1.3.1)
|
24
|
-
dotenv (2.7.
|
35
|
+
dotenv (2.7.2)
|
25
36
|
faraday (0.15.4)
|
26
37
|
multipart-post (>= 1.2, < 3)
|
27
38
|
git (1.5.0)
|
28
|
-
gitlab (4.
|
39
|
+
gitlab (4.11.0)
|
29
40
|
httparty (~> 0.14, >= 0.14.0)
|
30
41
|
terminal-table (~> 1.5, >= 1.5.1)
|
31
42
|
gitlab_awesome_release (1.0.2)
|
32
43
|
dotenv
|
33
44
|
gitlab (>= 4.0.0)
|
34
45
|
thor
|
35
|
-
hashdiff (0.3.
|
36
|
-
httparty (0.
|
46
|
+
hashdiff (0.3.9)
|
47
|
+
httparty (0.17.0)
|
37
48
|
mime-types (~> 3.0)
|
38
49
|
multi_xml (>= 0.5.2)
|
39
50
|
httpclient (2.8.3)
|
51
|
+
jaro_winkler (1.5.2)
|
40
52
|
json (2.2.0)
|
41
53
|
method_source (0.9.2)
|
42
54
|
mime-types (3.2.2)
|
43
55
|
mime-types-data (~> 3.2015)
|
44
|
-
mime-types-data (3.
|
56
|
+
mime-types-data (3.2019.0331)
|
45
57
|
multi_xml (0.6.0)
|
46
58
|
multipart-post (2.0.0)
|
47
|
-
octokit (4.
|
59
|
+
octokit (4.14.0)
|
48
60
|
sawyer (~> 0.8.0, >= 0.5.3)
|
61
|
+
parallel (1.17.0)
|
62
|
+
parser (2.6.3.0)
|
63
|
+
ast (~> 2.4.0)
|
49
64
|
pry (0.12.2)
|
50
65
|
coderay (~> 1.1.0)
|
51
66
|
method_source (~> 0.9.0)
|
@@ -53,6 +68,7 @@ GEM
|
|
53
68
|
byebug (~> 11.0)
|
54
69
|
pry (~> 0.10)
|
55
70
|
public_suffix (3.0.3)
|
71
|
+
rainbow (3.0.0)
|
56
72
|
rake (10.5.0)
|
57
73
|
restore_bundled_with (1.0.0)
|
58
74
|
git
|
@@ -63,7 +79,7 @@ GEM
|
|
63
79
|
rspec-mocks (~> 3.8.0)
|
64
80
|
rspec-core (3.8.0)
|
65
81
|
rspec-support (~> 3.8.0)
|
66
|
-
rspec-expectations (3.8.
|
82
|
+
rspec-expectations (3.8.3)
|
67
83
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
84
|
rspec-support (~> 3.8.0)
|
69
85
|
rspec-mocks (3.8.0)
|
@@ -72,6 +88,20 @@ GEM
|
|
72
88
|
rspec-support (3.8.0)
|
73
89
|
rspec-temp_dir (1.1.0)
|
74
90
|
rspec (>= 3.0)
|
91
|
+
rubocop (0.68.1)
|
92
|
+
jaro_winkler (~> 1.5.1)
|
93
|
+
parallel (~> 1.10)
|
94
|
+
parser (>= 2.5, != 2.5.1.1)
|
95
|
+
rainbow (>= 2.2.2, < 4.0)
|
96
|
+
ruby-progressbar (~> 1.7)
|
97
|
+
unicode-display_width (>= 1.4.0, < 1.6)
|
98
|
+
rubocop-performance (1.1.0)
|
99
|
+
rubocop (>= 0.67.0)
|
100
|
+
rubocop-rspec (1.32.0)
|
101
|
+
rubocop (>= 0.60.0)
|
102
|
+
rubocop_auto_corrector (0.1.0)
|
103
|
+
rubocop (>= 0.49.0)
|
104
|
+
ruby-progressbar (1.10.0)
|
75
105
|
safe_yaml (1.0.5)
|
76
106
|
sawyer (0.8.1)
|
77
107
|
addressable (>= 2.3.5, < 2.6)
|
@@ -89,7 +119,7 @@ GEM
|
|
89
119
|
addressable (>= 2.3.6)
|
90
120
|
crack (>= 0.3.2)
|
91
121
|
hashdiff
|
92
|
-
yard (0.9.
|
122
|
+
yard (0.9.19)
|
93
123
|
|
94
124
|
PLATFORMS
|
95
125
|
ruby
|
@@ -100,10 +130,14 @@ DEPENDENCIES
|
|
100
130
|
gitlab_awesome_release
|
101
131
|
gitlabci-bundle-update-mr!
|
102
132
|
octokit (>= 4.13.0)
|
133
|
+
onkcop!
|
103
134
|
pry-byebug
|
104
135
|
rake (~> 10.0)
|
105
136
|
rspec (~> 3.0)
|
106
137
|
rspec-temp_dir
|
138
|
+
rubocop (>= 0.68.0)
|
139
|
+
rubocop-performance
|
140
|
+
rubocop_auto_corrector
|
107
141
|
sawyer (>= 0.8.1)
|
108
142
|
simplecov
|
109
143
|
webmock
|
data/README.md
CHANGED
@@ -80,7 +80,7 @@ continuous_bundle_update:
|
|
80
80
|
|
81
81
|
* GitLab Core 11.4+
|
82
82
|
* GitLab Premium 10.5+
|
83
|
-
* Starter, Premium and Ultimate 10.6+
|
83
|
+
* Starter, Premium and Ultimate 10.6+
|
84
84
|
|
85
85
|
c.f. https://docs.gitlab.com/ce/ci/yaml/README.html#include
|
86
86
|
|
@@ -120,6 +120,8 @@ Usage: gitlabci-bundle-update-mr [options]
|
|
120
120
|
-d, --duplicate Make MR even if it has already existed (default. false)
|
121
121
|
-l, --labels 'In Review, Update' Add labels to the MR
|
122
122
|
--update-bundled-with Whether to update `BUNDLED WITH` section in Gemfie.lock (default. false)
|
123
|
+
--merge-when-pipeline-succeeds
|
124
|
+
Whether to set 'Merge when pipeline succeeds' (default. false)
|
123
125
|
```
|
124
126
|
|
125
127
|
## Development
|
@@ -10,12 +10,14 @@ author_name = `git config user.name`.strip
|
|
10
10
|
allow_dup_mr = false
|
11
11
|
mr_labels = []
|
12
12
|
update_bundled_with = false
|
13
|
+
merge_when_pipeline_succeeds = false
|
13
14
|
|
14
|
-
opt.on("--email EMAIL", "git email address (default. `git config user.email`)") {
|
15
|
-
opt.on("--user USER", "git username (default. `git config user.name`)") {
|
16
|
-
opt.on("-d", "--duplicate", "Make MR even if it has already existed (default. false)") {
|
17
|
-
opt.on("-l", "--labels 'In Review, Update'", Array, "Add labels to the MR") {
|
18
|
-
opt.on("--update-bundled-with", "Whether to update `BUNDLED WITH` section in Gemfie.lock (default. false)") {
|
15
|
+
opt.on("--email EMAIL", "git email address (default. `git config user.email`)") {|v| author_email = v }
|
16
|
+
opt.on("--user USER", "git username (default. `git config user.name`)") {|v| author_name = v }
|
17
|
+
opt.on("-d", "--duplicate", "Make MR even if it has already existed (default. false)") {|v| allow_dup_mr = v }
|
18
|
+
opt.on("-l", "--labels 'In Review, Update'", Array, "Add labels to the MR") {|v| mr_labels = v.map(&:strip) }
|
19
|
+
opt.on("--update-bundled-with", "Whether to update `BUNDLED WITH` section in Gemfie.lock (default. false)") {|v| update_bundled_with = v }
|
20
|
+
opt.on("--merge-when-pipeline-succeeds", "Whether to set 'Merge when pipeline succeeds' (default. false)") {|v| merge_when_pipeline_succeeds = v }
|
19
21
|
|
20
22
|
opt.parse!(ARGV)
|
21
23
|
|
@@ -30,4 +32,9 @@ client = Gitlabci::Bundle::Update::Mr::Client.new(
|
|
30
32
|
author_name: author_name,
|
31
33
|
)
|
32
34
|
|
33
|
-
client.perform(
|
35
|
+
client.perform(
|
36
|
+
allow_dup_mr: allow_dup_mr,
|
37
|
+
mr_labels: mr_labels,
|
38
|
+
update_bundled_with: update_bundled_with,
|
39
|
+
merge_when_pipeline_succeeds: merge_when_pipeline_succeeds,
|
40
|
+
)
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "gitlabci/bundle/update/mr/version"
|
5
4
|
|
@@ -9,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
9
8
|
spec.authors = ["sue445"]
|
10
9
|
spec.email = ["sue445@sue445.net"]
|
11
10
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
11
|
+
spec.summary = "Create MergeRequest of bundle update in GitLab CI"
|
12
|
+
spec.description = "Create MergeRequest of bundle update in GitLab CI"
|
14
13
|
spec.homepage = "https://gitlab.com/sue445/gitlabci-bundle-update-mr"
|
15
14
|
spec.license = "MIT"
|
16
15
|
|
@@ -27,12 +26,12 @@ Gem::Specification.new do |spec|
|
|
27
26
|
|
28
27
|
# Specify which files should be added to the gem when it is released.
|
29
28
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
30
|
-
spec.files
|
31
|
-
`git ls-files -z`.split("\x0").reject {
|
29
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
30
|
+
`git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features|img)/}) }
|
32
31
|
end
|
33
32
|
|
34
33
|
spec.bindir = "exe"
|
35
|
-
spec.executables = spec.files.grep(%r{^exe/}) {
|
34
|
+
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
36
35
|
spec.require_paths = ["lib"]
|
37
36
|
|
38
37
|
spec.required_ruby_version = ">= 2.3.0"
|
@@ -44,10 +43,13 @@ Gem::Specification.new do |spec|
|
|
44
43
|
|
45
44
|
spec.add_development_dependency "dotenv"
|
46
45
|
spec.add_development_dependency "gitlab_awesome_release"
|
46
|
+
spec.add_development_dependency "onkcop"
|
47
47
|
spec.add_development_dependency "pry-byebug"
|
48
48
|
spec.add_development_dependency "rake", "~> 10.0"
|
49
49
|
spec.add_development_dependency "rspec", "~> 3.0"
|
50
50
|
spec.add_development_dependency "rspec-temp_dir"
|
51
|
+
spec.add_development_dependency "rubocop-performance"
|
52
|
+
spec.add_development_dependency "rubocop_auto_corrector"
|
51
53
|
spec.add_development_dependency "simplecov"
|
52
54
|
spec.add_development_dependency "webmock"
|
53
55
|
spec.add_development_dependency "yard"
|
@@ -15,13 +15,13 @@ module Gitlabci
|
|
15
15
|
class MissingKeyError < Error; end
|
16
16
|
|
17
17
|
def self.assert_env_keys
|
18
|
-
%w
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
%w[
|
19
|
+
OCTOKIT_ACCESS_TOKEN
|
20
|
+
GITLAB_API_ENDPOINT
|
21
|
+
GITLAB_API_PRIVATE_TOKEN
|
22
|
+
CI_PROJECT_PATH
|
23
|
+
CI_COMMIT_REF_NAME
|
24
|
+
].each do |key|
|
25
25
|
assert_env_key(key)
|
26
26
|
end
|
27
27
|
end
|
@@ -2,9 +2,11 @@ module Gitlabci
|
|
2
2
|
module Bundle
|
3
3
|
module Update
|
4
4
|
module Mr
|
5
|
-
class Client
|
6
|
-
BRANCH_PREFIX = "bundle-update-"
|
7
|
-
TITLE_PREFIX = "bundle update at "
|
5
|
+
class Client # rubocop:disable Metrics/ClassLength
|
6
|
+
BRANCH_PREFIX = "bundle-update-".freeze
|
7
|
+
TITLE_PREFIX = "bundle update at ".freeze
|
8
|
+
|
9
|
+
# rubocop:disable Metrics/ParameterLists
|
8
10
|
|
9
11
|
# @param gitlab_api_endpoint [String]
|
10
12
|
# @param gitlab_api_private_token [String]
|
@@ -20,11 +22,13 @@ module Gitlabci
|
|
20
22
|
@author_email = author_email
|
21
23
|
@author_name = author_name
|
22
24
|
end
|
25
|
+
# rubocop:enable Metrics/ParameterLists
|
23
26
|
|
24
27
|
# @param allow_dup_mr [Boolean]
|
25
28
|
# @param mr_labels [Array<String>]
|
26
29
|
# @param update_bundled_with [Boolean]
|
27
|
-
|
30
|
+
# @param merge_when_pipeline_succeeds [Boolean]
|
31
|
+
def perform(allow_dup_mr:, mr_labels:, update_bundled_with:, merge_when_pipeline_succeeds:)
|
28
32
|
if !allow_dup_mr && exists_bundle_update_mr?
|
29
33
|
puts "Skip because it has already existed."
|
30
34
|
return
|
@@ -49,6 +53,11 @@ module Gitlabci
|
|
49
53
|
|
50
54
|
mr = create_merge_request(description: description, mr_labels: mr_labels)
|
51
55
|
puts "MR is created: #{mr.web_url}"
|
56
|
+
|
57
|
+
if merge_when_pipeline_succeeds
|
58
|
+
accept_merge_request(mr.iid)
|
59
|
+
puts "Set merge_when_pipeline_succeeds to #{mr.web_url}"
|
60
|
+
end
|
52
61
|
end
|
53
62
|
|
54
63
|
# @param lockfile [String]
|
@@ -59,14 +68,14 @@ module Gitlabci
|
|
59
68
|
"$ bundle update && bundle update --ruby",
|
60
69
|
[
|
61
70
|
{
|
62
|
-
action:
|
71
|
+
action: "update",
|
63
72
|
file_path: lockfile_name,
|
64
|
-
content:
|
65
|
-
}
|
73
|
+
content: lockfile,
|
74
|
+
},
|
66
75
|
],
|
67
76
|
start_branch: @branch,
|
68
77
|
author_email: @author_email,
|
69
|
-
author_name:
|
78
|
+
author_name: @author_name,
|
70
79
|
)
|
71
80
|
end
|
72
81
|
|
@@ -74,10 +83,10 @@ module Gitlabci
|
|
74
83
|
# @param mr_labels [Array<String>]
|
75
84
|
def create_merge_request(description:, mr_labels:)
|
76
85
|
params = {
|
77
|
-
source_branch:
|
78
|
-
target_branch:
|
86
|
+
source_branch: new_branch,
|
87
|
+
target_branch: @branch,
|
79
88
|
remove_source_branch: true,
|
80
|
-
description:
|
89
|
+
description: description,
|
81
90
|
}
|
82
91
|
|
83
92
|
unless mr_labels.empty?
|
@@ -99,8 +108,8 @@ module Gitlabci
|
|
99
108
|
compare_linker = CompareLinker.new("dummy", "dummy")
|
100
109
|
compare_linker.formatter = CompareLinker::Formatter::Markdown.new
|
101
110
|
compare_links = compare_linker.
|
102
|
-
|
103
|
-
|
111
|
+
make_compare_links_from_lockfiles(Bundler::LockfileParser.new(old_lockfile), Bundler::LockfileParser.new(new_lockfile)).
|
112
|
+
to_a.join("\n")
|
104
113
|
|
105
114
|
<<~MARKDOWN
|
106
115
|
**Updated RubyGems:**
|
@@ -113,50 +122,54 @@ module Gitlabci
|
|
113
122
|
|
114
123
|
private
|
115
124
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
125
|
+
def system!(command)
|
126
|
+
# NOTE: system(exception: true) requires Ruby 2.6+
|
127
|
+
ret = system(command)
|
128
|
+
raise "`#{command}` is failed" unless ret
|
129
|
+
end
|
121
130
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
+
def restore_bundled_with
|
132
|
+
RestoreBundledWith::CLI.new.invoke(
|
133
|
+
:restore,
|
134
|
+
[],
|
135
|
+
{
|
136
|
+
lockfile: lockfile_name,
|
137
|
+
},
|
138
|
+
)
|
139
|
+
end
|
140
|
+
|
141
|
+
def gemfile_name
|
142
|
+
return @gemfile_name if @gemfile_name
|
131
143
|
|
132
|
-
|
133
|
-
return @gemfile_name if @gemfile_name
|
144
|
+
@gemfile_name = ENV["BUNDLE_GEMFILE"] || "Gemfile"
|
134
145
|
|
135
|
-
|
146
|
+
if @gemfile_name.start_with?("#{Dir.pwd}/")
|
147
|
+
@gemfile_name = @gemfile_name.gsub("#{Dir.pwd}/", "")
|
148
|
+
end
|
136
149
|
|
137
|
-
|
138
|
-
@gemfile_name = @gemfile_name.gsub("#{Dir.pwd}/", "")
|
150
|
+
@gemfile_name
|
139
151
|
end
|
140
152
|
|
141
|
-
|
142
|
-
|
153
|
+
def lockfile_name
|
154
|
+
"#{gemfile_name}.lock"
|
155
|
+
end
|
143
156
|
|
144
|
-
|
145
|
-
|
146
|
-
|
157
|
+
def current_time
|
158
|
+
@current_time ||= Time.now
|
159
|
+
end
|
147
160
|
|
148
|
-
|
149
|
-
|
150
|
-
|
161
|
+
def new_branch
|
162
|
+
"#{BRANCH_PREFIX}#{current_time.strftime("%Y%m%d%H%M%S")}"
|
163
|
+
end
|
151
164
|
|
152
|
-
|
153
|
-
|
154
|
-
|
165
|
+
def exists_bundle_update_mr?
|
166
|
+
merge_requests = @gitlab.merge_requests(@project_name, state: "opened", target_branch: @branch, search: TITLE_PREFIX.strip)
|
167
|
+
merge_requests.any? {|mr| mr.title.start_with?(TITLE_PREFIX) && mr.source_branch.start_with?(BRANCH_PREFIX) }
|
168
|
+
end
|
155
169
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
end
|
170
|
+
def accept_merge_request(mr_id)
|
171
|
+
@gitlab.accept_merge_request(@project_name, mr_id, merge_when_pipeline_succeeds: true, should_remove_source_branch: true)
|
172
|
+
end
|
160
173
|
end
|
161
174
|
end
|
162
175
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlabci-bundle-update-mr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: onkcop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: pry-byebug
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +164,34 @@ dependencies:
|
|
150
164
|
- - ">="
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rubocop-performance
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rubocop_auto_corrector
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
153
195
|
- !ruby/object:Gem::Dependency
|
154
196
|
name: simplecov
|
155
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,6 +247,7 @@ files:
|
|
205
247
|
- ".gitignore"
|
206
248
|
- ".gitlab-ci.yml"
|
207
249
|
- ".rspec"
|
250
|
+
- ".rubocop.yml"
|
208
251
|
- ".yardopts"
|
209
252
|
- CHANGELOG.md
|
210
253
|
- Gemfile
|
@@ -242,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
285
|
- !ruby/object:Gem::Version
|
243
286
|
version: '0'
|
244
287
|
requirements: []
|
245
|
-
rubygems_version: 3.0.
|
288
|
+
rubygems_version: 3.0.3
|
246
289
|
signing_key:
|
247
290
|
specification_version: 4
|
248
291
|
summary: Create MergeRequest of bundle update in GitLab CI
|