gitlab 4.5.0 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/stale.yml +18 -0
- data/.rubocop_todo.yml +46 -0
- data/Gemfile +2 -0
- data/README.md +22 -22
- data/Rakefile +3 -5
- data/bin/console +1 -0
- data/exe/gitlab +5 -1
- data/gitlab.gemspec +9 -6
- data/lib/gitlab.rb +6 -3
- data/lib/gitlab/api.rb +5 -3
- data/lib/gitlab/cli.rb +11 -5
- data/lib/gitlab/cli_helpers.rb +31 -22
- data/lib/gitlab/client.rb +7 -8
- data/lib/gitlab/client/access_requests.rb +100 -93
- data/lib/gitlab/client/award_emojis.rb +127 -127
- data/lib/gitlab/client/boards.rb +82 -82
- data/lib/gitlab/client/branches.rb +89 -89
- data/lib/gitlab/client/build_variables.rb +117 -117
- data/lib/gitlab/client/builds.rb +98 -98
- data/lib/gitlab/client/commits.rb +154 -154
- data/lib/gitlab/client/deployments.rb +29 -29
- data/lib/gitlab/client/environments.rb +80 -80
- data/lib/gitlab/client/events.rb +54 -54
- data/lib/gitlab/client/group_milestones.rb +85 -86
- data/lib/gitlab/client/groups.rb +178 -178
- data/lib/gitlab/client/issues.rb +195 -196
- data/lib/gitlab/client/jobs.rb +150 -150
- data/lib/gitlab/client/keys.rb +14 -14
- data/lib/gitlab/client/labels.rb +79 -79
- data/lib/gitlab/client/merge_request_approvals.rb +102 -102
- data/lib/gitlab/client/merge_requests.rb +281 -256
- data/lib/gitlab/client/milestones.rb +85 -85
- data/lib/gitlab/client/namespaces.rb +18 -18
- data/lib/gitlab/client/notes.rb +260 -260
- data/lib/gitlab/client/pipeline_schedules.rb +123 -123
- data/lib/gitlab/client/pipeline_triggers.rb +93 -93
- data/lib/gitlab/client/pipelines.rb +62 -62
- data/lib/gitlab/client/projects.rb +526 -505
- data/lib/gitlab/client/repositories.rb +68 -55
- data/lib/gitlab/client/repository_files.rb +103 -103
- data/lib/gitlab/client/runners.rb +113 -115
- data/lib/gitlab/client/services.rb +46 -45
- data/lib/gitlab/client/sidekiq.rb +32 -32
- data/lib/gitlab/client/snippets.rb +86 -86
- data/lib/gitlab/client/system_hooks.rb +57 -57
- data/lib/gitlab/client/tags.rb +87 -88
- data/lib/gitlab/client/todos.rb +41 -41
- data/lib/gitlab/client/users.rb +242 -228
- data/lib/gitlab/client/versions.rb +16 -0
- data/lib/gitlab/configuration.rb +7 -5
- data/lib/gitlab/error.rb +3 -1
- data/lib/gitlab/file_response.rb +4 -2
- data/lib/gitlab/help.rb +9 -9
- data/lib/gitlab/objectified_hash.rb +5 -4
- data/lib/gitlab/page_links.rb +9 -7
- data/lib/gitlab/paginated_response.rb +14 -4
- data/lib/gitlab/request.rb +8 -5
- data/lib/gitlab/shell.rb +6 -4
- data/lib/gitlab/shell_history.rb +7 -5
- data/lib/gitlab/version.rb +3 -1
- metadata +8 -5
data/lib/gitlab/client/jobs.rb
CHANGED
@@ -1,162 +1,162 @@
|
|
1
|
-
|
2
|
-
# Defines methods related to projects.
|
3
|
-
# @see https://docs.gitlab.com/ee/api/jobs.html
|
4
|
-
module Jobs
|
5
|
-
# Gets a list of Jobs for a Project
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Gitlab.jobs(1)
|
9
|
-
# Gitlab.jobs("project")
|
10
|
-
#
|
11
|
-
# @param [Integer, String] id The ID or name of a project.
|
12
|
-
# @param [Hash] options A customizable set of options.
|
13
|
-
# @option options [Array] :scope The scope of jobs to show, one or array of: created, pending, running, failed, success, canceled, skipped, manual; showing all jobs if none provided.
|
14
|
-
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
|
-
def jobs(project_id, options = {})
|
16
|
-
get("/projects/#{url_encode project_id}/jobs", query: options)
|
17
|
-
end
|
1
|
+
# frozen_string_literal: true
|
18
2
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
3
|
+
# Defines methods related to projects.
|
4
|
+
# @see https://docs.gitlab.com/ee/api/jobs.html
|
5
|
+
module Jobs
|
6
|
+
# Gets a list of Jobs for a Project
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# Gitlab.jobs(1)
|
10
|
+
# Gitlab.jobs("project")
|
11
|
+
#
|
12
|
+
# @param [Integer, String] id The ID or name of a project.
|
13
|
+
# @param [Hash] options A customizable set of options.
|
14
|
+
# @option options [Array] :scope The scope of jobs to show, one or array of: created, pending, running, failed, success, canceled, skipped, manual; showing all jobs if none provided.
|
15
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
16
|
+
def jobs(project_id, options = {})
|
17
|
+
get("/projects/#{url_encode project_id}/jobs", query: options)
|
18
|
+
end
|
33
19
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
20
|
+
# Gets a list of Jobs from a pipeline
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.pipeline_jobs(1, 2)
|
24
|
+
# Gitlab.pipeline_jobs("project", 2)
|
25
|
+
#
|
26
|
+
# @param [Integer, String] The ID or name of a project.
|
27
|
+
# @param [Integer] the id of the pipeline
|
28
|
+
# @param [Hash] options A customizable set of options.
|
29
|
+
# @option options [Array] :scope The scope of jobs to show, one or array of: created, pending, running, failed, success, canceled, skipped, manual; showing all jobs if none provided.
|
30
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
31
|
+
def pipeline_jobs(project_id, pipeline_id, options = {})
|
32
|
+
get("/projects/#{url_encode project_id}/pipelines/#{pipeline_id}/jobs", query: options)
|
33
|
+
end
|
45
34
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
format: nil,
|
58
|
-
headers: { Accept: 'text/plain' },
|
59
|
-
parser: ::Gitlab::Request::Parser)
|
60
|
-
end
|
35
|
+
# Gets a single job
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# Gitlab.job(1, 2)
|
39
|
+
# Gitlab.job("project", 2)
|
40
|
+
#
|
41
|
+
# @param [Integer, String] The ID or name of a project.
|
42
|
+
# @param [Integer] the id of the job
|
43
|
+
def job(project_id, job_id)
|
44
|
+
get("/projects/#{url_encode project_id}/jobs/#{job_id}")
|
45
|
+
end
|
61
46
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
47
|
+
# Gets artifacts from a job
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# Gitlab.job_artifacts(1, 2)
|
51
|
+
# Gitlab.job_artifacts("project", 2)
|
52
|
+
#
|
53
|
+
# @param [Integer, String] The ID or name of a project.
|
54
|
+
# @param [Integer] the id of the job
|
55
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
56
|
+
def job_artifacts(project_id, job_id)
|
57
|
+
get("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts",
|
58
|
+
format: nil,
|
59
|
+
headers: { Accept: 'text/plain' },
|
60
|
+
parser: ::Gitlab::Request::Parser)
|
61
|
+
end
|
78
62
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
63
|
+
# Download Job Artifact
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# Gitlab.job_artifacts_download(1, "master", "release")
|
67
|
+
# Gitlab.job_artifacts_download("project", "master", "release")
|
68
|
+
#
|
69
|
+
# @param [Integer, String] id, The ID or name of a project.
|
70
|
+
# @param [String] ref, Ref Name
|
71
|
+
# @param [String] job, jobname
|
72
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
73
|
+
def job_artifacts_download(project_id, ref_name, job_name)
|
74
|
+
get("/projects/#{url_encode project_id}/jobs/artifacts/#{ref_name}/download", query: { job: job_name },
|
75
|
+
format: nil,
|
76
|
+
headers: { Accept: 'text/plain' },
|
77
|
+
parser: ::Gitlab::Request::Parser)
|
78
|
+
end
|
94
79
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
80
|
+
# Get Job Trace
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# Gitlab.job_trace(1,1)
|
84
|
+
# Gitlab.job_trace("project", 1)
|
85
|
+
#
|
86
|
+
# @param [Integer, String] The ID or name of a project.
|
87
|
+
# @param [Integer] the id of the job
|
88
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
89
|
+
def job_trace(project_id, job_id)
|
90
|
+
get("/projects/#{url_encode project_id}/jobs/#{job_id}/trace",
|
91
|
+
format: nil,
|
92
|
+
headers: { Accept: 'text/plain' },
|
93
|
+
parser: ::Gitlab::Request::Parser)
|
94
|
+
end
|
107
95
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
96
|
+
# Cancel a job
|
97
|
+
#
|
98
|
+
# @example
|
99
|
+
# Gitlab.job_cancel(1,1)
|
100
|
+
# Gitlab.job_cancel("project", 1)
|
101
|
+
#
|
102
|
+
# @param [Integer, String] The ID or name of a project.
|
103
|
+
# @param [Integer] the id of the job
|
104
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
105
|
+
def job_cancel(project_id, job_id)
|
106
|
+
post("/projects/#{url_encode project_id}/jobs/#{job_id}/cancel")
|
107
|
+
end
|
120
108
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
109
|
+
# Retry a job
|
110
|
+
#
|
111
|
+
# @example
|
112
|
+
# Gitlab.job_retry(1,1)
|
113
|
+
# Gitlab.job_retry("project", 1)
|
114
|
+
#
|
115
|
+
# @param [Integer, String] The ID or name of a project.
|
116
|
+
# @param [Integer] the id of the job
|
117
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
118
|
+
def job_retry(project_id, job_id)
|
119
|
+
post("/projects/#{url_encode project_id}/jobs/#{job_id}/retry")
|
120
|
+
end
|
133
121
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
122
|
+
# Erase Job
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
# Gitlab.job_erase(1,1)
|
126
|
+
# Gitlab.job_erase("project", 1)
|
127
|
+
#
|
128
|
+
# @param [Integer, String] The ID or name of a project.
|
129
|
+
# @param [Integer] the id of the job
|
130
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
131
|
+
def job_erase(project_id, job_id)
|
132
|
+
post("/projects/#{url_encode project_id}/jobs/#{job_id}/erase")
|
133
|
+
end
|
134
|
+
|
135
|
+
# Play a Job
|
136
|
+
# Triggers a manual action to start a job.
|
137
|
+
#
|
138
|
+
# @example
|
139
|
+
# Gitlab.job_play(1,1)
|
140
|
+
# Gitlab.job_play("project", 1)
|
141
|
+
#
|
142
|
+
# @param [Integer, String] The ID or name of a project.
|
143
|
+
# @param [Integer] the id of the job
|
144
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
145
|
+
def job_play(project_id, job_id)
|
146
|
+
post("/projects/#{url_encode project_id}/jobs/#{job_id}/play")
|
147
|
+
end
|
147
148
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
end
|
149
|
+
# Keep Artifacts
|
150
|
+
# Prevents artifacts from being deleted when expiration is set.
|
151
|
+
#
|
152
|
+
# @example
|
153
|
+
# Gitlab.job_artifacts_keep(1,1)
|
154
|
+
# Gitlab.job_artifacts_keep("project", 1)
|
155
|
+
#
|
156
|
+
# @param [Integer, String] The ID or name of a project.
|
157
|
+
# @param [Integer] the id of the job
|
158
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
159
|
+
def job_artifacts_keep(project_id, job_id)
|
160
|
+
post("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/keep")
|
161
161
|
end
|
162
162
|
end
|
data/lib/gitlab/client/keys.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Defines methods related to keys.
|
4
|
+
# @see https://docs.gitlab.com/ce/api/keys.html
|
5
|
+
module Keys
|
6
|
+
# Gets information about a key.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# Gitlab.key(1)
|
10
|
+
#
|
11
|
+
# @param [Integer] id The ID of a key.
|
12
|
+
# @return [Gitlab::ObjectifiedHash]
|
13
|
+
def key(id)
|
14
|
+
get("/keys/#{id}")
|
15
15
|
end
|
16
16
|
end
|
data/lib/gitlab/client/labels.rb
CHANGED
@@ -1,86 +1,86 @@
|
|
1
|
-
|
2
|
-
# Defines methods related to labels.
|
3
|
-
# @see https://docs.gitlab.com/ce/api/labels.html
|
4
|
-
module Labels
|
5
|
-
# Gets a list of project's labels.
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Gitlab.labels(5)
|
9
|
-
#
|
10
|
-
# @param [Integer, String] project The ID or name of a project.
|
11
|
-
# @return [Array<Gitlab::ObjectifiedHash>]
|
12
|
-
def labels(project, options={})
|
13
|
-
get("/projects/#{url_encode project}/labels", query: options)
|
14
|
-
end
|
1
|
+
# frozen_string_literal: true
|
15
2
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
3
|
+
# Defines methods related to labels.
|
4
|
+
# @see https://docs.gitlab.com/ce/api/labels.html
|
5
|
+
module Labels
|
6
|
+
# Gets a list of project's labels.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# Gitlab.labels(5)
|
10
|
+
#
|
11
|
+
# @param [Integer, String] project The ID or name of a project.
|
12
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
13
|
+
def labels(project, options = {})
|
14
|
+
get("/projects/#{url_encode project}/labels", query: options)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Creates a new label.
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# Gitlab.create_label(42, "Backlog", '#DD10AA')
|
21
|
+
#
|
22
|
+
# @param [Integer, String] project The ID or name of a project.
|
23
|
+
# @param [String] name The name of a label.
|
24
|
+
# @param [String] color The color of a label.
|
25
|
+
# @param [Hash] options A customizable set of options.
|
26
|
+
# @option options [String] :description The description of the label.
|
27
|
+
# @option options [String] :priority The priority of the label. Must be greater or equal than zero or null to remove the priority.
|
28
|
+
# @return [Gitlab::ObjectifiedHash] Information about created label.
|
29
|
+
def create_label(project, name, color, options = {})
|
30
|
+
post("/projects/#{url_encode project}/labels", body: options.merge(name: name, color: color))
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
33
|
+
# Updates a label.
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Gitlab.edit_label(42, "Backlog", { new_name: 'TODO' })
|
37
|
+
# Gitlab.edit_label(42, "Backlog", { new_name: 'TODO', color: '#DD10AA' })
|
38
|
+
#
|
39
|
+
# @param [Integer, String] project The ID or name of a project.
|
40
|
+
# @param [String] name The name of a label.
|
41
|
+
# @param [Hash] options A customizable set of options.
|
42
|
+
# @option options [String] :new_name The new name of a label.
|
43
|
+
# @option options [String] :color The color of a label.
|
44
|
+
# @option options [String] :description The description of the label.
|
45
|
+
# @option options [String] :priority The priority of the label. Must be greater or equal than zero or null to remove the priority.
|
46
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated label.
|
47
|
+
def edit_label(project, name, options = {})
|
48
|
+
put("/projects/#{url_encode project}/labels", body: options.merge(name: name))
|
49
|
+
end
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
# Deletes a label.
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# Gitlab.delete_label(2, 'Backlog')
|
55
|
+
#
|
56
|
+
# @param [Integer, String] project The ID or name of a project.
|
57
|
+
# @param [String] name The name of a label.
|
58
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted label.
|
59
|
+
def delete_label(project, name)
|
60
|
+
delete("/projects/#{url_encode project}/labels", body: { name: name })
|
61
|
+
end
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
63
|
+
# Subscribes the user to a label to receive notifications
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# Gitlab.subscribe_to_label(2, 'Backlog')
|
67
|
+
#
|
68
|
+
# @param [Integer, String] project The ID or name of a project.
|
69
|
+
# @param [String] name The name of a label.
|
70
|
+
# @return [Gitlab::ObjectifiedHash] Information about the label subscribed to.
|
71
|
+
def subscribe_to_label(project, name)
|
72
|
+
post("/projects/#{url_encode project}/labels/#{url_encode name}/subscribe")
|
73
|
+
end
|
73
74
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
75
|
+
# Unsubscribes the user from a label to not receive notifications from it
|
76
|
+
#
|
77
|
+
# @example
|
78
|
+
# Gitlab.unsubscribe_from_label(2, 'Backlog')
|
79
|
+
#
|
80
|
+
# @param [Integer, String] project The ID or name of a project.
|
81
|
+
# @param [String] name The name of a label.
|
82
|
+
# @return [Gitlab::ObjectifiedHash] Information about the label unsubscribed from.
|
83
|
+
def unsubscribe_from_label(project, name)
|
84
|
+
post("/projects/#{url_encode project}/labels/#{url_encode name}/unsubscribe")
|
85
85
|
end
|
86
86
|
end
|