gitlab-triage 1.3.0 → 1.4.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 +72 -49
- data/Gemfile +2 -2
- data/README.md +25 -1
- data/gitlab-triage.gemspec +5 -5
- data/lib/gitlab/triage/command_builders/text_content_builder.rb +3 -1
- data/lib/gitlab/triage/engine.rb +2 -0
- data/lib/gitlab/triage/expand_condition/list.rb +1 -1
- data/lib/gitlab/triage/expand_condition/sequence.rb +1 -1
- data/lib/gitlab/triage/option_parser.rb +3 -4
- data/lib/gitlab/triage/resource/context.rb +1 -1
- data/lib/gitlab/triage/retryable.rb +1 -1
- data/lib/gitlab/triage/version.rb +1 -1
- metadata +10 -11
- data/.gitlab/issue_templates/Policy.md +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f5db61219a126e4c43c284780d0d656c0ab1e28cd5bdda69e8f094f50364b81
|
4
|
+
data.tar.gz: abb1f46dd7ef999685e083b131a80fceceb923b033d8bbe396a1a3b2aa0ab2de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e5d9d0606b3d094b5284e2e67edd75eeec5604521ad54c5a7fea7de2a3c6a1a299b9ce28d11322e78eb72893ddd946b53a3fc134c4a0dd3095f747a642a19a7
|
7
|
+
data.tar.gz: 7f33b9a36ce2f8353782c0194c35dc17d414f27083c5c10e0b98c90742959cf4d71b105433f14d27f7db16bafb0af6b62015e2d684c0e76ed6619b441679cc76
|
data/.gitlab-ci.yml
CHANGED
@@ -1,82 +1,109 @@
|
|
1
|
-
image: ruby:2.
|
1
|
+
image: ruby:2.6
|
2
2
|
|
3
3
|
stages:
|
4
4
|
- prepare
|
5
5
|
- test
|
6
6
|
- triage
|
7
7
|
|
8
|
-
.default-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
.default-only:
|
9
|
+
only:
|
10
|
+
refs:
|
11
|
+
- master
|
12
|
+
- merge_requests
|
13
|
+
- tags
|
13
14
|
|
14
|
-
.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
before_script:
|
20
|
-
- gem install bundler
|
21
|
-
- bundle --version
|
22
|
-
- bundle update --jobs $(nproc) --retry 3 --quiet
|
15
|
+
.default-before_script:
|
16
|
+
before_script:
|
17
|
+
- gem install bundler --no-document
|
18
|
+
- bundle install --jobs $(nproc) --retry 3 --quiet
|
23
19
|
|
24
20
|
###################
|
25
21
|
## Prepare stage ##
|
26
22
|
###################
|
27
23
|
setup-test-env:
|
24
|
+
extends: .default-only
|
28
25
|
stage: prepare
|
29
26
|
script:
|
30
|
-
-
|
27
|
+
- ruby --version
|
28
|
+
- gem install bundler --no-document
|
29
|
+
- bundle --version
|
30
|
+
- bundle install --clean --jobs $(nproc) --path=vendor --retry=3 --quiet
|
31
|
+
- bundle check
|
31
32
|
cache:
|
32
|
-
|
33
|
+
key: "$CI_JOB_NAME-ruby-2.6"
|
34
|
+
paths:
|
35
|
+
- vendor/ruby
|
36
|
+
- Gemfile.lock
|
33
37
|
artifacts:
|
34
38
|
paths:
|
35
|
-
- vendor/
|
39
|
+
- vendor/ruby
|
36
40
|
- Gemfile.lock
|
37
41
|
|
38
42
|
################
|
39
43
|
## Test stage ##
|
40
44
|
################
|
41
|
-
|
42
|
-
|
43
|
-
stage: test
|
44
|
-
script:
|
45
|
-
- bundle exec rubocop
|
46
|
-
|
47
|
-
specs:
|
48
|
-
<<: *pull-cache
|
45
|
+
rubocop:
|
46
|
+
extends: [".default-only", ".default-before_script"]
|
49
47
|
stage: test
|
48
|
+
needs: ["setup-test-env"]
|
49
|
+
dependencies: ["setup-test-env"]
|
50
50
|
script:
|
51
|
-
- bundle exec
|
51
|
+
- bundle exec rubocop --parallel
|
52
|
+
cache:
|
53
|
+
key: "$CI_JOB_NAME"
|
54
|
+
paths:
|
55
|
+
- .cache/rubocop_cache/
|
52
56
|
|
53
|
-
|
54
|
-
|
55
|
-
|
57
|
+
# We need to copy this job's definition from the Code-Quality.gitlab-ci.yml
|
58
|
+
# template because `only` is set without `refs`, so it takes precedence over `.default-only`.
|
59
|
+
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/66767.
|
60
|
+
code_quality:
|
61
|
+
extends: .default-only
|
62
|
+
needs: ["setup-test-env"]
|
63
|
+
dependencies: ["setup-test-env"]
|
56
64
|
stage: test
|
57
|
-
|
58
|
-
|
65
|
+
image: docker:stable
|
66
|
+
allow_failure: true
|
59
67
|
services:
|
60
|
-
- docker:dind
|
61
|
-
|
68
|
+
- docker:stable-dind
|
69
|
+
variables:
|
70
|
+
DOCKER_DRIVER: overlay2
|
71
|
+
DOCKER_TLS_CERTDIR: ""
|
62
72
|
script:
|
73
|
+
- |
|
74
|
+
if ! docker info &>/dev/null; then
|
75
|
+
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
|
76
|
+
export DOCKER_HOST='tcp://localhost:2375'
|
77
|
+
fi
|
78
|
+
fi
|
63
79
|
- docker run
|
64
|
-
--env
|
80
|
+
--env SOURCE_CODE="$PWD"
|
65
81
|
--volume "$PWD":/code
|
66
82
|
--volume /var/run/docker.sock:/var/run/docker.sock
|
67
|
-
|
68
|
-
dev.gitlab.org:5005/gitlab/gitlab-build-images:gitlab-codeclimate
|
69
|
-
analyze -f json > raw_codeclimate.json
|
70
|
-
- cat raw_codeclimate.json | docker run -i stedolan/jq -c 'map({check_name,fingerprint,location})' > codeclimate.json
|
83
|
+
"registry.gitlab.com/gitlab-org/security-products/codequality:12-0-stable" /code
|
71
84
|
artifacts:
|
72
|
-
|
73
|
-
-
|
85
|
+
reports:
|
86
|
+
codequality: gl-code-quality-report.json
|
87
|
+
expire_in: 1 week
|
88
|
+
except:
|
89
|
+
variables:
|
90
|
+
- $CODE_QUALITY_DISABLED
|
91
|
+
|
92
|
+
specs:
|
93
|
+
extends: [".default-only", ".default-before_script"]
|
94
|
+
needs: ["setup-test-env"]
|
95
|
+
dependencies: ["setup-test-env"]
|
96
|
+
stage: test
|
97
|
+
script:
|
98
|
+
- bundle exec rake spec
|
74
99
|
|
75
100
|
##################
|
76
101
|
## Triage stage ##
|
77
102
|
##################
|
78
103
|
dry-run:gitlab-triage:
|
79
|
-
|
104
|
+
extends: [".default-only", ".default-before_script"]
|
105
|
+
needs: ["setup-test-env"]
|
106
|
+
dependencies: ["setup-test-env"]
|
80
107
|
stage: triage
|
81
108
|
script:
|
82
109
|
- bundle exec rake install:local
|
@@ -84,11 +111,7 @@ dry-run:gitlab-triage:
|
|
84
111
|
- gitlab-triage --init
|
85
112
|
- gitlab-triage --dry-run --debug --token $API_TOKEN --source-id $CI_PROJECT_PATH
|
86
113
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
script:
|
91
|
-
- bundle exec rake install:local
|
92
|
-
- gitlab-triage --help
|
93
|
-
- gitlab-triage --dry-run --debug --token $API_TOKEN --source-id gitlab-org/gitlab-ce
|
114
|
+
# This job requires allows to override the `CI_PROJECT_PATH` variable when triggered.
|
115
|
+
dry-run:custom:
|
116
|
+
extends: dry-run:gitlab-triage
|
94
117
|
when: manual
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -119,6 +119,8 @@ Available condition types:
|
|
119
119
|
- [`no_additional_labels` condition](#no-additional-labels-condition)
|
120
120
|
- [`author_member` condition](#author-member-condition)
|
121
121
|
- [`assignee_member` condition](#assignee-member-condition)
|
122
|
+
- [`source_branch` condition](#source-branch-condition)
|
123
|
+
- [`target_branch` condition](#target-branch-condition)
|
122
124
|
- [`ruby` condition](#ruby-condition)
|
123
125
|
|
124
126
|
##### Date condition
|
@@ -382,7 +384,7 @@ conditions:
|
|
382
384
|
source_id: 9970
|
383
385
|
```
|
384
386
|
|
385
|
-
##### Assignee
|
387
|
+
##### Assignee member condition
|
386
388
|
|
387
389
|
This condition determines whether the assignee of a resource is a member of the specified group or project.
|
388
390
|
|
@@ -404,6 +406,28 @@ conditions:
|
|
404
406
|
source_id: 9970
|
405
407
|
```
|
406
408
|
|
409
|
+
##### Source branch condition
|
410
|
+
|
411
|
+
Accepts the name of a source branch to filter upon.
|
412
|
+
|
413
|
+
Example:
|
414
|
+
|
415
|
+
```yml
|
416
|
+
conditions:
|
417
|
+
source_branch: 'feature-branch'
|
418
|
+
```
|
419
|
+
|
420
|
+
##### Target branch condition
|
421
|
+
|
422
|
+
Accepts the name of a target branch to filter upon.
|
423
|
+
|
424
|
+
Example:
|
425
|
+
|
426
|
+
```yml
|
427
|
+
conditions:
|
428
|
+
target_branch: 'master'
|
429
|
+
```
|
430
|
+
|
407
431
|
##### Ruby condition
|
408
432
|
|
409
433
|
This condition allows users to write a Ruby expression to be evaluated for
|
data/gitlab-triage.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
lib = File.expand_path('
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
require 'gitlab/triage/version'
|
4
4
|
|
@@ -20,11 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
22
|
spec.add_dependency 'activesupport', '~> 5.1'
|
23
|
-
spec.add_dependency 'httparty', '~> 0.
|
23
|
+
spec.add_dependency 'httparty', '~> 0.17'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler'
|
26
|
-
spec.add_development_dependency 'gitlab-styles', '~> 2.
|
27
|
-
spec.add_development_dependency 'rake', '~> 10.
|
28
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
26
|
+
spec.add_development_dependency 'gitlab-styles', '~> 2.8'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.2'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.8'
|
29
29
|
spec.add_development_dependency 'webmock', '~> 3.4'
|
30
30
|
end
|
@@ -18,6 +18,8 @@ module Gitlab
|
|
18
18
|
author: "@{{author.username}}",
|
19
19
|
assignee: "@{{assignee.username}}",
|
20
20
|
assignees: "@{{assignees.username}}",
|
21
|
+
source_branch: "{{source_branch}}",
|
22
|
+
target_branch: "{{target_branch}}",
|
21
23
|
closed_by: "@{{closed_by.username}}",
|
22
24
|
merged_by: "@{{merged_by.username}}",
|
23
25
|
milestone: %(%"{{milestone.title}}"),
|
@@ -29,7 +31,7 @@ module Gitlab
|
|
29
31
|
type: "{{type}}",
|
30
32
|
items: "{{items}}"
|
31
33
|
}.freeze
|
32
|
-
PLACEHOLDER_REGEX = /{{([\w\.]+)}}
|
34
|
+
PLACEHOLDER_REGEX = /{{([\w\.]+)}}/.freeze
|
33
35
|
|
34
36
|
attr_reader :resource, :network
|
35
37
|
|
data/lib/gitlab/triage/engine.rb
CHANGED
@@ -216,6 +216,8 @@ module Gitlab
|
|
216
216
|
condition_builders << APIQueryBuilders::MultiQueryParamBuilder.new('labels', conditions[:labels], ',') if conditions[:labels]
|
217
217
|
condition_builders << APIQueryBuilders::SingleQueryParamBuilder.new('state', conditions[:state]) if conditions[:state]
|
218
218
|
condition_builders << APIQueryBuilders::SingleQueryParamBuilder.new('milestone', Array(conditions[:milestone])[0]) if conditions[:milestone]
|
219
|
+
condition_builders << APIQueryBuilders::SingleQueryParamBuilder.new('source_branch', conditions[:source_branch]) if conditions[:source_branch]
|
220
|
+
condition_builders << APIQueryBuilders::SingleQueryParamBuilder.new('target_branch', conditions[:target_branch]) if conditions[:target_branch]
|
219
221
|
|
220
222
|
condition_builders.each do |condition_builder|
|
221
223
|
params[condition_builder.param_name] = condition_builder.param_content
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal
|
2
|
-
# rubocop:disable Rails/Exit
|
3
2
|
|
4
3
|
require 'optparse'
|
5
4
|
require 'fileutils'
|
@@ -57,7 +56,7 @@ module Gitlab
|
|
57
56
|
|
58
57
|
opts.on('-h', '--help', 'Print help message') do
|
59
58
|
$stdout.puts opts
|
60
|
-
exit
|
59
|
+
exit # rubocop:disable Rails/Exit
|
61
60
|
end
|
62
61
|
|
63
62
|
opts.on('--init', 'Initialize the project with a policy file') do
|
@@ -65,7 +64,7 @@ module Gitlab
|
|
65
64
|
File.expand_path('../../../support/.triage-policies.example.yml', __dir__)
|
66
65
|
|
67
66
|
FileUtils.cp(example_path, '.triage-policies.yml')
|
68
|
-
exit
|
67
|
+
exit # rubocop:disable Rails/Exit
|
69
68
|
end
|
70
69
|
|
71
70
|
opts.on('--init-ci', 'Initialize the project with a .gitlab-ci.yml file') do
|
@@ -73,7 +72,7 @@ module Gitlab
|
|
73
72
|
File.expand_path('../../../support/.gitlab-ci.example.yml', __dir__)
|
74
73
|
|
75
74
|
FileUtils.cp(example_path, '.gitlab-ci.yml')
|
76
|
-
exit
|
75
|
+
exit # rubocop:disable Rails/Exit
|
77
76
|
end
|
78
77
|
end
|
79
78
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-triage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.17'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.17'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,42 +58,42 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
61
|
+
version: '2.8'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '2.
|
68
|
+
version: '2.8'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '10.
|
75
|
+
version: '10.2'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '10.
|
82
|
+
version: '10.2'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.8'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.8'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: webmock
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,7 +120,6 @@ files:
|
|
120
120
|
- ".gitignore"
|
121
121
|
- ".gitlab-ci.yml"
|
122
122
|
- ".gitlab/CODEOWNERS"
|
123
|
-
- ".gitlab/issue_templates/Policy.md"
|
124
123
|
- ".rubocop.yml"
|
125
124
|
- CONTRIBUTING.md
|
126
125
|
- Gemfile
|
@@ -1,32 +0,0 @@
|
|
1
|
-
### Policy title
|
2
|
-
|
3
|
-
( add a title to accurately describe the policy that you are referring to )
|
4
|
-
|
5
|
-
### New Policy/Policy Change/Policy Removal
|
6
|
-
|
7
|
-
( declare the type of policy change this is )
|
8
|
-
|
9
|
-
### Issues or Merge Requests Policy?
|
10
|
-
|
11
|
-
Issues/Merge Requests/both
|
12
|
-
|
13
|
-
### Policy Conditions
|
14
|
-
|
15
|
-
( declare the conditions for the related policy )
|
16
|
-
|
17
|
-
#### Example
|
18
|
-
|
19
|
-
- Label: bug
|
20
|
-
- not updated for over 6 months
|
21
|
-
- no associated milestone (unscheduled)
|
22
|
-
- state: open
|
23
|
-
|
24
|
-
### Policy Actions
|
25
|
-
|
26
|
-
( declare the actions for the related policy )
|
27
|
-
|
28
|
-
#### Example
|
29
|
-
|
30
|
-
- Add a comment
|
31
|
-
- Mention @markglenfletcher
|
32
|
-
- Label: "awaiting feedback" "auto updated"
|