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
336089c0
Commit
336089c0
authored
Jul 13, 2021
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Entities::JobRequest under Ci namespace
Move `Entities::JobRequest` under `Entities::Ci::JobRequest`
parent
d6bb6a6c
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
221 additions
and
87 deletions
+221
-87
app/services/ci/register_job_service.rb
app/services/ci/register_job_service.rb
+1
-1
ee/lib/ee/api/entities/ci/job_request/response.rb
ee/lib/ee/api/entities/ci/job_request/response.rb
+19
-0
ee/lib/ee/api/jobs.rb
ee/lib/ee/api/jobs.rb
+1
-1
lib/api/ci/runner.rb
lib/api/ci/runner.rb
+2
-2
lib/api/entities/ci/job_request/artifacts.rb
lib/api/entities/ci/job_request/artifacts.rb
+20
-0
lib/api/entities/ci/job_request/cache.rb
lib/api/entities/ci/job_request/cache.rb
+13
-0
lib/api/entities/ci/job_request/credentials.rb
lib/api/entities/ci/job_request/credentials.rb
+13
-0
lib/api/entities/ci/job_request/dependency.rb
lib/api/entities/ci/job_request/dependency.rb
+14
-0
lib/api/entities/ci/job_request/git_info.rb
lib/api/entities/ci/job_request/git_info.rb
+16
-0
lib/api/entities/ci/job_request/image.rb
lib/api/entities/ci/job_request/image.rb
+14
-0
lib/api/entities/ci/job_request/job_info.rb
lib/api/entities/ci/job_request/job_info.rb
+14
-0
lib/api/entities/ci/job_request/port.rb
lib/api/entities/ci/job_request/port.rb
+13
-0
lib/api/entities/ci/job_request/response.rb
lib/api/entities/ci/job_request/response.rb
+39
-0
lib/api/entities/ci/job_request/runner_info.rb
lib/api/entities/ci/job_request/runner_info.rb
+14
-0
lib/api/entities/ci/job_request/service.rb
lib/api/entities/ci/job_request/service.rb
+13
-0
lib/api/entities/ci/job_request/step.rb
lib/api/entities/ci/job_request/step.rb
+13
-0
lib/api/entities/job_request/artifacts.rb
lib/api/entities/job_request/artifacts.rb
+0
-18
lib/api/entities/job_request/dependency.rb
lib/api/entities/job_request/dependency.rb
+0
-12
lib/api/entities/job_request/git_info.rb
lib/api/entities/job_request/git_info.rb
+0
-14
lib/api/entities/job_request/response.rb
lib/api/entities/job_request/response.rb
+0
-37
spec/lib/api/entities/ci/job_request/image_spec.rb
spec/lib/api/entities/ci/job_request/image_spec.rb
+1
-1
spec/lib/api/entities/ci/job_request/port_spec.rb
spec/lib/api/entities/ci/job_request/port_spec.rb
+1
-1
No files found.
app/services/ci/register_job_service.rb
View file @
336089c0
...
...
@@ -209,7 +209,7 @@ module Ci
# We need to use the presenter here because Gitaly calls in the presenter
# may fail, and we need to ensure the response has been generated.
presented_build
=
::
Ci
::
BuildRunnerPresenter
.
new
(
build
)
# rubocop:disable CodeReuse/Presenter
build_json
=
::
API
::
Entities
::
JobRequest
::
Response
.
new
(
presented_build
).
to_json
build_json
=
::
API
::
Entities
::
Ci
::
JobRequest
::
Response
.
new
(
presented_build
).
to_json
Result
.
new
(
build
,
build_json
,
true
)
end
...
...
ee/lib/ee/api/entities/job_request/response.rb
→
ee/lib/ee/api/entities/
ci/
job_request/response.rb
View file @
336089c0
...
...
@@ -3,12 +3,14 @@
module
EE
module
API
module
Entities
module
JobRequest
module
Response
extend
ActiveSupport
::
Concern
module
Ci
module
JobRequest
module
Response
extend
ActiveSupport
::
Concern
prepended
do
expose
:secrets_configuration
,
as: :secrets
,
if:
->
(
build
,
_
)
{
build
.
ci_secrets_management_available?
}
prepended
do
expose
:secrets_configuration
,
as: :secrets
,
if:
->
(
build
,
_
)
{
build
.
ci_secrets_management_available?
}
end
end
end
end
...
...
ee/lib/ee/api/jobs.rb
View file @
336089c0
...
...
@@ -22,7 +22,7 @@ module EE
{
allowed_agents:
::
API
::
Entities
::
Clusters
::
Agent
.
represent
(
allowed_agents
),
job:
::
API
::
Entities
::
JobRequest
::
JobInfo
.
represent
(
current_authenticated_job
),
job:
::
API
::
Entities
::
Ci
::
JobRequest
::
JobInfo
.
represent
(
current_authenticated_job
),
pipeline:
::
API
::
Entities
::
Ci
::
PipelineBasic
.
represent
(
pipeline
),
project:
::
API
::
Entities
::
ProjectIdentity
.
represent
(
project
),
user:
::
API
::
Entities
::
UserBasic
.
represent
(
current_user
)
...
...
lib/api/ci/runner.rb
View file @
336089c0
...
...
@@ -82,7 +82,7 @@ module API
before
{
set_application_context
}
desc
'Request a job'
do
success
Entities
::
JobRequest
::
Response
success
Entities
::
Ci
::
JobRequest
::
Response
http_codes
[[
201
,
'Job was scheduled'
],
[
204
,
'No job for Runner'
],
[
403
,
'Forbidden'
]]
...
...
@@ -267,7 +267,7 @@ module API
end
desc
'Upload artifacts for job'
do
success
Entities
::
JobRequest
::
Response
success
Entities
::
Ci
::
JobRequest
::
Response
http_codes
[[
201
,
'Artifact uploaded'
],
[
400
,
'Bad request'
],
[
403
,
'Forbidden'
],
...
...
lib/api/entities/ci/job_request/artifacts.rb
0 → 100644
View file @
336089c0
# frozen_string_literal: true
module
API
module
Entities
module
Ci
module
JobRequest
class
Artifacts
<
Grape
::
Entity
expose
:name
expose
:untracked
expose
:paths
expose
:exclude
,
expose_nil:
false
expose
:when
expose
:expire_in
expose
:artifact_type
expose
:artifact_format
end
end
end
end
end
lib/api/entities/job_request/cache.rb
→
lib/api/entities/
ci/
job_request/cache.rb
View file @
336089c0
...
...
@@ -2,9 +2,11 @@
module
API
module
Entities
module
JobRequest
class
Cache
<
Grape
::
Entity
expose
:key
,
:untracked
,
:paths
,
:policy
,
:when
module
Ci
module
JobRequest
class
Cache
<
Grape
::
Entity
expose
:key
,
:untracked
,
:paths
,
:policy
,
:when
end
end
end
end
...
...
lib/api/entities/job_request/credentials.rb
→
lib/api/entities/
ci/
job_request/credentials.rb
View file @
336089c0
...
...
@@ -2,9 +2,11 @@
module
API
module
Entities
module
JobRequest
class
Credentials
<
Grape
::
Entity
expose
:type
,
:url
,
:username
,
:password
module
Ci
module
JobRequest
class
Credentials
<
Grape
::
Entity
expose
:type
,
:url
,
:username
,
:password
end
end
end
end
...
...
lib/api/entities/ci/job_request/dependency.rb
0 → 100644
View file @
336089c0
# frozen_string_literal: true
module
API
module
Entities
module
Ci
module
JobRequest
class
Dependency
<
Grape
::
Entity
expose
:id
,
:name
,
:token
expose
:artifacts_file
,
using:
Entities
::
Ci
::
JobArtifactFile
,
if:
->
(
job
,
_
)
{
job
.
artifacts?
}
end
end
end
end
end
lib/api/entities/ci/job_request/git_info.rb
0 → 100644
View file @
336089c0
# frozen_string_literal: true
module
API
module
Entities
module
Ci
module
JobRequest
class
GitInfo
<
Grape
::
Entity
expose
:repo_url
,
:ref
,
:sha
,
:before_sha
expose
:ref_type
expose
:refspecs
expose
:git_depth
,
as: :depth
end
end
end
end
end
lib/api/entities/job_request/image.rb
→
lib/api/entities/
ci/
job_request/image.rb
View file @
336089c0
...
...
@@ -2,10 +2,12 @@
module
API
module
Entities
module
JobRequest
class
Image
<
Grape
::
Entity
expose
:name
,
:entrypoint
expose
:ports
,
using:
Entities
::
JobRequest
::
Port
module
Ci
module
JobRequest
class
Image
<
Grape
::
Entity
expose
:name
,
:entrypoint
expose
:ports
,
using:
Entities
::
Ci
::
JobRequest
::
Port
end
end
end
end
...
...
lib/api/entities/job_request/job_info.rb
→
lib/api/entities/
ci/
job_request/job_info.rb
View file @
336089c0
...
...
@@ -2,10 +2,12 @@
module
API
module
Entities
module
JobRequest
class
JobInfo
<
Grape
::
Entity
expose
:id
,
:name
,
:stage
expose
:project_id
,
:project_name
module
Ci
module
JobRequest
class
JobInfo
<
Grape
::
Entity
expose
:id
,
:name
,
:stage
expose
:project_id
,
:project_name
end
end
end
end
...
...
lib/api/entities/job_request/port.rb
→
lib/api/entities/
ci/
job_request/port.rb
View file @
336089c0
...
...
@@ -2,9 +2,11 @@
module
API
module
Entities
module
JobRequest
class
Port
<
Grape
::
Entity
expose
:number
,
:protocol
,
:name
module
Ci
module
JobRequest
class
Port
<
Grape
::
Entity
expose
:number
,
:protocol
,
:name
end
end
end
end
...
...
lib/api/entities/ci/job_request/response.rb
0 → 100644
View file @
336089c0
# frozen_string_literal: true
module
API
module
Entities
module
Ci
module
JobRequest
class
Response
<
Grape
::
Entity
expose
:id
expose
:token
expose
:allow_git_fetch
expose
:job_info
,
using:
Entities
::
Ci
::
JobRequest
::
JobInfo
do
|
model
|
model
end
expose
:git_info
,
using:
Entities
::
Ci
::
JobRequest
::
GitInfo
do
|
model
|
model
end
expose
:runner_info
,
using:
Entities
::
Ci
::
JobRequest
::
RunnerInfo
do
|
model
|
model
end
expose
:runner_variables
,
as: :variables
expose
:steps
,
using:
Entities
::
Ci
::
JobRequest
::
Step
expose
:image
,
using:
Entities
::
Ci
::
JobRequest
::
Image
expose
:services
,
using:
Entities
::
Ci
::
JobRequest
::
Service
expose
:artifacts
,
using:
Entities
::
Ci
::
JobRequest
::
Artifacts
expose
:cache
,
using:
Entities
::
Ci
::
JobRequest
::
Cache
expose
:credentials
,
using:
Entities
::
Ci
::
JobRequest
::
Credentials
expose
:all_dependencies
,
as: :dependencies
,
using:
Entities
::
Ci
::
JobRequest
::
Dependency
expose
:features
end
end
end
end
end
API
::
Entities
::
Ci
::
JobRequest
::
Response
.
prepend_mod_with
(
'API::Entities::Ci::JobRequest::Response'
)
lib/api/entities/job_request/runner_info.rb
→
lib/api/entities/
ci/
job_request/runner_info.rb
View file @
336089c0
...
...
@@ -2,10 +2,12 @@
module
API
module
Entities
module
JobRequest
class
RunnerInfo
<
Grape
::
Entity
expose
:metadata_timeout
,
as: :timeout
expose
:runner_session_url
module
Ci
module
JobRequest
class
RunnerInfo
<
Grape
::
Entity
expose
:metadata_timeout
,
as: :timeout
expose
:runner_session_url
end
end
end
end
...
...
lib/api/entities/job_request/service.rb
→
lib/api/entities/
ci/
job_request/service.rb
View file @
336089c0
...
...
@@ -2,9 +2,11 @@
module
API
module
Entities
module
JobRequest
class
Service
<
Entities
::
JobRequest
::
Image
expose
:alias
,
:command
module
Ci
module
JobRequest
class
Service
<
Entities
::
Ci
::
JobRequest
::
Image
expose
:alias
,
:command
end
end
end
end
...
...
lib/api/entities/job_request/step.rb
→
lib/api/entities/
ci/
job_request/step.rb
View file @
336089c0
...
...
@@ -2,9 +2,11 @@
module
API
module
Entities
module
JobRequest
class
Step
<
Grape
::
Entity
expose
:name
,
:script
,
:timeout
,
:when
,
:allow_failure
module
Ci
module
JobRequest
class
Step
<
Grape
::
Entity
expose
:name
,
:script
,
:timeout
,
:when
,
:allow_failure
end
end
end
end
...
...
lib/api/entities/job_request/artifacts.rb
deleted
100644 → 0
View file @
d6bb6a6c
# frozen_string_literal: true
module
API
module
Entities
module
JobRequest
class
Artifacts
<
Grape
::
Entity
expose
:name
expose
:untracked
expose
:paths
expose
:exclude
,
expose_nil:
false
expose
:when
expose
:expire_in
expose
:artifact_type
expose
:artifact_format
end
end
end
end
lib/api/entities/job_request/dependency.rb
deleted
100644 → 0
View file @
d6bb6a6c
# frozen_string_literal: true
module
API
module
Entities
module
JobRequest
class
Dependency
<
Grape
::
Entity
expose
:id
,
:name
,
:token
expose
:artifacts_file
,
using:
Entities
::
Ci
::
JobArtifactFile
,
if:
->
(
job
,
_
)
{
job
.
artifacts?
}
end
end
end
end
lib/api/entities/job_request/git_info.rb
deleted
100644 → 0
View file @
d6bb6a6c
# frozen_string_literal: true
module
API
module
Entities
module
JobRequest
class
GitInfo
<
Grape
::
Entity
expose
:repo_url
,
:ref
,
:sha
,
:before_sha
expose
:ref_type
expose
:refspecs
expose
:git_depth
,
as: :depth
end
end
end
end
lib/api/entities/job_request/response.rb
deleted
100644 → 0
View file @
d6bb6a6c
# frozen_string_literal: true
module
API
module
Entities
module
JobRequest
class
Response
<
Grape
::
Entity
expose
:id
expose
:token
expose
:allow_git_fetch
expose
:job_info
,
using:
Entities
::
JobRequest
::
JobInfo
do
|
model
|
model
end
expose
:git_info
,
using:
Entities
::
JobRequest
::
GitInfo
do
|
model
|
model
end
expose
:runner_info
,
using:
Entities
::
JobRequest
::
RunnerInfo
do
|
model
|
model
end
expose
:runner_variables
,
as: :variables
expose
:steps
,
using:
Entities
::
JobRequest
::
Step
expose
:image
,
using:
Entities
::
JobRequest
::
Image
expose
:services
,
using:
Entities
::
JobRequest
::
Service
expose
:artifacts
,
using:
Entities
::
JobRequest
::
Artifacts
expose
:cache
,
using:
Entities
::
JobRequest
::
Cache
expose
:credentials
,
using:
Entities
::
JobRequest
::
Credentials
expose
:all_dependencies
,
as: :dependencies
,
using:
Entities
::
JobRequest
::
Dependency
expose
:features
end
end
end
end
API
::
Entities
::
JobRequest
::
Response
.
prepend_mod_with
(
'API::Entities::JobRequest::Response'
)
spec/lib/api/entities/job_request/image_spec.rb
→
spec/lib/api/entities/
ci/
job_request/image_spec.rb
View file @
336089c0
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
API
::
Entities
::
JobRequest
::
Image
do
RSpec
.
describe
API
::
Entities
::
Ci
::
JobRequest
::
Image
do
let
(
:ports
)
{
[{
number:
80
,
protocol:
'http'
,
name:
'name'
}]}
let
(
:image
)
{
double
(
name:
'image_name'
,
entrypoint:
[
'foo'
],
ports:
ports
)}
let
(
:entity
)
{
described_class
.
new
(
image
)
}
...
...
spec/lib/api/entities/job_request/port_spec.rb
→
spec/lib/api/entities/
ci/
job_request/port_spec.rb
View file @
336089c0
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
::
API
::
Entities
::
JobRequest
::
Port
do
RSpec
.
describe
::
API
::
Entities
::
Ci
::
JobRequest
::
Port
do
let
(
:port
)
{
double
(
number:
80
,
protocol:
'http'
,
name:
'name'
)}
let
(
:entity
)
{
described_class
.
new
(
port
)
}
...
...
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