Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
896b27d8
Commit
896b27d8
authored
Feb 23, 2022
by
Allison Browne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add urgency to job related endpoints
parent
a96243b0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
14 deletions
+27
-14
app/controllers/projects/builds_controller.rb
app/controllers/projects/builds_controller.rb
+3
-0
app/controllers/projects/jobs_controller.rb
app/controllers/projects/jobs_controller.rb
+2
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-1
app/controllers/projects/pipelines/stages_controller.rb
app/controllers/projects/pipelines/stages_controller.rb
+4
-0
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+3
-0
lib/api/ci/jobs.rb
lib/api/ci/jobs.rb
+9
-9
lib/api/ci/pipelines.rb
lib/api/ci/pipelines.rb
+1
-1
lib/api/ci/runner.rb
lib/api/ci/runner.rb
+3
-3
No files found.
app/controllers/projects/builds_controller.rb
View file @
896b27d8
...
...
@@ -5,6 +5,9 @@ class Projects::BuildsController < Projects::ApplicationController
feature_category
:continuous_integration
urgency
:high
,
[
:index
,
:show
]
urgency
:low
,
[
:raw
]
def
index
redirect_to
project_jobs_path
(
project
)
end
...
...
app/controllers/projects/jobs_controller.rb
View file @
896b27d8
...
...
@@ -4,6 +4,8 @@ class Projects::JobsController < Projects::ApplicationController
include
SendFileUpload
include
ContinueParams
urgency
:low
,
[
:index
,
:show
,
:trace
,
:retry
,
:play
,
:cancel
,
:unschedule
,
:status
,
:erase
,
:raw
]
before_action
:find_job_as_build
,
except:
[
:index
,
:play
,
:show
]
before_action
:find_job_as_processable
,
only:
[
:play
,
:show
]
before_action
:authorize_read_build_trace!
,
only:
[
:trace
,
:raw
]
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
896b27d8
...
...
@@ -87,7 +87,8 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
:ci_environments_status
,
:destroy
,
:rebase
,
:discussions
:discussions
,
:pipelines
]
def
index
...
...
app/controllers/projects/pipelines/stages_controller.rb
View file @
896b27d8
...
...
@@ -5,6 +5,10 @@ module Projects
class
StagesController
<
Projects
::
Pipelines
::
ApplicationController
before_action
:authorize_update_pipeline!
urgency
:low
,
[
:play_manual
]
def
play_manual
::
Ci
::
PlayManualStageService
.
new
(
@project
,
current_user
,
pipeline:
pipeline
)
...
...
app/controllers/projects/pipelines_controller.rb
View file @
896b27d8
...
...
@@ -4,6 +4,9 @@ class Projects::PipelinesController < Projects::ApplicationController
include
::
Gitlab
::
Utils
::
StrongMemoize
include
RedisTracking
urgency
:default
,
[
:status
]
urgency
:low
,
[
:index
,
:new
,
:builds
,
:show
,
:failures
,
:create
,
:stage
,
:retry
,
:dag
,
:cancel
]
before_action
:disable_query_limiting
,
only:
[
:create
,
:retry
]
before_action
:pipeline
,
except:
[
:index
,
:new
,
:create
,
:charts
,
:config_variables
]
before_action
:set_pipeline_path
,
only:
[
:show
]
...
...
lib/api/ci/jobs.rb
View file @
896b27d8
...
...
@@ -38,7 +38,7 @@ module API
use
:pagination
end
# rubocop: disable CodeReuse/ActiveRecord
get
':id/jobs'
,
feature_category: :continuous_integration
do
get
':id/jobs'
,
urgency: :low
,
feature_category: :continuous_integration
do
authorize_read_builds!
builds
=
user_project
.
builds
.
order
(
'id DESC'
)
...
...
@@ -55,7 +55,7 @@ module API
params
do
requires
:job_id
,
type:
Integer
,
desc:
'The ID of a job'
end
get
':id/jobs/:job_id'
,
feature_category: :continuous_integration
do
get
':id/jobs/:job_id'
,
urgency: :low
,
feature_category: :continuous_integration
do
authorize_read_builds!
build
=
find_build!
(
params
[
:job_id
])
...
...
@@ -70,7 +70,7 @@ module API
params
do
requires
:job_id
,
type:
Integer
,
desc:
'The ID of a job'
end
get
':id/jobs/:job_id/trace'
,
feature_category: :continuous_integration
do
get
':id/jobs/:job_id/trace'
,
urgency: :low
,
feature_category: :continuous_integration
do
authorize_read_builds!
build
=
find_build!
(
params
[
:job_id
])
...
...
@@ -92,7 +92,7 @@ module API
params
do
requires
:job_id
,
type:
Integer
,
desc:
'The ID of a job'
end
post
':id/jobs/:job_id/cancel'
,
feature_category: :continuous_integration
do
post
':id/jobs/:job_id/cancel'
,
urgency: :low
,
feature_category: :continuous_integration
do
authorize_update_builds!
build
=
find_build!
(
params
[
:job_id
])
...
...
@@ -109,7 +109,7 @@ module API
params
do
requires
:job_id
,
type:
Integer
,
desc:
'The ID of a build'
end
post
':id/jobs/:job_id/retry'
,
feature_category: :continuous_integration
do
post
':id/jobs/:job_id/retry'
,
urgency: :low
,
feature_category: :continuous_integration
do
authorize_update_builds!
build
=
find_build!
(
params
[
:job_id
])
...
...
@@ -127,7 +127,7 @@ module API
params
do
requires
:job_id
,
type:
Integer
,
desc:
'The ID of a build'
end
post
':id/jobs/:job_id/erase'
,
feature_category: :continuous_integration
do
post
':id/jobs/:job_id/erase'
,
urgency: :low
,
feature_category: :continuous_integration
do
authorize_update_builds!
build
=
find_build!
(
params
[
:job_id
])
...
...
@@ -146,7 +146,7 @@ module API
requires
:job_id
,
type:
Integer
,
desc:
'The ID of a Job'
end
post
":id/jobs/:job_id/play"
,
feature_category: :continuous_integration
do
post
':id/jobs/:job_id/play'
,
urgency: :low
,
feature_category: :continuous_integration
do
authorize_read_builds!
job
=
find_job!
(
params
[
:job_id
])
...
...
@@ -168,11 +168,11 @@ module API
end
resource
:job
do
desc
'Get current
project
using job token'
do
desc
'Get current
job
using job token'
do
success
Entities
::
Ci
::
Job
end
route_setting
:authentication
,
job_token_allowed:
true
get
''
,
feature_category: :continuous_integration
do
get
''
,
feature_category: :continuous_integration
,
urgency: :low
do
validate_current_authenticated_job
present
current_authenticated_job
,
with:
Entities
::
Ci
::
Job
...
...
lib/api/ci/pipelines.rb
View file @
896b27d8
...
...
@@ -123,7 +123,7 @@ module API
use
:pagination
end
get
':id/pipelines/:pipeline_id/jobs'
,
feature_category: :continuous_integration
do
get
':id/pipelines/:pipeline_id/jobs'
,
urgency: :low
,
feature_category: :continuous_integration
do
authorize!
(
:read_pipeline
,
user_project
)
pipeline
=
user_project
.
all_pipelines
.
find
(
params
[
:pipeline_id
])
...
...
lib/api/ci/runner.rb
View file @
896b27d8
...
...
@@ -118,7 +118,7 @@ module API
formatter
:build_json
,
->
(
object
,
_
)
{
object
}
parser
:build_json
,
::
Grape
::
Parser
::
Json
post
'/request'
,
feature_category: :continuous_integration
do
post
'/request'
,
urgency: :low
,
feature_category: :continuous_integration
do
authenticate_runner!
unless
current_runner
.
active?
...
...
@@ -172,7 +172,7 @@ module API
end
optional
:exit_code
,
type:
Integer
,
desc:
%q(Job's exit code)
end
put
'/:id'
,
feature_category: :continuous_integration
do
put
'/:id'
,
urgency: :low
,
feature_category: :continuous_integration
do
job
=
authenticate_job!
(
heartbeat_runner:
true
)
Gitlab
::
Metrics
.
add_event
(
:update_build
)
...
...
@@ -199,7 +199,7 @@ module API
requires
:id
,
type:
Integer
,
desc:
%q(Job's ID)
optional
:token
,
type:
String
,
desc:
%q(Job's authentication token)
end
patch
'/:id/trace'
,
feature_category: :continuous_integration
do
patch
'/:id/trace'
,
urgency: :default
,
feature_category: :continuous_integration
do
job
=
authenticate_job!
(
heartbeat_runner:
true
)
error!
(
'400 Missing header Content-Range'
,
400
)
unless
request
.
headers
.
key?
(
'Content-Range'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment